zhangbutao commented on code in PR #4981: URL: https://github.com/apache/hive/pull/4981#discussion_r1452429522
########## ql/src/test/queries/clientpositive/ptf_register_use_2.q: ########## @@ -0,0 +1,2 @@ +-- session 2: use function Review Comment: Looks like your qtest depends on the two different session. I am not sure if it is a good way to create two qtest to achieve this, then this needs the two qtests must be ordered, that is to say `ptf_register_use_1.q` must be in front of `ptf_register_use_2.q`. But i think the qtests framework may not work as you expected sometimes, and will lead your test flaky. I may suggest you adding the create function in https://github.com/apache/hive/blob/master/data/files/datasets/temp_udf/load.hive.sql (Like [HIVE-23558](https://github.com/apache/hive/pull/4928/files#top)), and add `--! qt:dataset:temp_udf` in another qtest to invoke this funtion. This can aslo create two seesions and can reproduce your issue. cc @ayushtkn may give some thought. ########## ql/src/test/queries/clientpositive/ptf_register_use_2.q: ########## @@ -0,0 +1,2 @@ +-- session 2: use function +select ptf_register_use_func() over(); Review Comment: before the query, you need add its explain test `explain select ptf_register_use_func() over();` ########## ql/src/java/org/apache/hadoop/hive/ql/exec/Registry.java: ########## @@ -385,7 +385,9 @@ public WindowFunctionInfo getWindowFunctionInfo(String functionName) throws Sema // First try without qualifiers - would resolve builtin/temp functions FunctionInfo info = getFunctionInfo(WINDOW_FUNC_PREFIX + functionName); // Try qualifying with current db name for permanent functions - if (info == null) { + if (info == null + // and try register function to session + && FunctionRegistry.getFunctionInfo(functionName) != null) { Review Comment: Suggested to change ``` // Try qualifying with current db name for permanent functions and registering functions to session if (info == null && FunctionRegistry.getFunctionInfo(functionName) != null) { ``` -- 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]
