final String length; if (!call.getOperands().get(1).isA(SqlKind.LITERAL)) { final String indexExp = DruidExpressions.toDruidExpression(call.getOperands().get(1), rowType, query); if (indexExp == null) { if (!call.getOperands().get(2).isA(SqlKind.LITERAL)) { length = DruidExpressions.toDruidExpression(call.getOperands().get(2), rowType, query); if (length == null) {
if (sortExpression.isA(SqlKind.INPUT_REF)) { final RexInputRef ref = (RexInputRef) sortExpression; final String fieldName = outputRowSignature.getRowOrder().get(ref.getIndex());
&& arg1.isA(SqlKind.LITERAL) && !RexLiteral.isNullLiteral(arg1) && RexLiteral.isNullLiteral(arg2)) {
needed.add(fc.getFieldIndex()); final RexNode node = project.getProjects().get(map.getTarget(fc.getFieldIndex())); if (node.isA(SqlKind.CAST)) {
final EquivalenceClasses ec = new EquivalenceClasses(); for (RexNode conj : RelOptUtil.conjunctions(cond)) { if (!conj.isA(SqlKind.EQUALS)) {
EquivalenceClasses ec = new EquivalenceClasses(); for (RexNode conj : joinFilters) { if (!conj.isA(SqlKind.EQUALS)) {
Mapping mappingRL = Mappings.create(MappingType.PARTIAL_FUNCTION, joinFieldCount, joinFieldCount); for (RexNode conj : RelOptUtil.conjunctions(cond)) { if (!conj.isA(SqlKind.EQUALS)) { continue;
} else { final RexNode projectExp = rightProject.getChildExps().get(joinRef); if (projectExp.isA(SqlKind.INPUT_REF)) { aggregateRef = ((RexInputRef) projectExp).getIndex(); } else {
public boolean canExpand(RexCall call) { return call.isA(SqlKind.REINTERPRET) && call.operands.get(0).isA(SqlKind.REINTERPRET); }
public boolean canExpand(RexCall call) { return call.isA(SqlKind.REINTERPRET) && call.operands.get(0).isA(SqlKind.REINTERPRET); }
private void updateBinaryOpUsage(RexCall call) { final List<RexNode> operands = call.getOperands(); RexNode first = removeCast(operands.get(0)); RexNode second = removeCast(operands.get(1)); if (first.isA(SqlKind.INPUT_REF) && second.isA(SqlKind.LITERAL)) { updateUsage(call.getOperator(), (RexInputRef) first, second); } if (first.isA(SqlKind.LITERAL) && second.isA(SqlKind.INPUT_REF)) { updateUsage(reverse(call.getOperator()), (RexInputRef) second, first); } }
private void updateBinaryOpUsage(RexCall call) { final List<RexNode> operands = call.getOperands(); RexNode first = removeCast(operands.get(0)); RexNode second = removeCast(operands.get(1)); if (first.isA(SqlKind.INPUT_REF) && second.isA(SqlKind.LITERAL)) { updateUsage(call.getOperator(), (RexInputRef) first, second); } if (first.isA(SqlKind.LITERAL) && second.isA(SqlKind.INPUT_REF)) { updateUsage(reverse(call.getOperator()), (RexInputRef) second, first); } }
private static boolean isLowerBound(final RexNode e) { final List<RexNode> operands; switch (e.getKind()) { case LESS_THAN: case LESS_THAN_OR_EQUAL: operands = ((RexCall) e).getOperands(); return RexUtil.isReferenceOrAccess(operands.get(1), true) && operands.get(0).isA(SqlKind.LITERAL); case GREATER_THAN: case GREATER_THAN_OR_EQUAL: operands = ((RexCall) e).getOperands(); return RexUtil.isReferenceOrAccess(operands.get(0), true) && operands.get(1).isA(SqlKind.LITERAL); default: return false; } }
private static boolean isLimit0(RexNode fetch) { if (fetch != null && fetch.isA(SqlKind.LITERAL)) { RexLiteral l = (RexLiteral) fetch; switch (l.getTypeName()) { case BIGINT: case INTEGER: case DECIMAL: if (((long) l.getValue2()) == 0) { return true; } } } return false; }
public static boolean isLimit0(RexNode fetch) { if (fetch != null && fetch.isA(SqlKind.LITERAL)) { RexLiteral l = (RexLiteral) fetch; switch (l.getTypeName()) { case BIGINT: case INTEGER: case DECIMAL: if (((long) l.getValue2()) == 0) { return true; } } } return false; }
private Map<Integer, Integer> getDistributionMap(ProjectRel project) { Map<Integer, Integer> m = new HashMap<Integer, Integer>(); for (Ord<RexNode> node : Ord.zip(project.getProjects())) { // For distribution, either $0 or cast($0 as ...) would keep the distribution after projection. if (node.e instanceof RexInputRef) { m.put( ((RexInputRef) node.e).getIndex(), node.i); } else if (node.e.isA(SqlKind.CAST)) { RexNode operand = ((RexCall) node.e).getOperands().get(0); if (operand instanceof RexInputRef) { m.put(((RexInputRef) operand).getIndex(), node.i); } } } return m; }
private void updateUnaryOpUsage(RexCall call) { final List<RexNode> operands = call.getOperands(); RexNode first = removeCast(operands.get(0)); if (first.isA(SqlKind.INPUT_REF)) { updateUsage(call.getOperator(), (RexInputRef) first, null); } }
private void updateUnaryOpUsage(RexCall call) { final List<RexNode> operands = call.getOperands(); RexNode first = removeCast(operands.get(0)); if (first.isA(SqlKind.INPUT_REF)) { updateUsage(call.getOperator(), (RexInputRef) first, null); } }