org.apache.hadoop.hive.ql.exec.PTFRollingPartition Maven / Gradle / Ivy
/**
* 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.ArrayList;
import java.util.List;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hive.ql.metadata.HiveException;
import org.apache.hadoop.hive.ql.plan.ptf.WindowFrameDef;
import org.apache.hadoop.hive.serde2.AbstractSerDe;
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;
public class PTFRollingPartition extends PTFPartition {
/*
* num rows whose output is evaluated.
*/
int numRowsProcessed;
/*
* Relative start position of the windowing. Can be negative.
*/
int startPos;
/*
* Relative end position of the windowing. Can be negative.
*/
int endPos;
/*
* number of rows received.
*/
int numRowsReceived;
/*
* State of the Rolling Partition
*
* x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16 x17
* ^ ^ ^
* | | |
* |--preceding span--numRowsProcessed---followingSpan --numRowsRecived
*
* a. index x7 : represents the last output row
* b. so preceding span rows before that are still held on for subsequent rows processing.
* c. The #of rows beyond numRowsProcessed = followingSpan
*/
/*
* cache of rows; guaranteed to contain precedingSpan rows before
* nextRowToProcess.
*/
List