zzwqqq commented on code in PR #4942:
URL: https://github.com/apache/calcite/pull/4942#discussion_r3292904997


##########
core/src/main/java/org/apache/calcite/rex/RexBuilder.java:
##########
@@ -969,54 +959,31 @@ public RexNode makeCast(
     return temporalLiteral;
   }
 
-  private static @Nullable String formatTemporalLiteral(RexLiteral literal) {
+  private @Nullable RexNode makeCastFromTemporalLiteralToCharacter(
+      RelDataType type,
+      RexLiteral literal) {
+    final String value;
     switch (literal.getType().getSqlTypeName()) {
     case TIME:
       final TimeString time = literal.getValueAs(TimeString.class);
-      return time == null || !hasSubMillisecondPrecision(time)
-          ? null
-          : time.toString(precision(literal.getType()));
+      if (time == null) {
+        return null;
+      }
+      value = time.toString(literal.getType().getPrecision());
+      break;
     case TIMESTAMP:
       final TimestampString timestamp = 
literal.getValueAs(TimestampString.class);
-      return timestamp == null || !hasSubMillisecondPrecision(timestamp)
-          ? null
-          : timestamp.toString(precision(literal.getType()));
+      if (timestamp == null || literal.getType().getPrecision() <= 3) {

Review Comment:
   that 3 was just the millisecond cutoff from the old version. Removed it and 
now format using the literal type's precision.



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to