protected void initialize(WindowFrameDef winFrame, ShapeDetails inpShape) throws HiveException { if (winFrame.getWindowType() == WindowType.RANGE) { for (OrderExpressionDef exprDef : winFrame.getOrderDef().getExpressions()) { initialize(exprDef, inpShape); } } }
protected void initialize(WindowFrameDef winFrame, ShapeDetails inpShape) throws HiveException { if (winFrame.getWindowType() == WindowType.RANGE) { for (OrderExpressionDef exprDef : winFrame.getOrderDef().getExpressions()) { initialize(exprDef, inpShape); } } }
private boolean canPushLimitToReduceSink(WindowTableFunctionDef wTFn) { for(WindowFunctionDef wFnDef : wTFn.getWindowFunctions() ) { if ( (wFnDef.getWFnEval() instanceof GenericUDAFRankEvaluator) || (wFnDef.getWFnEval() instanceof GenericUDAFDenseRankEvaluator ) || (wFnDef.getWFnEval() instanceof GenericUDAFLeadEvaluator ) ) { continue; } WindowFrameDef wdwFrame = wFnDef.getWindowFrame(); BoundaryDef end = wdwFrame.getEnd(); if (wdwFrame.getWindowType() == WindowType.RANGE) { return false; } if ( end.getDirection() == Direction.FOLLOWING ) { return false; } } return true; }
private boolean canPushLimitToReduceSink(WindowTableFunctionDef wTFn) { for(WindowFunctionDef wFnDef : wTFn.getWindowFunctions() ) { if ( (wFnDef.getWFnEval() instanceof GenericUDAFRankEvaluator) || (wFnDef.getWFnEval() instanceof GenericUDAFDenseRankEvaluator ) || (wFnDef.getWFnEval() instanceof GenericUDAFLeadEvaluator ) ) { continue; } WindowFrameDef wdwFrame = wFnDef.getWindowFrame(); BoundaryDef end = wdwFrame.getEnd(); if (wdwFrame.getWindowType() == WindowType.RANGE) { return false; } if ( end.getDirection() == Direction.FOLLOWING ) { return false; } } return true; }
if (wdwFrame.getWindowType() == WindowType.ROWS) { if (!end.isUnbounded() && !start.isUnbounded()) { startPos = Math.min(startPos, wdwFrame.getStart().getRelativeOffset());
protected static Range getRange(WindowFrameDef winFrame, int currRow, PTFPartition p, boolean nullsLast) throws HiveException { BoundaryDef startB = winFrame.getStart(); BoundaryDef endB = winFrame.getEnd(); int start, end; if (winFrame.getWindowType() == WindowType.ROWS) { start = getRowBoundaryStart(startB, currRow); end = getRowBoundaryEnd(endB, currRow, p); } else { ValueBoundaryScanner vbs = ValueBoundaryScanner.getScanner(winFrame, nullsLast); start = vbs.computeStart(currRow, p); end = vbs.computeEnd(currRow, p); } start = start < 0 ? 0 : start; end = end > p.size() ? p.size() : end; return new Range(start, end, p); }
if (wdwFrame.getWindowType() == WindowType.ROWS) { if (!end.isUnbounded() && !start.isUnbounded()) { startPos = Math.min(startPos, wdwFrame.getStart().getRelativeOffset());
protected static Range getRange(WindowFrameDef winFrame, int currRow, PTFPartition p) throws HiveException { BoundaryDef startB = winFrame.getStart(); BoundaryDef endB = winFrame.getEnd(); int start, end; if (winFrame.getWindowType() == WindowType.ROWS) { start = getRowBoundaryStart(startB, currRow); end = getRowBoundaryEnd(endB, currRow, p); } else { ValueBoundaryScanner vbs = ValueBoundaryScanner.getScanner(winFrame); start = vbs.computeStart(currRow, p); end = vbs.computeEnd(currRow, p); } start = start < 0 ? 0 : start; end = end > p.size() ? p.size() : end; return new Range(start, end, p); }
if (wdwFrame.getWindowType() == WindowType.RANGE) { return false;
private WindowFrameDef translate(ShapeDetails inpShape, WindowFrameSpec spec, List<OrderExpression> orderExpressions) throws SemanticException { if (spec == null) { return null; } BoundarySpec s = spec.getStart(); BoundarySpec e = spec.getEnd(); int cmp = s.compareTo(e); if (cmp > 0) { throw new SemanticException(String.format( "Window range invalid, start boundary is greater than end boundary: %s", spec)); } WindowFrameDef winFrame = new WindowFrameDef( spec.getWindowType(), new BoundaryDef(s.direction, s.getAmt()), new BoundaryDef(e.direction, e.getAmt())); if (winFrame.getWindowType() == WindowType.RANGE) { winFrame.setOrderDef(buildOrderExpressions(inpShape, orderExpressions)); } return winFrame; }
((PrimitiveTypeInfo) singleTypeInfo).getPrimitiveCategory() : null); switch (windowFrameDef.getWindowType()) { case RANGE: if (!windowFrameDef.getEnd().isCurrentRow()) { throw new RuntimeException("Unexpected window type " + windowFrameDef.getWindowType());
private WindowFrameDef translate(ShapeDetails inpShape, WindowFrameSpec spec, List<OrderExpression> orderExpressions) throws SemanticException { if (spec == null) { return null; } BoundarySpec s = spec.getStart(); BoundarySpec e = spec.getEnd(); int cmp = s.compareTo(e); if (cmp > 0) { throw new SemanticException(String.format( "Window range invalid, start boundary is greater than end boundary: %s", spec)); } WindowFrameDef winFrame = new WindowFrameDef( spec.getWindowType(), new BoundaryDef(s.direction, s.getAmt()), new BoundaryDef(e.direction, e.getAmt())); if (winFrame.getWindowType() == WindowType.RANGE) { winFrame.setOrderDef(buildOrderExpressions(inpShape, orderExpressions)); } return winFrame; }
if (wdwFrame.getWindowType() == WindowType.RANGE) { return false;
(windowFrameDef.getWindowType() == WindowType.ROWS && windowFrameDef.getEnd().isCurrentRow());