apilloud commented on a change in pull request #13930:
URL: https://github.com/apache/beam/pull/13930#discussion_r610051846



##########
File path: 
sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/impl/rel/BeamCalcRel.java
##########
@@ -375,7 +374,7 @@ private static Expression castOutputTime(Expression value, 
FieldType toType) {
       // Convert TIME to LocalTime
       if (value.getType() == java.sql.Time.class) {
         valueDateTime = Expressions.call(BuiltInMethod.TIME_TO_INT.method, 
valueDateTime);
-      } else if (value.getType() == Long.class) {
+      } else if (value.getType() == Integer.class || value.getType() == 
Long.class) {

Review comment:
       The internal type is actually suppose to be int. We've been passing 
Calcite a Long instead and the compiler just happily upconverts when doing math 
between the two types. We are still doing math somewhere (window functions?) 
that turns this into a Long sometimes. I think even before this change we were 
at risk of receiving a Integer here. (In the next CL I'm switching this to the 
java Number interface so we are permissive on outputs.)
   
https://github.com/apache/calcite-avatica/blob/89e0deb510311b85b8c8bacde6d2ff70c309930e/core/src/main/java/org/apache/calcite/avatica/SqlType.java#L306




-- 
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:
[email protected]


Reply via email to