-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-24544][SQL] Print actual failure cause when look up function failed #21790
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Test build #93167 has finished for PR 21790 at commit
|
|
retest this please |
|
sure, I'll check later. |
|
Test build #95330 has finished for PR 21790 at commit
|
|
retest this please |
|
@caneGuy Can you fix the title? |
|
Also, you need to add tests. |
sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveSessionCatalog.scala
Outdated
Show resolved
Hide resolved
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/NoSuchItemException.scala
Outdated
Show resolved
Hide resolved
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/NoSuchItemException.scala
Outdated
Show resolved
Hide resolved
|
Test build #95465 has finished for PR 21790 at commit
|
|
I will fix the test and add unit test as soon as possible @maropu |
|
Sorry to bother you @maropu .I tried to add some test case,but i found |
|
Test build #100310 has finished for PR 21790 at commit
|
|
I think we need tests for the changes this pr added. |
|
@maropu Thanks for your time.I add a test case in |
| s"a permanent function registered in the database '$db'.") | ||
| s"Undefined function: '$func'. This function is neither a registered temporary function nor " + | ||
| s"a permanent function registered in the database '$db'." + | ||
| s"${cause.map(th => s"Exception thrown during look up:" + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is too complex for string interpolation. But why not just set the exception's cause?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@srowen Thanks.IIUC.Since some times the cause may be undefined.For that case, we do not need to print Exception thrown during look up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean, why not set the cause on AnalysisException? the cause may be null if the Option is None, that's fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update @srowen Thanks!
|
Test build #100475 has finished for PR 21790 at commit
|
|
Test build #100524 has finished for PR 21790 at commit
|
|
Test build #100522 has finished for PR 21790 at commit
|
|
Test build #100529 has finished for PR 21790 at commit
|
| // built-in function. | ||
| // Hive is case insensitive. | ||
| val functionName = funcName.unquotedString.toLowerCase(Locale.ROOT) | ||
| logWarning(s"Encounter a failure during looking up function:" + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Encounter -> Encountered, and the first string doesn't need interpolation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @srowen Updated!
|
Test build #100558 has finished for PR 21790 at commit
|
|
|
||
| test("SPARK-24544: test print actual failure cause when look up function failed") { | ||
| withBasicCatalog { catalog => | ||
| intercept[NoSuchFunctionException] { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this test anything about the cause of the exception? maybe get the cause and assert about its message?
|
Test build #100600 has finished for PR 21790 at commit
|
|
Test build #100603 has finished for PR 21790 at commit
|
|
Test build #100604 has finished for PR 21790 at commit
|
|
Merged to master |
…ailed ## What changes were proposed in this pull request? When we operate as below: ` 0: jdbc:hive2://xxx/> create function funnel_analysis as 'com.xxx.hive.extend.udf.UapFunnelAnalysis'; ` ` 0: jdbc:hive2://xxx/> select funnel_analysis(1,",",1,''); Error: org.apache.spark.sql.AnalysisException: Undefined function: 'funnel_analysis'. This function is neither a registered temporary function nor a permanent function registered in the database 'xxx'.; line 1 pos 7 (state=,code=0) ` ` 0: jdbc:hive2://xxx/> describe function funnel_analysis; +-----------------------------------------------------------+--+ | function_desc | +-----------------------------------------------------------+--+ | Function: xxx.funnel_analysis | | Class: com.xxx.hive.extend.udf.UapFunnelAnalysis | | Usage: N/A. | +-----------------------------------------------------------+--+ ` We can see describe funtion will get right information,but when we actually use this funtion,we will get an undefined exception. Which is really misleading,the real cause is below: ` No handler for Hive UDF 'com.xxx.xxx.hive.extend.udf.UapFunnelAnalysis': java.lang.IllegalStateException: Should not be called directly; at org.apache.hadoop.hive.ql.udf.generic.GenericUDTF.initialize(GenericUDTF.java:72) at org.apache.spark.sql.hive.HiveGenericUDTF.outputInspector$lzycompute(hiveUDFs.scala:204) at org.apache.spark.sql.hive.HiveGenericUDTF.outputInspector(hiveUDFs.scala:204) at org.apache.spark.sql.hive.HiveGenericUDTF.elementSchema$lzycompute(hiveUDFs.scala:212) at org.apache.spark.sql.hive.HiveGenericUDTF.elementSchema(hiveUDFs.scala:212) ` This patch print the actual failure for quick debugging. ## How was this patch tested? UT Closes apache#21790 from caneGuy/zhoukang/print-warning1. Authored-by: zhoukang <[email protected]> Signed-off-by: Sean Owen <[email protected]>
|
Hi, All. |
|
OK, if it's pretty common after all, this can be reverted, thank you |
…n look up function failed` ### What changes were proposed in this pull request? This reverts #21790 because it's no longer needed. It kept the original error from Hive when Spark loads builtin functions from Hive, which no longer happens as Spark has implemented all builtin functions natively. ### Why are the changes needed? code cleanup ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? existing tests Closes #37896 from cloud-fan/error. Lead-authored-by: Wenchen Fan <[email protected]> Co-authored-by: Wenchen Fan <[email protected]> Signed-off-by: Wenchen Fan <[email protected]>
…n look up function failed` ### What changes were proposed in this pull request? This reverts apache#21790 because it's no longer needed. It kept the original error from Hive when Spark loads builtin functions from Hive, which no longer happens as Spark has implemented all builtin functions natively. ### Why are the changes needed? code cleanup ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? existing tests Closes apache#37896 from cloud-fan/error. Lead-authored-by: Wenchen Fan <[email protected]> Co-authored-by: Wenchen Fan <[email protected]> Signed-off-by: Wenchen Fan <[email protected]>
What changes were proposed in this pull request?
When we operate as below:
0: jdbc:hive2://xxx/> create function funnel_analysis as 'com.xxx.hive.extend.udf.UapFunnelAnalysis';0: jdbc:hive2://xxx/> select funnel_analysis(1,",",1,''); Error: org.apache.spark.sql.AnalysisException: Undefined function: 'funnel_analysis'. This function is neither a registered temporary function nor a permanent function registered in the database 'xxx'.; line 1 pos 7 (state=,code=0)0: jdbc:hive2://xxx/> describe function funnel_analysis; +-----------------------------------------------------------+--+ | function_desc | +-----------------------------------------------------------+--+ | Function: xxx.funnel_analysis | | Class: com.xxx.hive.extend.udf.UapFunnelAnalysis | | Usage: N/A. | +-----------------------------------------------------------+--+We can see describe funtion will get right information,but when we actually use this funtion,we will get an undefined exception.
Which is really misleading,the real cause is below:
No handler for Hive UDF 'com.xxx.xxx.hive.extend.udf.UapFunnelAnalysis': java.lang.IllegalStateException: Should not be called directly; at org.apache.hadoop.hive.ql.udf.generic.GenericUDTF.initialize(GenericUDTF.java:72) at org.apache.spark.sql.hive.HiveGenericUDTF.outputInspector$lzycompute(hiveUDFs.scala:204) at org.apache.spark.sql.hive.HiveGenericUDTF.outputInspector(hiveUDFs.scala:204) at org.apache.spark.sql.hive.HiveGenericUDTF.elementSchema$lzycompute(hiveUDFs.scala:212) at org.apache.spark.sql.hive.HiveGenericUDTF.elementSchema(hiveUDFs.scala:212)This patch print the actual failure for quick debugging.
How was this patch tested?
UT