zabetak opened a new pull request, #4932: URL: https://github.com/apache/hive/pull/4932
### What changes were proposed in this pull request? 1. Turn DATE_ADD, DATE_SUB, and FROM_UNIXTIME to regular SqlFunctions and pass the correct return type inference strategy. The operand type inference and type checker can remain null as they were before since they are not used currently in Hive. 2. Change the type family for FROM_UNIXTIME to reflect that the function returns a string (and not date or time). 3. Create and pass an appropriate operand checker for FROM_UNIXTIME (minor since it's not used at the moment). 4. Remove isDynamicFunction override from TO_UNIX_TIMESTAMP (which is wrong), to enable constant reduction. ### Why are the changes needed? Constant reduction does not work because the functions are declared as dynamic (isDynamicFunction returns true). However, the dynamic declaration is wrong cause none of the above depends on context variables; they all operate on concrete parameters and require one or more inputs. Moreover, DATE_ADD, DATE_SUB, and FROM_UNIXTIME are not time functions, so it is wrong to extend the SqlAbsctractTimeFunction class. The overrides in SqlAbsctractTimeFunction are not correct/relevant to these functions so the changes here address this as well. ### Does this PR introduce _any_ user-facing change? Simpler and more efficient query plans. ### Is the change a dependency upgrade? No ### How was this patch tested? ``` mvn test -Dtest=TestMiniLlapLocalCliDriver -Dqfile=cbo_constantfolding.q -Dtest.output.overwrite ``` -- 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]
