Skip to content

Conversation

@gatorsmile
Copy link
Member

What changes were proposed in this pull request?

This PR is to backport #15878

When the exception is an invocation exception during function lookup, we return a useless/confusing error message:

For example,

df.selectExpr("concat_ws()")

Below is the error message we got:

null; line 1 pos 0
org.apache.spark.sql.AnalysisException: null; line 1 pos 0

To get the meaningful error message, we need to get the cause. The fix is exactly the same as what we did in #12136. After the fix, the message we got is the exception issued in the constuctor of function implementation:

requirement failed: concat_ws requires at least one argument.; line 1 pos 0
org.apache.spark.sql.AnalysisException: requirement failed: concat_ws requires at least one argument.; line 1 pos 0

How was this patch tested?

Added test cases.

@SparkQA
Copy link

SparkQA commented Nov 16, 2016

Test build #68704 has finished for PR 15902 at commit 4a42c13.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

asfgit pushed a commit that referenced this pull request Nov 16, 2016
…g an Invocation Exception of Function Lookup

### What changes were proposed in this pull request?
This PR is to backport #15878

When the exception is an invocation exception during function lookup, we return a useless/confusing error message:

For example,
```Scala
df.selectExpr("concat_ws()")
```
Below is the error message we got:
```
null; line 1 pos 0
org.apache.spark.sql.AnalysisException: null; line 1 pos 0
```

To get the meaningful error message, we need to get the cause. The fix is exactly the same as what we did in #12136. After the fix, the message we got is the exception issued in the constuctor of function implementation:
```
requirement failed: concat_ws requires at least one argument.; line 1 pos 0
org.apache.spark.sql.AnalysisException: requirement failed: concat_ws requires at least one argument.; line 1 pos 0
```

### How was this patch tested?
Added test cases.

Author: gatorsmile <gatorsmile@gmail.com>

Closes #15902 from gatorsmile/functionNotFound20.
@hvanhovell
Copy link
Contributor

LGTM - merging to branch-2.0. Can you close?

@gatorsmile
Copy link
Member Author

Thanks!

@gatorsmile gatorsmile closed this Nov 16, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants