use of org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.sql.SqlIntervalQualifier in project hive by apache.
the class RexNodeExprFactory method createIntervalDayTimeConstantExpr.
/**
* {@inheritDoc}
*/
@Override
protected RexLiteral createIntervalDayTimeConstantExpr(String value) {
HiveIntervalDayTime v = HiveIntervalDayTime.valueOf(value);
BigDecimal secsValueBd = BigDecimal.valueOf(v.getTotalSeconds() * 1000);
BigDecimal nanosValueBd = BigDecimal.valueOf((v).getNanos(), 6);
return rexBuilder.makeIntervalLiteral(secsValueBd.add(nanosValueBd), new SqlIntervalQualifier(TimeUnit.MILLISECOND, null, new SqlParserPos(1, 1)));
}
use of org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.sql.SqlIntervalQualifier in project hive by apache.
the class RexNodeExprFactory method createIntervalSecondConstantExpr.
/**
* {@inheritDoc}
*/
@Override
protected RexLiteral createIntervalSecondConstantExpr(String value) {
BigDecimal bd = new BigDecimal(value);
BigDecimal bdSeconds = new BigDecimal(bd.toBigInteger());
BigDecimal bdNanos = bd.subtract(bdSeconds);
HiveIntervalDayTime v = new HiveIntervalDayTime(0, 0, 0, bdSeconds.intValueExact(), bdNanos.multiply(NANOS_PER_SEC_BD).intValue());
BigDecimal secsValueBd = BigDecimal.valueOf(v.getTotalSeconds() * 1000);
BigDecimal nanosValueBd = BigDecimal.valueOf((v).getNanos(), 6);
return rexBuilder.makeIntervalLiteral(secsValueBd.add(nanosValueBd), new SqlIntervalQualifier(TimeUnit.MILLISECOND, null, new SqlParserPos(1, 1)));
}
Aggregations