@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 RexNode visitLiteral(RexLiteral literal) { return new RexLiteral( literal.getValue(), builder.getTypeFactory().copyType(literal.getType()), literal.getTypeName()); }
@Override public RelDataType get(int index) { return index < childFieldCount ? childRowType.getFieldList().get(index).getType() : constants.get(index - childFieldCount).getType(); }
public RexNode visitLiteral(RexLiteral literal) { return new RexLiteral( literal.getValue(), builder.getTypeFactory().copyType(literal.getType()), literal.getTypeName()); }
/** * Sets a finite value for this endpoint. * * @param boundType bound type (upper/lower) * @param strictness boundary strictness * @param coordinate endpoint position */ void setFinite( SargBoundType boundType, SargStrictness strictness, RexNode coordinate) { // validate the input assert coordinate != null; if (!(coordinate instanceof RexDynamicParam) && !(coordinate instanceof RexInputRef)) { assert coordinate instanceof RexLiteral; RexLiteral literal = (RexLiteral) coordinate; if (!RexLiteral.isNullLiteral(literal)) { assert SqlTypeUtil.canAssignFrom( dataType, literal.getType()); } } this.boundType = boundType; this.coordinate = coordinate; this.strictness = strictness; convertToTargetType(); }
/** * Sets a finite value for this endpoint. * * @param boundType bound type (upper/lower) * @param strictness boundary strictness * @param coordinate endpoint position */ void setFinite( SargBoundType boundType, SargStrictness strictness, RexNode coordinate) { // validate the input assert (coordinate != null); if (!(coordinate instanceof RexDynamicParam) && !(coordinate instanceof RexInputRef)) { assert (coordinate instanceof RexLiteral); RexLiteral literal = (RexLiteral) coordinate; if (!RexLiteral.isNullLiteral(literal)) { assert (SqlTypeUtil.canAssignFrom( dataType, literal.getType())); } } this.boundType = boundType; this.coordinate = coordinate; this.strictness = strictness; convertToTargetType(); }
BigDecimal value2 = (BigDecimal) value; final long multiplier = literal.getType().getIntervalQualifier().getStartUnit() .multiplier; SqlTypeName typeName = type.getSqlTypeName();
switch( rexLiteral.getType().getSqlTypeName() )
/** * @return true if all tuples match rowType; otherwise, assert on mismatch */ private boolean assertRowType() { 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(); // TODO jvs 19-Feb-2006: strengthen this a bit. For example, // overflow, rounding, and padding/truncation must already have // been dealt with. if (!RexLiteral.isNullLiteral(literal)) { assert SqlTypeUtil.canAssignFrom(fieldType, literal.getType()) : "to " + fieldType + " from " + literal; } } } return true; }
/** * @return true if all tuples match rowType; otherwise, assert on mismatch */ private boolean assertRowType() { 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(); // TODO jvs 19-Feb-2006: strengthen this a bit. For example, // overflow, rounding, and padding/truncation must already have // been dealt with. if (!RexLiteral.isNullLiteral(literal)) { assert (SqlTypeUtil.canAssignFrom( fieldType, literal.getType())); } } } return true; }
switch (literal.getType().getSqlTypeName()) { case DECIMAL: assert javaClass == BigDecimal.class;
switch (literal.getType().getSqlTypeName()) { case DECIMAL: assert javaClass == BigDecimal.class;
RelDataType newRowType = project.getCluster().getTypeFactory().createStructType( Collections.singletonList(expr.getType()), Collections.singletonList("DUMMY")); ProjectRel newProject = new ProjectRel(
RelDataType newRowType = project.getCluster().getTypeFactory().createStructType( Collections.singletonList(expr.getType()), Collections.singletonList("DUMMY")); ProjectRel newProject = new ProjectRel(
for (RexLiteral constant : constants) { translatedConstants.add(RexToLixTranslator.translateLiteral( constant, constant.getType(), typeFactory, RexImpTable.NullAs.NULL));