Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-28662

Create Hive Partitioned Table without specifying data type for partition columns will success unexpectedly

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 3.0.0
    • 3.0.0
    • SQL
    • None

    Description

      Case :
      Create Hive Partitioned Table without specifying data type for partition column will success unexpectly.

      // create a hive table partition by b, but the data type of b isn't specified.
      CREATE TABLE tbl(a int) PARTITIONED BY (b) STORED AS parquet
      

       

      Root Cause:

      In https://issues.apache.org/jira/browse/SPARK-26435 ,  PARTITIONED BY clause  are extended to support Hive CTAS as following:

      // Before
      (PARTITIONED BY '(' partitionColumns=colTypeList ')’
      
      //After
      (PARTITIONED BY '(' partitionColumns=colTypeList ‘)’|
      PARTITIONED BY partitionColumnNames=identifierList) |
      
      

      Create Table Statement like above case will pass the syntax check,  and recognized as (PARTITIONED BY partitionColumnNames=identifierList) 。

      We should check this case in visitCreateHiveTable and give a explicit error message to user

       

      Attachments

        Issue Links

          Activity

            People

              lidinghao Li Hao
              lidinghao Li Hao
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: