@Override public ASTNode visitLiteral(RexLiteral literal) { if (RexUtil.isNull(literal) && literal.getType().getSqlTypeName() != SqlTypeName.NULL && rexBuilder != null) { // It is NULL value with different type, we need to introduce a CAST // to keep it if(nullLiteralMap.containsKey(literal)) { return ASTBuilder.literal(literal, useTypeQualInLiteral); } nullLiteralMap.put(literal, true); RexNode r = rexBuilder.makeAbstractCast(literal.getType(), literal); return r.accept(this); } return ASTBuilder.literal(literal, useTypeQualInLiteral); }
public RexNode visitLiteral(RexLiteral literal) { // Get the value as is return new RexLiteral(RexLiteral.value(literal), copy(literal.getType()), literal.getTypeName()); }
if (temp.getType().getFamily() != SqlTypeFamily.NUMERIC || !(temp.getValue() instanceof BigDecimal)) { return null;// only numeric constants now
public RexNode visitLiteral(RexLiteral literal) { // Get the value as is return new RexLiteral(RexLiteral.value(literal), copy(literal.getType()), literal.getTypeName()); }
public static ASTNode literal(RexLiteral literal, boolean useTypeQualInLiteral) { Object val = null; int type = 0; SqlTypeName sqlType = literal.getType().getSqlTypeName();
@Override public ExprNodeDesc visitLiteral(RexLiteral literal) { RelDataType lType = literal.getType(); switch (literal.getType().getSqlTypeName()) { case BOOLEAN: return new ExprNodeConstantDesc(TypeInfoFactory.booleanTypeInfo, null); switch (literal.getType().getSqlTypeName()) { case BOOLEAN: return new ExprNodeConstantDesc(TypeInfoFactory.booleanTypeInfo, Boolean.valueOf(RexLiteral
@Override public ExprNodeDesc visitLiteral(RexLiteral literal) { RelDataType lType = literal.getType(); switch (literal.getType().getSqlTypeName()) { case BOOLEAN: return new ExprNodeConstantDesc(TypeInfoFactory.booleanTypeInfo, null); switch (literal.getType().getSqlTypeName()) { case BOOLEAN: return new ExprNodeConstantDesc(TypeInfoFactory.booleanTypeInfo, Boolean.valueOf(RexLiteral
public static ASTNode literal(RexLiteral literal, boolean useTypeQualInLiteral) { Object val = null; int type = 0; SqlTypeName sqlType = literal.getType().getSqlTypeName();
@Override public RexNode visitLiteral(RexLiteral literal) { RexInputRef ref = constantPool.get(literal); if (ref != null) { return ref; } constants.add(literal); ref = new RexInputRef(constantPool.size() + inputFieldCount, literal.getType()); constantPool.put(literal, ref); return ref; } };
@Override public RexNode visitLiteral(RexLiteral literal) { RexInputRef ref = constantPool.get(literal); if (ref != null) { return ref; } constants.add(literal); ref = new RexInputRef(constantPool.size() + inputFieldCount, literal.getType()); constantPool.put(literal, ref); return ref; } };
public boolean isIntegral() { return SqlTypeName.INT_TYPES.contains(literal.getType().getSqlTypeName()); }
boolean isBoolean() { return SqlTypeName.BOOLEAN_TYPES.contains(literal.getType().getSqlTypeName()); }
@Override public RelDataType get(int index) { return index < childFieldCount ? childRowType.getFieldList().get(index).getType() : constants.get(index - childFieldCount).getType(); }
@Override public RelDataType get(int index) { return index < childFieldCount ? childRowType.getFieldList().get(index).getType() : constants.get(index - childFieldCount).getType(); }
@Override public String visitLiteral(RexLiteral literal) { if (literal.getValue() == null) { return "null"; } return "\"literal\":\"" + RexToLixTranslator.translateLiteral(literal, literal.getType(), typeFactory, RexImpTable.NullAs.NOT_POSSIBLE) + "\""; }
private static void verifyRowType(final ImmutableList<ImmutableList<RexLiteral>> tuples, RelDataType rowType){ for (List<RexLiteral> tuple : tuples) { assert (tuple.size() == rowType.getFieldCount()); for (Pair<RexLiteral, RelDataTypeField> pair : Pair.zip(tuple, rowType.getFieldList())) { RexLiteral literal = pair.left; RelDataType fieldType = pair.right.getType(); if ((!(RexLiteral.isNullLiteral(literal))) && (!(SqlTypeUtil.canAssignFrom(fieldType, literal.getType())))) { throw new AssertionError("to " + fieldType + " from " + literal); } } } }
private static PathSegment convertLiteral(RexLiteral literal) { switch (literal.getType().getSqlTypeName()) { case CHAR: return new PathSegment.NameSegment(RexLiteral.stringValue(literal)); case INTEGER: return new PathSegment.ArraySegment(RexLiteral.intValue(literal)); default: return null; } }
private PathSegment convertLiteral(RexLiteral literal) { switch (literal.getType().getSqlTypeName().getFamily()) { case CHARACTER: return new NameSegment(RexLiteral.stringValue(literal)); case NUMERIC: return new ArraySegment(RexLiteral.intValue(literal)); default: return null; } }