-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-14481] [SQL] Issue Exceptions for All Unsupported Options during Parsing #12255
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
Changes from all commits
8abcb71
b1774f0
12d9167
bb8d78b
e98a5d3
2440869
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -162,14 +162,16 @@ class HiveSqlAstBuilder extends SparkSqlAstBuilder { | |
|
|
||
| // Unsupported clauses. | ||
| if (temp) { | ||
| logWarning("TEMPORARY clause is ignored.") | ||
| throw new ParseException(s"Unsupported operation: TEMPORARY clause.", ctx) | ||
| } | ||
| if (ctx.bucketSpec != null) { | ||
| // TODO add this - we need cluster columns in the CatalogTable for this to work. | ||
| logWarning("CLUSTERED BY ... [ORDERED BY ...] INTO ... BUCKETS clause is ignored.") | ||
| throw new ParseException("Unsupported operation: " + | ||
| "CLUSTERED BY ... [ORDERED BY ...] INTO ... BUCKETS clause.", ctx) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just a note, we will support it and temporary keyword with the implementation of create table command.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see. Thank you for letting me know it.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I need to double check if insert into hive command can actually understand these fields, if not, we should not support cluster by and order by for now. |
||
| } | ||
| if (ctx.skewSpec != null) { | ||
| logWarning("SKEWED BY ... ON ... [STORED AS DIRECTORIES] clause is ignored.") | ||
| throw new ParseException("Operation not allowed: " + | ||
| "SKEWED BY ... ON ... [STORED AS DIRECTORIES] clause.", ctx) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For this one, how about we say it is not allowed.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, sure, will do |
||
| } | ||
|
|
||
| // Create the schema. | ||
|
|
@@ -230,7 +232,7 @@ class HiveSqlAstBuilder extends SparkSqlAstBuilder { | |
| throw new ParseException(s"Operation not allowed: partitioned views", ctx) | ||
| } else { | ||
| if (ctx.STRING != null) { | ||
| logWarning("COMMENT clause is ignored.") | ||
| throw new ParseException("Unsupported operation: COMMENT clause", ctx) | ||
| } | ||
| val identifiers = Option(ctx.identifierCommentList).toSeq.flatMap(_.identifierComment.asScala) | ||
| val schema = identifiers.map { ic => | ||
|
|
@@ -296,7 +298,8 @@ class HiveSqlAstBuilder extends SparkSqlAstBuilder { | |
| recordReader: Token, | ||
| schemaLess: Boolean): HiveScriptIOSchema = { | ||
| if (recordWriter != null || recordReader != null) { | ||
| logWarning("Used defined record reader/writer classes are currently ignored.") | ||
| throw new ParseException( | ||
| "Unsupported operation: Used defined record reader/writer classes.", ctx) | ||
| } | ||
|
|
||
| // Decode and input/output format. | ||
|
|
@@ -370,7 +373,8 @@ class HiveSqlAstBuilder extends SparkSqlAstBuilder { | |
| ctx: TableFileFormatContext): CatalogStorageFormat = withOrigin(ctx) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is InputDriver/OutputDriver?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. https://issues.apache.org/jira/browse/HIVE-1546 I checked the discussion. Based on what Carl Steinbach and Ashutosh Chauhan said,
I also searched the code base of hive master and confirm they are not used, but the Hive parser accept them. Not sure if we should completely delete them from our Spark Parser? or keep issuing the exceptions. Thanks!
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I will also change it to |
||
| import ctx._ | ||
| if (inDriver != null || outDriver != null) { | ||
| logWarning("INPUTDRIVER ... OUTPUTDRIVER ... clauses are ignored.") | ||
| throw new ParseException( | ||
| s"Operation not allowed: INPUTDRIVER ... OUTPUTDRIVER ... clauses", ctx) | ||
| } | ||
| EmptyStorageFormat.copy( | ||
| inputFormat = Option(string(inFmt)), | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -26,7 +26,7 @@ class HiveCommandSuite extends QueryTest with SQLTestUtils with TestHiveSingleto | |
| super.beforeAll() | ||
| sql( | ||
| """ | ||
| |CREATE EXTERNAL TABLE parquet_tab1 (c1 INT, c2 STRING) | ||
| |CREATE TABLE parquet_tab1 (c1 INT, c2 STRING) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need to change this?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. https://github.com/apache/spark/pull/12255/files#diff-1bb4f7bd5a2656f48bcd3c857167a11bR206
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oh, right. I did not notice the USING part. |
||
| |USING org.apache.spark.sql.parquet.DefaultSource | ||
| """.stripMargin) | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1475,7 +1475,6 @@ class SQLQuerySuite extends QueryTest with SQLTestUtils with TestHiveSingleton { | |
| sql( | ||
| """CREATE VIEW IF NOT EXISTS | ||
| |default.testView (c1 COMMENT 'blabla', c2 COMMENT 'blabla') | ||
| |COMMENT 'blabla' | ||
| |TBLPROPERTIES ('a' = 'b') | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need to change this?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, before we just output a comment when users specify That is why I removed it. Otherwise, we are unable to create this view.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you create a jira for supporting that?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure, will do it. Thanks!
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Create a PR: #12288 for this missing support. Thanks! |
||
| |AS SELECT * FROM jt""".stripMargin) | ||
| checkAnswer(sql("SELECT c1, c2 FROM testView ORDER BY c1"), (1 to 9).map(i => Row(i, i))) | ||
|
|
||
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.
Should we ignore it? In this case, we are creating data source tables. They should be
EXTERNAL? right?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.
better to throw exception
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.
Not really. That depends if they provide the location (see https://github.com/apache/spark/blob/master/sql/hive/src/main/scala/org/apache/spark/sql/hive/execution/commands.scala#L141-L149).
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 see. Then, we should check the values in
Optionto determine if users should specifyEXTERNAL? If it does not match, we should issue an exception?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.
https://github.com/apache/spark/blob/master/sql/hive/src/main/scala/org/apache/spark/sql/hive/execution/commands.scala#L141-L149 already takes care it for data source tables, right? At here, we can still just throw the exception for now because 1.6 does not support
CREATE EXTERNAL TABLE ... USING.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.
Ok, I see. Thanks!
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.
Just feel free to let me know if anything is missing in this PR. Thanks!