rajkrrsingh commented on a change in pull request #1460:
URL: https://github.com/apache/hive/pull/1460#discussion_r490607794



##########
File path: 
ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFFromUnixTime.java
##########
@@ -107,6 +107,10 @@ public ObjectInspector initialize(ObjectInspector[] 
arguments) throws UDFArgumen
     }
 
     if (timeZone == null) {
+      if (SessionState.get() == null) {
+        SessionState ss = new SessionState(new HiveConf());
+        SessionState.setCurrentSessionState(ss);

Review comment:
       * sorry I did not follow this correctly, I think SessionState will not 
be available in HMS, can you please guide me how can I retrieve it from new 
HiveConf(), do  you want me do something like new HiveConf().getLocalTimeZone() 
?
   * yes that's a rare case while filtering the partition by expression, a 
query with filter condition having timestamp/date as predicate e.g. following 
query
   select * from table_name where hour between 
from_unixtime(unix_timestamp('2020090120', 'yyyyMMddHH') - 1*60*60, 
'yyyyMMddHH') and from_unixtime(unix_timestamp('2020090122', 'yyyyMMddHH') + 
2*60*60, 'yyyyMMddHH');
   
   in case of  PartitionExpressionForMetastore proxy, the filter expression is 
based on ql class/package and thats where user will see such exception.
   
   * I think its difficult to reproduce with embedded HMS.




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



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

Reply via email to