use of org.apache.hadoop.hive.ql.plan.ptf.OrderDef in project hive by apache.
the class MultiValueBoundaryScanner method getScanner.
public static ValueBoundaryScanner getScanner(WindowFrameDef winFrameDef) throws HiveException {
OrderDef orderDef = winFrameDef.getOrderDef();
int numOrders = orderDef.getExpressions().size();
if (numOrders != 1) {
return new MultiValueBoundaryScanner(winFrameDef.getStart(), winFrameDef.getEnd(), orderDef);
} else {
return SingleValueBoundaryScanner.getScanner(winFrameDef.getStart(), winFrameDef.getEnd(), orderDef);
}
}
use of org.apache.hadoop.hive.ql.plan.ptf.OrderDef in project hive by apache.
the class PTFTranslator method buildOrderExpressions.
/**
* Collect order expressions for RANGE based windowing
* @throws SemanticException
*/
private OrderDef buildOrderExpressions(ShapeDetails inpShape, List<OrderExpression> orderExpressions) throws SemanticException {
OrderDef orderDef = new OrderDef();
for (OrderExpression oe : orderExpressions) {
PTFTranslator.validateNoLeadLagInValueBoundarySpec(oe.getExpression());
PTFExpressionDef exprDef = null;
try {
exprDef = buildExpressionDef(inpShape, oe.getExpression());
} catch (HiveException he) {
throw new SemanticException(he);
}
PTFTranslator.validateValueBoundaryExprType(exprDef.getOI());
OrderExpressionDef orderExprDef = new OrderExpressionDef(exprDef);
orderExprDef.setOrder(oe.getOrder());
orderExprDef.setNullOrder(oe.getNullOrder());
orderDef.addExpression(orderExprDef);
}
return orderDef;
}
use of org.apache.hadoop.hive.ql.plan.ptf.OrderDef in project hive by apache.
the class PTFTranslator method translatePartitioning.
private void translatePartitioning(PartitionedTableFunctionDef def, PartitionedTableFunctionSpec spec) throws SemanticException {
applyConstantPartition(spec);
if (spec.getPartition() == null) {
return;
}
PartitionDef partDef = translate(def.getRawInputShape(), spec.getPartition());
OrderDef orderDef = translate(def.getRawInputShape(), spec.getOrder(), partDef);
def.setPartition(partDef);
def.setOrder(orderDef);
}
use of org.apache.hadoop.hive.ql.plan.ptf.OrderDef in project hive by apache.
the class MultiValueBoundaryScanner method getScanner.
public static ValueBoundaryScanner getScanner(WindowFrameDef winFrameDef, boolean nullsLast) throws HiveException {
OrderDef orderDef = winFrameDef.getOrderDef();
int numOrders = orderDef.getExpressions().size();
if (numOrders != 1) {
return MultiValueBoundaryScanner.getScanner(winFrameDef.getStart(), winFrameDef.getEnd(), orderDef, nullsLast);
} else {
return SingleValueBoundaryScanner.getScanner(winFrameDef.getStart(), winFrameDef.getEnd(), orderDef, nullsLast);
}
}
use of org.apache.hadoop.hive.ql.plan.ptf.OrderDef in project hive by apache.
the class PTFTranslator method translate.
private OrderDef translate(ShapeDetails inpShape, OrderSpec spec, PartitionDef partitionDef) throws SemanticException {
OrderDef def = new OrderDef();
if (null == spec) {
return def;
}
for (OrderExpression oExpr : spec.getExpressions()) {
OrderExpressionDef oexpDef = translate(inpShape, oExpr);
def.addExpression(oexpDef);
}
return def;
}
Aggregations