zabetak opened a new pull request, #4135:
URL: https://github.com/apache/hive/pull/4135

   ### What changes were proposed in this pull request?
   Change the implementation of unix_timestamp operators to avoid the 
AssertionError and infer the return type correctly; always BIGINT.
   
   Break the inheritance relation with SqlAbstractTimeFunction and change the 
SqlFunctionCategory from TIMEDATE to NUMERIC; unix_timestamp is not a time 
function since the result is never among DATE, TIME, or TIMESTAMP.
   
   Change the operand type checker to a more truthful implementation; the type 
checker is not really used at the moment but it is better to have something 
realistic there instead of null or something completely wrong.
   
   ### Why are the changes needed?
   Calls to `inferReturnType` method for `unix_timestamp` operators always lead 
to `AssertionError`.
   
   Contrary to operand type checking and operand type inference that are not 
really relevant for Hive (the latter is not using the `SqlValidator` logic), 
the return type inference is important since it may kick in some calls to 
`RelBuilder/RexBuilder` APIs. Such calls exist in older versions of Hive and 
are widely used in Calcite's built-in rules.
   
   ### Does this PR introduce _any_ user-facing change?
   In this version no, but in older versions of Hive it can fix queries failing 
with `AssertionError`.
   
   ### How was this patch tested?
   ```
   mvn test -Dtest=TestSqlOperatorInferReturnType
   ```


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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to