本文整理了Java中org.apache.calcite.rex.RexLiteral.getValue3
方法的一些代码示例,展示了RexLiteral.getValue3
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RexLiteral.getValue3
方法的具体详情如下:
包路径:org.apache.calcite.rex.RexLiteral
类名称:RexLiteral
方法名:getValue3
[英]Returns the value of this literal, in the form that the rex-to-lix translator wants it.
[中]以rex to lix转换器想要的形式返回该文本的值。
代码示例来源:origin: apache/drill
case CHAR:
case BOOLEAN:
if (literal.getValue3() == null) {
return ASTBuilder.construct(HiveParser.TOK_NULL, "TOK_NULL").node();
case TINYINT:
if (useTypeQualInLiteral) {
val = literal.getValue3() + "Y";
} else {
val = literal.getValue3();
case SMALLINT:
if (useTypeQualInLiteral) {
val = literal.getValue3() + "S";
} else {
val = literal.getValue3();
val = literal.getValue3();
type = HiveParser.IntegralLiteral;
break;
case BIGINT:
if (useTypeQualInLiteral) {
val = literal.getValue3() + "L";
} else {
val = literal.getValue3();
val = literal.getValue3() + "D";
type = HiveParser.NumberLiteral;
break;
代码示例来源:origin: apache/hive
case CHAR:
case BOOLEAN:
if (literal.getValue3() == null) {
return ASTBuilder.construct(HiveParser.TOK_NULL, "TOK_NULL").node();
case TINYINT:
if (useTypeQualInLiteral) {
val = literal.getValue3() + "Y";
} else {
val = literal.getValue3();
case SMALLINT:
if (useTypeQualInLiteral) {
val = literal.getValue3() + "S";
} else {
val = literal.getValue3();
val = literal.getValue3();
type = HiveParser.IntegralLiteral;
break;
case BIGINT:
if (useTypeQualInLiteral) {
val = literal.getValue3() + "L";
} else {
val = literal.getValue3();
val = literal.getValue3() + "D";
type = HiveParser.NumberLiteral;
break;
代码示例来源:origin: apache/drill
case TINYINT:
return new ExprNodeConstantDesc(TypeInfoFactory.byteTypeInfo, Byte.valueOf(((Number) literal
.getValue3()).byteValue()));
case SMALLINT:
return new ExprNodeConstantDesc(TypeInfoFactory.shortTypeInfo,
Short.valueOf(((Number) literal.getValue3()).shortValue()));
case INTEGER:
return new ExprNodeConstantDesc(TypeInfoFactory.intTypeInfo,
Integer.valueOf(((Number) literal.getValue3()).intValue()));
case BIGINT:
return new ExprNodeConstantDesc(TypeInfoFactory.longTypeInfo, Long.valueOf(((Number) literal
.getValue3()).longValue()));
case FLOAT:
case REAL:
return new ExprNodeConstantDesc(TypeInfoFactory.floatTypeInfo,
Float.valueOf(((Number) literal.getValue3()).floatValue()));
case DOUBLE:
return new ExprNodeConstantDesc(TypeInfoFactory.doubleTypeInfo,
Double.valueOf(((Number) literal.getValue3()).doubleValue()));
case DATE:
return new ExprNodeConstantDesc(TypeInfoFactory.dateTypeInfo,
case TIME:
case TIMESTAMP: {
Object value = literal.getValue3();
if (value instanceof Long) {
value = new Timestamp((Long)value);
return new ExprNodeConstantDesc(TypeInfoFactory.binaryTypeInfo, literal.getValue3());
代码示例来源:origin: apache/hive
case TINYINT:
return new ExprNodeConstantDesc(TypeInfoFactory.byteTypeInfo, Byte.valueOf(((Number) literal
.getValue3()).byteValue()));
case SMALLINT:
return new ExprNodeConstantDesc(TypeInfoFactory.shortTypeInfo,
Short.valueOf(((Number) literal.getValue3()).shortValue()));
case INTEGER:
return new ExprNodeConstantDesc(TypeInfoFactory.intTypeInfo,
Integer.valueOf(((Number) literal.getValue3()).intValue()));
case BIGINT:
return new ExprNodeConstantDesc(TypeInfoFactory.longTypeInfo, Long.valueOf(((Number) literal
.getValue3()).longValue()));
case FLOAT:
case REAL:
return new ExprNodeConstantDesc(TypeInfoFactory.floatTypeInfo,
Float.valueOf(((Number) literal.getValue3()).floatValue()));
case DOUBLE:
return new ExprNodeConstantDesc(TypeInfoFactory.doubleTypeInfo,
Double.valueOf(((Number) literal.getValue3()).doubleValue()));
case DATE:
return new ExprNodeConstantDesc(TypeInfoFactory.dateTypeInfo,
TimestampTZUtil.parse(literal.getValueAs(TimestampString.class).toString() + " UTC"));
case BINARY:
return new ExprNodeConstantDesc(TypeInfoFactory.binaryTypeInfo, literal.getValue3());
case DECIMAL:
return new ExprNodeConstantDesc(TypeInfoFactory.getDecimalTypeInfo(lType.getPrecision(),
lType.getScale()), HiveDecimal.create((BigDecimal)literal.getValue3()));
case VARCHAR:
代码示例来源:origin: dremio/dremio-oss
escape = ((RexLiteral) op3).getValue3().toString();
} else {
return null;
pattern = ((RexLiteral) op2).getValue3().toString();
} else {
return null;
代码示例来源:origin: dremio/dremio-oss
return new LitInput(literal.getValue3().toString(), key, literalFirst);
代码示例来源:origin: com.facebook.presto.hive/hive-apache
case TINYINT:
return new ExprNodeConstantDesc(TypeInfoFactory.byteTypeInfo, Byte.valueOf(((Number) literal
.getValue3()).byteValue()));
case SMALLINT:
return new ExprNodeConstantDesc(TypeInfoFactory.shortTypeInfo,
Short.valueOf(((Number) literal.getValue3()).shortValue()));
case INTEGER:
return new ExprNodeConstantDesc(TypeInfoFactory.intTypeInfo,
Integer.valueOf(((Number) literal.getValue3()).intValue()));
case BIGINT:
return new ExprNodeConstantDesc(TypeInfoFactory.longTypeInfo, Long.valueOf(((Number) literal
.getValue3()).longValue()));
case FLOAT:
return new ExprNodeConstantDesc(TypeInfoFactory.floatTypeInfo,
Float.valueOf(((Number) literal.getValue3()).floatValue()));
case DOUBLE:
return new ExprNodeConstantDesc(TypeInfoFactory.doubleTypeInfo,
Double.valueOf(((Number) literal.getValue3()).doubleValue()));
case DATE:
return new ExprNodeConstantDesc(TypeInfoFactory.dateTypeInfo,
new Date(((Calendar)literal.getValue()).getTimeInMillis()));
case TIMESTAMP: {
Object value = literal.getValue3();
if (value instanceof Long) {
value = new Timestamp((Long)value);
return new ExprNodeConstantDesc(TypeInfoFactory.binaryTypeInfo, literal.getValue3());
case DECIMAL:
return new ExprNodeConstantDesc(TypeInfoFactory.getDecimalTypeInfo(lType.getPrecision(),
代码示例来源:origin: Qihoo360/Quicksql
final RexLiteral rexLiteral = (RexLiteral) e;
if (!formatDateString) {
return Objects.toString(rexLiteral.getValue3());
} else {
代码示例来源:origin: Qihoo360/Quicksql
private void checkTimestampWithLocalTimeZone(RexNode node) {
assertThat(node.toString(), is("1969-07-21 02:56:15"));
RexLiteral literal = (RexLiteral) node;
assertThat(literal.getValue() instanceof TimestampString, is(true));
assertThat(literal.getValue2() instanceof Long, is(true));
assertThat(literal.getValue3() instanceof Long, is(true));
}
代码示例来源:origin: org.apache.calcite/calcite-core
private void checkTimestampWithLocalTimeZone(RexNode node) {
assertThat(node.toString(), is("1969-07-21 02:56:15"));
RexLiteral literal = (RexLiteral) node;
assertThat(literal.getValue() instanceof TimestampString, is(true));
assertThat(literal.getValue2() instanceof Long, is(true));
assertThat(literal.getValue3() instanceof Long, is(true));
}
代码示例来源:origin: org.apache.calcite/calcite-core
private void checkTimestamp(RexNode node) {
assertThat(node.toString(), is("1969-07-21 02:56:15"));
RexLiteral literal = (RexLiteral) node;
assertThat(literal.getValue() instanceof Calendar, is(true));
assertThat(literal.getValue2() instanceof Long, is(true));
assertThat(literal.getValue3() instanceof Long, is(true));
assertThat((Long) literal.getValue2(), is(MOON));
assertThat(literal.getValueAs(Calendar.class), notNullValue());
assertThat(literal.getValueAs(TimestampString.class), notNullValue());
}
代码示例来源:origin: org.apache.calcite/calcite-core
private void checkDate(RexNode node) {
assertThat(node.toString(), is("1969-07-21"));
RexLiteral literal = (RexLiteral) node;
assertThat(literal.getValue() instanceof Calendar, is(true));
assertThat(literal.getValue2() instanceof Integer, is(true));
assertThat(literal.getValue3() instanceof Integer, is(true));
assertThat((Integer) literal.getValue2(), is(MOON_DAY));
assertThat(literal.getValueAs(Calendar.class), notNullValue());
assertThat(literal.getValueAs(DateString.class), notNullValue());
}
代码示例来源:origin: Qihoo360/Quicksql
private void checkTime(RexNode node) {
assertThat(node.toString(), is("02:56:15"));
RexLiteral literal = (RexLiteral) node;
assertThat(literal.getValue() instanceof Calendar, is(true));
assertThat(literal.getValue2() instanceof Integer, is(true));
assertThat(literal.getValue3() instanceof Integer, is(true));
assertThat((Integer) literal.getValue2(), is(MOON_TIME));
assertThat(literal.getValueAs(Calendar.class), notNullValue());
assertThat(literal.getValueAs(TimeString.class), notNullValue());
}
代码示例来源:origin: Qihoo360/Quicksql
private void checkDate(RexNode node) {
assertThat(node.toString(), is("1969-07-21"));
RexLiteral literal = (RexLiteral) node;
assertThat(literal.getValue() instanceof Calendar, is(true));
assertThat(literal.getValue2() instanceof Integer, is(true));
assertThat(literal.getValue3() instanceof Integer, is(true));
assertThat((Integer) literal.getValue2(), is(MOON_DAY));
assertThat(literal.getValueAs(Calendar.class), notNullValue());
assertThat(literal.getValueAs(DateString.class), notNullValue());
}
代码示例来源:origin: org.apache.calcite/calcite-core
private void checkTime(RexNode node) {
assertThat(node.toString(), is("02:56:15"));
RexLiteral literal = (RexLiteral) node;
assertThat(literal.getValue() instanceof Calendar, is(true));
assertThat(literal.getValue2() instanceof Integer, is(true));
assertThat(literal.getValue3() instanceof Integer, is(true));
assertThat((Integer) literal.getValue2(), is(MOON_TIME));
assertThat(literal.getValueAs(Calendar.class), notNullValue());
assertThat(literal.getValueAs(TimeString.class), notNullValue());
}
代码示例来源:origin: Qihoo360/Quicksql
private void checkTimestamp(RexNode node) {
assertThat(node.toString(), is("1969-07-21 02:56:15"));
RexLiteral literal = (RexLiteral) node;
assertThat(literal.getValue() instanceof Calendar, is(true));
assertThat(literal.getValue2() instanceof Long, is(true));
assertThat(literal.getValue3() instanceof Long, is(true));
assertThat((Long) literal.getValue2(), is(MOON));
assertThat(literal.getValueAs(Calendar.class), notNullValue());
assertThat(literal.getValueAs(TimestampString.class), notNullValue());
}
代码示例来源:origin: Qihoo360/Quicksql
/** Test case for
* <a href="https://issues.apache.org/jira/browse/CALCITE-2306">[CALCITE-2306]
* AssertionError in {@link RexLiteral#getValue3} with null literal of type
* DECIMAL</a>. */
@Test public void testDecimalLiteral() {
final RelDataTypeFactory typeFactory =
new SqlTypeFactoryImpl(RelDataTypeSystem.DEFAULT);
final RelDataType type = typeFactory.createSqlType(SqlTypeName.DECIMAL);
final RexBuilder builder = new RexBuilder(typeFactory);
final RexLiteral literal = builder.makeExactLiteral(null, type);
assertThat(literal.getValue3(), nullValue());
}
代码示例来源:origin: Qihoo360/Quicksql
if (((RexLiteral) rexNode).getValue3() instanceof BigDecimal) {
return new JsonConstant("",
((BigDecimal) ((RexLiteral) rexNode).getValue3()).doubleValue());
代码示例来源:origin: org.apache.calcite/calcite-core
/** Test case for
* <a href="https://issues.apache.org/jira/browse/CALCITE-2306">[CALCITE-2306]
* AssertionError in {@link RexLiteral#getValue3} with null literal of type
* DECIMAL</a>. */
@Test public void testDecimalLiteral() {
final RelDataTypeFactory typeFactory =
new SqlTypeFactoryImpl(RelDataTypeSystem.DEFAULT);
final RelDataType type = typeFactory.createSqlType(SqlTypeName.DECIMAL);
final RexBuilder builder = new RexBuilder(typeFactory);
final RexLiteral literal = builder.makeExactLiteral(null, type);
assertThat(literal.getValue3(), nullValue());
}
代码示例来源:origin: dremio/dremio-oss
rangeQueryInput = new RangeQueryInput(((NlsString) literal.getValue()).getValue(), filter.getKind());
} else {
rangeQueryInput = new RangeQueryInput((literal.getValue3().toString()), filter.getKind());
内容来源于网络,如有侵权,请联系作者删除!