Skip to content
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

[SPARK-20492][SQL] Do not print empty parentheses for invalid primitive types in parser #17784

Closed
wants to merge 2 commits into from

Conversation

HyukjinKwon
Copy link
Member

What changes were proposed in this pull request?

Currently, when the type string is invalid, it looks printing empty parentheses. This PR proposes a small improvement in an error message by removing it in the parse as below:

spark.range(1).select($"col".cast("aa"))

Before

org.apache.spark.sql.catalyst.parser.ParseException:
DataType aa() is not supported.(line 1, pos 0)

== SQL ==
aa
^^^

After

org.apache.spark.sql.catalyst.parser.ParseException:
DataType aa is not supported.(line 1, pos 0)

== SQL ==
aa
^^^

How was this patch tested?

Unit tests in DataTypeParserSuite.

@HyukjinKwon
Copy link
Member Author

cc @hvanhovell, could you take a look please?

@hvanhovell
Copy link
Contributor

LGTM - pending jenkins

@SparkQA
Copy link

SparkQA commented Apr 27, 2017

Test build #76227 has finished for PR 17784 at commit 896bdaf.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Apr 27, 2017

Test build #76243 has finished for PR 17784 at commit 8101796.

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

@HyukjinKwon
Copy link
Member Author

@hvanhovell, could this get merged by any chance?

@hvanhovell
Copy link
Contributor

Yes, it can. Merging to master/2.2. Thanks!

asfgit pushed a commit that referenced this pull request Apr 30, 2017
…ve types in parser

## What changes were proposed in this pull request?

Currently, when the type string is invalid, it looks printing empty parentheses. This PR proposes a small improvement in an error message by removing it in the parse as below:

```scala
spark.range(1).select($"col".cast("aa"))
```

**Before**

```
org.apache.spark.sql.catalyst.parser.ParseException:
DataType aa() is not supported.(line 1, pos 0)

== SQL ==
aa
^^^
```

**After**

```
org.apache.spark.sql.catalyst.parser.ParseException:
DataType aa is not supported.(line 1, pos 0)

== SQL ==
aa
^^^
```

## How was this patch tested?

Unit tests in `DataTypeParserSuite`.

Author: hyukjinkwon <[email protected]>

Closes #17784 from HyukjinKwon/SPARK-20492.

(cherry picked from commit 1ee494d)
Signed-off-by: Herman van Hovell <[email protected]>
@asfgit asfgit closed this in 1ee494d Apr 30, 2017
@HyukjinKwon HyukjinKwon deleted the SPARK-20492 branch January 2, 2018 03:38
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