Github user dongjoon-hyun commented on a diff in the pull request:
https://github.com/apache/spark/pull/19124#discussion_r136918576
--- Diff:
sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/SQLQuerySuite.scala
---
@@ -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`")
--- End diff --
It seems to be the same situation with Parquet. `CREATE TABLE` passes but
`SELECT` raises exceptions.
```scala
scala> sql("CREATE TABLE parquet1(`a b` int) using parquet")
res1: org.apache.spark.sql.DataFrame = []
scala> sql("select * from parquet1").show
org.apache.spark.sql.AnalysisException: Attribute name "a b" contains
invalid character(s) among " ,;{}()\n\t=". Please use alias to rename it.;
```
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]