KurtYoung commented on a change in pull request #10105: [Flink-14599][table-planner-blink] Support precision of TimestampType in blink planner URL: https://github.com/apache/flink/pull/10105#discussion_r344430931
########## File path: flink-table/flink-table-planner-blink/src/main/java/org/apache/flink/table/planner/expressions/converter/ExpressionConverter.java ########## @@ -135,8 +138,26 @@ public RexNode visit(ValueLiteralExpression valueLiteral) { return relBuilder.getRexBuilder().makeTimeLiteral(TimeString.fromCalendarFields( valueAsCalendar(extractValue(valueLiteral, java.sql.Time.class))), 0); case TIMESTAMP_WITHOUT_TIME_ZONE: - return relBuilder.getRexBuilder().makeTimestampLiteral(TimestampString.fromCalendarFields( - valueAsCalendar(extractValue(valueLiteral, java.sql.Timestamp.class))), 3); + TimestampType timestampType = (TimestampType) type; + Class<?> clazz = valueLiteral.getOutputDataType().getConversionClass(); + LocalDateTime datetime = null; + if (clazz == LocalDateTime.class) { + datetime = valueLiteral.getValueAs(LocalDateTime.class) + .orElseThrow(() -> new TableException("Invalid literal.")); + } else if (clazz == Timestamp.class) { + datetime = valueLiteral.getValueAs(Timestamp.class) + .orElseThrow(() -> new TableException("Invalid literal.")).toLocalDateTime(); + } else { + throw new TableException("Invalid literal."); Review comment: record the illegal class here? ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services