private RexNode convertJoinCondition( Blackboard bb, SqlNode condition, JoinConditionType conditionType, RelNode leftRel, RelNode rightRel) { if (condition == null) { return rexBuilder.makeLiteral(true); } bb.setRoot(ImmutableList.of(leftRel, rightRel)); replaceSubqueries(bb, condition, RelOptUtil.Logic.UNKNOWN_AS_FALSE); switch (conditionType) { case ON: bb.setRoot(ImmutableList.of(leftRel, rightRel)); return bb.convertExpression(condition); case USING: SqlNodeList list = (SqlNodeList) condition; List<String> nameList = new ArrayList<String>(); for (SqlNode columnName : list) { final SqlIdentifier id = (SqlIdentifier) columnName; String name = id.getSimple(); nameList.add(name); } return convertUsing(leftRel, rightRel, nameList); default: throw Util.unexpected(conditionType); } }
ret, relNode, rexBuilder.makeLiteral(true), JoinRelType.INNER, ImmutableSet.<String>of());
/** * Creates a numeric literal. */ public RexLiteral makeExactLiteral(BigDecimal bd, RelDataType type) { return makeLiteral(bd, type, SqlTypeName.DECIMAL); }
/** * Creates a numeric literal. */ public RexLiteral makeExactLiteral(BigDecimal bd, RelDataType type) { return makeLiteral( bd, type, SqlTypeName.DECIMAL); }
rel, rightKeys, rexBuilder); } else { joinCond = rexBuilder.makeLiteral(true);
switch (subQuery.logic) { case TRUE: return rexBuilder.makeLiteral(true); final RexLiteral trueLiteral = rexBuilder.makeLiteral(true); final RexLiteral falseLiteral = rexBuilder.makeLiteral(false); final RexNode unknownLiteral = rexBuilder.makeNullLiteral(SqlTypeName.BOOLEAN);
reinterpretCast ? rexBuilder.makeReinterpretCast(histogramType, exprs.get(0), rexBuilder.makeLiteral(false)) : rexBuilder.makeCast(histogramType, exprs.get(0))); type, histogramCall, rexBuilder.makeLiteral(false)); } else { histogramCall =
/** * Creates a BIGINT literal. */ public RexLiteral makeBigintLiteral(BigDecimal bd) { RelDataType bigintType = typeFactory.createSqlType( SqlTypeName.BIGINT); return makeLiteral(bd, bigintType, SqlTypeName.DECIMAL); }
/** * Creates a Date literal. */ public RexLiteral makeDateLiteral(Calendar date) { assert date != null; return makeLiteral( date, typeFactory.createSqlType(SqlTypeName.DATE), SqlTypeName.DATE); }
/** * Creates a Time literal. */ public RexLiteral makeTimeLiteral( Calendar time, int precision) { assert time != null; return makeLiteral( time, typeFactory.createSqlType(SqlTypeName.TIME, precision), SqlTypeName.TIME); }
/** * Creates a BIGINT literal. */ public RexLiteral makeBigintLiteral(BigDecimal bd) { RelDataType bigintType = typeFactory.createSqlType( SqlTypeName.BIGINT); return makeLiteral(bd, bigintType, SqlTypeName.DECIMAL); }
/** * Creates a byte array literal. */ public RexLiteral makeBinaryLiteral(byte [] byteArray) { return makeLiteral( ByteBuffer.wrap(byteArray), typeFactory.createSqlType( SqlTypeName.BINARY, byteArray.length), SqlTypeName.BINARY); }
/** * Creates a literal representing a flag. * * @param flag Flag value */ public RexLiteral makeFlag(Enum flag) { assert flag != null; return makeLiteral(flag, typeFactory.createSqlType(SqlTypeName.SYMBOL), SqlTypeName.SYMBOL); }
JoinRel join = new JoinRel(cluster, bb.root, aggregate, rexBuilder.makeLiteral(true), JoinRelType.INNER, ImmutableSet.<String>of()); bb.setRoot(join, false);
/** * Creates an approximate numeric literal (double or float). * * @param bd literal value * @param type approximate numeric type * @return new literal */ public RexLiteral makeApproxLiteral(BigDecimal bd, RelDataType type) { assert SqlTypeFamily.APPROXIMATE_NUMERIC.getTypeNames().contains( type.getSqlTypeName()); return makeLiteral(bd, type, SqlTypeName.DOUBLE); }
/** * Creates an interval literal. */ public RexLiteral makeIntervalLiteral( long l, SqlIntervalQualifier intervalQualifier) { return makeLiteral( new BigDecimal(l), typeFactory.createSqlIntervalType(intervalQualifier), intervalQualifier.isYearMonth() ? SqlTypeName.INTERVAL_YEAR_MONTH : SqlTypeName.INTERVAL_DAY_TIME); }
public RexNode apply(RexNode input) { return input.isAlwaysTrue() ? rexBuilder.makeLiteral(false) : input.isAlwaysFalse() ? rexBuilder.makeLiteral(true) : input.getKind() == SqlKind.NOT ? ((RexCall) input).operands.get(0) : rexBuilder.makeCall(SqlStdOperatorTable.NOT, input); } };
/** * Creates a byte array literal. */ public RexLiteral makeBinaryLiteral(ByteString byteString) { return makeLiteral( byteString, typeFactory.createSqlType(SqlTypeName.BINARY, byteString.length()), SqlTypeName.BINARY); }
/** * Creates an interval literal. */ public RexLiteral makeIntervalLiteral( BigDecimal v, SqlIntervalQualifier intervalQualifier) { return makeLiteral( v, typeFactory.createSqlIntervalType(intervalQualifier), intervalQualifier.isYearMonth() ? SqlTypeName.INTERVAL_YEAR_MONTH : SqlTypeName.INTERVAL_DAY_TIME); }
private RexNode createCoordinate(Zodiac z) { return sargFactory.getRexBuilder().makeLiteral(z.toString()); }