peter-toth opened a new pull request, #37982:
URL: https://github.com/apache/spark/pull/37982

   ### What changes were proposed in this pull request?
   When converting a native table metadata representation `CatalogTable` to 
`HiveTable` make sure bucket spec uses an existing column.
   
   ### Does this PR introduce _any_ user-facing change?
   Hive metastore seems to be not case preserving with columns but case 
preserving with bucket spec, which means the following table creation:
   ```
     CREATE TABLE t(
       c STRING,
       B_C STRING
     )
     PARTITIONED BY (p_c STRING)
     CLUSTERED BY (B_C) INTO 4 BUCKETS
     STORED AS PARQUET
   ```
   followed by a query:
   ```
     SELECT * FROM t
   ```
   fails with:
   ```
   Caused by: org.apache.hadoop.hive.ql.metadata.HiveException: Bucket columns 
B_C is not part of the table columns ([FieldSchema(name:c, type:string, 
comment:null), FieldSchema(name:b_c, type:string, comment:null)]
   ```
   
   ### Why are the changes needed?
   Bug fix.
   
   ### How was this patch tested?
   Added new UT.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to