Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.hive.ql.exec;
import java.util.ConcurrentModificationException;
import java.util.Iterator;
import java.util.List;
import com.facebook.presto.hive.$internal.org.slf4j.Logger;
import com.facebook.presto.hive.$internal.org.slf4j.LoggerFactory;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hive.conf.HiveConf;
import org.apache.hadoop.hive.conf.HiveConf.ConfVars;
import org.apache.hadoop.hive.ql.exec.persistence.PTFRowContainer;
import org.apache.hadoop.hive.ql.metadata.HiveException;
import org.apache.hadoop.hive.serde2.AbstractSerDe;
import org.apache.hadoop.hive.serde2.SerDeException;
import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspectorUtils;
import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspectorUtils.ObjectInspectorCopyOption;
import org.apache.hadoop.hive.serde2.objectinspector.StructObjectInspector;
/*
* represents a collection of rows that is acted upon by a TableFunction or a WindowFunction.
*/
@SuppressWarnings("deprecation")
public class PTFPartition {
protected static Logger LOG = LoggerFactory.getLogger(PTFPartition.class);
AbstractSerDe serDe;
StructObjectInspector inputOI;
StructObjectInspector outputOI;
private final PTFRowContainer> elems;
protected PTFPartition(Configuration cfg,
AbstractSerDe serDe, StructObjectInspector inputOI,
StructObjectInspector outputOI)
throws HiveException {
this(cfg, serDe, inputOI, outputOI, true);
}
protected PTFPartition(Configuration cfg,
AbstractSerDe serDe, StructObjectInspector inputOI,
StructObjectInspector outputOI,
boolean createElemContainer)
throws HiveException {
this.serDe = serDe;
this.inputOI = inputOI;
this.outputOI = outputOI;
if ( createElemContainer ) {
int containerNumRows = HiveConf.getIntVar(cfg, ConfVars.HIVEJOINCACHESIZE);
elems = new PTFRowContainer>(containerNumRows, cfg, null);
elems.setSerDe(serDe, outputOI);
elems.setTableDesc(PTFRowContainer.createTableDesc(inputOI));
} else {
elems = null;
}
}
public void reset() throws HiveException {
elems.clearRows();
}
public AbstractSerDe getSerDe() {
return serDe;
}
public StructObjectInspector getInputOI() {
return inputOI;
}
public StructObjectInspector getOutputOI() {
return outputOI;
}
public Object getAt(int i) throws HiveException
{
return elems.getAt(i);
}
public void append(Object o) throws HiveException {
if ( elems.rowCount() == Integer.MAX_VALUE ) {
throw new HiveException(String.format("Cannot add more than %d elements to a PTFPartition",
Integer.MAX_VALUE));
}
@SuppressWarnings("unchecked")
List