private BoundarySpec getWindowBound(RexWindowBound wb) { BoundarySpec boundarySpec; if (wb.isCurrentRow()) { boundarySpec = new BoundarySpec(Direction.CURRENT); } else { final Direction direction; final int amt; if (wb.isPreceding()) { direction = Direction.PRECEDING; } else { direction = Direction.FOLLOWING; } if (wb.isUnbounded()) { amt = BoundarySpec.UNBOUNDED_AMOUNT; } else { amt = RexLiteral.intValue(wb.getOffset()); } boundarySpec = new BoundarySpec(direction, amt); } return boundarySpec; }
private BoundarySpec getWindowBound(RexWindowBound wb) { BoundarySpec boundarySpec; if (wb.isCurrentRow()) { boundarySpec = new BoundarySpec(Direction.CURRENT); } else { final Direction direction; final int amt; if (wb.isPreceding()) { direction = Direction.PRECEDING; } else { direction = Direction.FOLLOWING; } if (wb.isUnbounded()) { amt = BoundarySpec.UNBOUNDED_AMOUNT; } else { amt = RexLiteral.intValue(wb.getOffset()); } boundarySpec = new BoundarySpec(direction, amt); } return boundarySpec; }
private ASTNode getWindowBound(RexWindowBound wb) { ASTNode wbAST = null; if (wb.isCurrentRow()) { wbAST = ASTBuilder.createAST(HiveParser.KW_CURRENT, "CURRENT"); } else { if (wb.isPreceding()) wbAST = ASTBuilder.createAST(HiveParser.KW_PRECEDING, "PRECEDING"); else wbAST = ASTBuilder.createAST(HiveParser.KW_FOLLOWING, "FOLLOWING"); if (wb.isUnbounded()) { wbAST.addChild(ASTBuilder.createAST(HiveParser.KW_UNBOUNDED, "UNBOUNDED")); } else { ASTNode offset = wb.getOffset().accept(this); wbAST.addChild(offset); } } return wbAST; }
private ASTNode getWindowBound(RexWindowBound wb) { ASTNode wbAST = null; if (wb.isCurrentRow()) { wbAST = ASTBuilder.createAST(HiveParser.KW_CURRENT, "CURRENT"); } else { if (wb.isPreceding()) wbAST = ASTBuilder.createAST(HiveParser.KW_PRECEDING, "PRECEDING"); else wbAST = ASTBuilder.createAST(HiveParser.KW_FOLLOWING, "FOLLOWING"); if (wb.isUnbounded()) { wbAST.addChild(ASTBuilder.createAST(HiveParser.KW_UNBOUNDED, "UNBOUNDED")); } else { ASTNode offset = wb.getOffset().accept(this); wbAST.addChild(offset); } } return wbAST; }
private SqlNode createSqlWindowBound(RexWindowBound rexWindowBound) { if (rexWindowBound.isCurrentRow()) { return SqlWindow.createCurrentRow(POS); } if (rexWindowBound.isPreceding()) { if (rexWindowBound.isUnbounded()) { return SqlWindow.createUnboundedPreceding(POS); } else { SqlNode literal = toSql(null, rexWindowBound.getOffset()); return SqlWindow.createPreceding(literal, POS); } } if (rexWindowBound.isFollowing()) { if (rexWindowBound.isUnbounded()) { return SqlWindow.createUnboundedFollowing(POS); } else { SqlNode literal = toSql(null, rexWindowBound.getOffset()); return SqlWindow.createFollowing(literal, POS); } } throw new AssertionError("Unsupported Window bound: " + rexWindowBound); }
private SqlNode createSqlWindowBound(RexWindowBound rexWindowBound) { if (rexWindowBound.isCurrentRow()) { return SqlWindow.createCurrentRow(POS); } if (rexWindowBound.isPreceding()) { if (rexWindowBound.isUnbounded()) { return SqlWindow.createUnboundedPreceding(POS); } else { SqlNode literal = toSql(null, rexWindowBound.getOffset()); return SqlWindow.createPreceding(literal, POS); } } if (rexWindowBound.isFollowing()) { if (rexWindowBound.isUnbounded()) { return SqlWindow.createUnboundedFollowing(POS); } else { SqlNode literal = toSql(null, rexWindowBound.getOffset()); return SqlWindow.createFollowing(literal, POS); } } throw new AssertionError("Unsupported Window bound: " + rexWindowBound); }
private BoundarySpec getWindowBound(RexWindowBound wb, boolean isRows) { BoundarySpec boundarySpec; if (wb.isCurrentRow()) { boundarySpec = new CurrentRowSpec(); } else { final Direction direction; final int amt; if (wb.isPreceding()) { direction = Direction.PRECEDING; } else { direction = Direction.FOLLOWING; } if (wb.isUnbounded()) { amt = BoundarySpec.UNBOUNDED_AMOUNT; } else { amt = RexLiteral.intValue(wb.getOffset()); } if (isRows) { boundarySpec = new RangeBoundarySpec(direction, amt); } else { boundarySpec = new ValueBoundarySpec(direction, amt); } } return boundarySpec; }
return i_; RexNode node = bound.getOffset(); Expression offs = translator.translate(node); physType.getRowType().getFieldList().get(orderKey).getType(); Type desiredKeyType = translator.typeFactory.getJavaClass(keyType); if (bound.getOffset() == null) { desiredKeyType = Primitive.box(desiredKeyType); new RexInputRef(orderKey, keyType), desiredKeyType); if (!bound.isCurrentRow()) { RexNode node = bound.getOffset(); Expression offs = translator.translate(node);
return i_; RexNode node = bound.getOffset(); Expression offs = translator.translate(node); physType.getRowType().getFieldList().get(orderKey).getType(); Type desiredKeyType = translator.typeFactory.getJavaClass(keyType); if (bound.getOffset() == null) { desiredKeyType = Primitive.box(desiredKeyType); new RexInputRef(orderKey, keyType), desiredKeyType); if (!bound.isCurrentRow()) { RexNode node = bound.getOffset(); Expression offs = translator.translate(node);
private ASTNode getWindowBound(RexWindowBound wb) { ASTNode wbAST = null; if (wb.isCurrentRow()) { wbAST = ASTBuilder.createAST(HiveParser.KW_CURRENT, "CURRENT"); } else { if (wb.isPreceding()) wbAST = ASTBuilder.createAST(HiveParser.KW_PRECEDING, "PRECEDING"); else wbAST = ASTBuilder.createAST(HiveParser.KW_FOLLOWING, "FOLLOWING"); if (wb.isUnbounded()) { wbAST.addChild(ASTBuilder.createAST(HiveParser.KW_UNBOUNDED, "UNBOUNDED")); } else { ASTNode offset = wb.getOffset().accept(this); wbAST.addChild(offset); } } return wbAST; }