Skip to content

Conversation

@gatorsmile
Copy link
Member

What changes were proposed in this pull request?

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.

case Failure(e) =>
// the exception is an invocation exception. To get a meaningful message, we need the
// cause.
throw new AnalysisException(e.getCause.getMessage)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Above is the same fix in #12136.

@rxin
Copy link
Contributor

rxin commented Nov 14, 2016

Does this apply to all functions? If yes, I'd put a test in SQLQueryTestSuite

@SparkQA
Copy link

SparkQA commented Nov 14, 2016

Test build #68605 has finished for PR 15878 at commit a43acce.

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

@gatorsmile
Copy link
Member Author

Sure, let me do it.

@SparkQA
Copy link

SparkQA commented Nov 15, 2016

Test build #68636 has finished for PR 15878 at commit 918aa25.

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

@rxin
Copy link
Contributor

rxin commented Nov 15, 2016

Merging in master/branch-2.1. Thanks.

@rxin
Copy link
Contributor

rxin commented Nov 15, 2016

Can you submit a backport for branch-2.0?

asfgit pushed a commit that referenced this pull request Nov 15, 2016
…n Exception of Function Lookup

### What changes were proposed in this pull request?
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 #15878 from gatorsmile/functionNotFound.

(cherry picked from commit 86430cc)
Signed-off-by: Reynold Xin <rxin@databricks.com>
@asfgit asfgit closed this in 86430cc Nov 15, 2016
@gatorsmile
Copy link
Member Author

Sure, will do it. Thanks!

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.
uzadude pushed a commit to uzadude/spark that referenced this pull request Jan 27, 2017
…n Exception of Function Lookup

### What changes were proposed in this pull request?
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 apache#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 apache#15878 from gatorsmile/functionNotFound.
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