-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-21912][SQL] ORC/Parquet table should not create invalid column names #19124
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 2 commits
808dfe0
a738943
cd539fe
66aff54
aa78eaf
0bf3b43
79929e9
368b242
c70c03c
8ee87dd
c6e9ab6
46847f8
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 |
|---|---|---|
|
|
@@ -2000,4 +2000,15 @@ class SQLQuerySuite extends QueryTest with SQLTestUtils with TestHiveSingleton { | |
| assert(setOfPath.size() == pathSizeToDeleteOnExit) | ||
| } | ||
| } | ||
|
|
||
| test("SPARK-21912 Creating ORC datasource table should check invalid column names") { | ||
| withTable("orc1") { | ||
| Seq(" ", "?", ",", ";", "{", "}", "(", ")", "\n", "\t", "=").foreach { name => | ||
| val m = intercept[AnalysisException] { | ||
| sql(s"CREATE TABLE orc1 USING ORC AS SELECT 1 `column$name`") | ||
|
||
| }.getMessage | ||
| assert(m.contains(s"contains invalid character(s)")) | ||
| } | ||
| } | ||
| } | ||
| } | ||
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:
Attribute->ColumnThere 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.
Thank you for review. Sure.
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 agree with you that
columnis more accurate here. Previously, I borrowed this fromParquetSchemaConverterhttps://github.com/apache/spark/blob/master/sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/parquet/ParquetSchemaConverter.scala#L565-L572