zabetak commented on code in PR #4675: URL: https://github.com/apache/hive/pull/4675#discussion_r1324468315
########## ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFDateFormat.java: ########## @@ -75,19 +72,11 @@ public ObjectInspector initialize(ObjectInspector[] arguments) throws UDFArgumen obtainTimestampConverter(arguments, 0, tsInputTypes, tsConverters); + HiveConf conf = SessionState.get() == null ? new HiveConf() : SessionState.get().getConf(); Review Comment: The semantics of the two statements are slightly different when there is no active session (i.e., outside HS2, during runtime). #### Option A ``` HiveConf conf = SessionState.get() == null ? new HiveConf() : SessionState.get().getConf(); ``` A new conf will be created and then it will be thrown away. #### Option B ``` HiveConf conf = SessionState.getSessionConf(); ``` A new conf will be created and and associated with the current thread. This means that subsequent calls to SessionState.getSessionConf() (from this or another UDF in the same thread) will reuse the same conf. If there is an active session both options will behave the same I guess. Option B is more readable and slightly more efficient so I adopted your proposal (https://github.com/apache/hive/pull/4675/commits/02919a497c0b2845277584006326dd82342ed4b4). -- 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: gitbox-unsubscr...@hive.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org For additional commands, e-mail: gitbox-h...@hive.apache.org