Github user dongjoon-hyun commented on a diff in the pull request:

    https://github.com/apache/spark/pull/19124#discussion_r136921664
  
    --- 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 --
    
    @gatorsmile . I tried the following. We can add a check for 
`ParquetFileFormat`, but not for `OrcFileFormat`. Should I change the PR title 
and scope instead?
    
    ```scala
        table.provider.get.toLowerCase match {
          case "parquet" =>
            dataSource.schema.map(_.name).foreach(
              
org.apache.spark.sql.execution.datasources.parquet.ParquetSchemaConverter.checkFieldName)
          case "orc" =>
            dataSource.schema.map(_.name).foreach(
              org.apache.spark.sql.hive.OrcRelation.checkFieldName)
        }
    ```


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to