MaxGekk opened a new pull request #30627:
URL: https://github.com/apache/spark/pull/30627


   ### What changes were proposed in this pull request?
   Preprocess the partition spec passed to the V1 SHOW PARTITIONS 
implementation `ShowPartitionsCommand`, and normalize the passed spec according 
to the partition columns w.r.t the case sensitivity flag  
**spark.sql.caseSensitive**.
   
   ### Why are the changes needed?
   V1 SHOW PARTITIONS is case sensitive in fact, and doesn't respect the SQL 
config **spark.sql.caseSensitive** which is false by default, for instance:
   ```sql
   spark-sql> CREATE TABLE tbl1 (price int, qty int, year int, month int)
            > USING parquet
            > PARTITIONED BY (year, month);
   spark-sql> INSERT INTO tbl1 PARTITION(year = 2015, month = 1) SELECT 1, 1;
   spark-sql> SHOW PARTITIONS tbl1 PARTITION(YEAR = 2015, Month = 1);
   Error in query: Non-partitioning column(s) [YEAR, Month] are specified for 
SHOW PARTITIONS;
   ```
   The `SHOW PARTITIONS` command must show the partition `year = 2015, month = 
1` specified by `YEAR = 2015, Month = 1`.
   
   ### Does this PR introduce _any_ user-facing change?
   Yes. After the changes, the command above works as expected:
   ```sql
   spark-sql> SHOW PARTITIONS tbl1 PARTITION(YEAR = 2015, Month = 1);
   year=2015/month=1
   ```
   
   ### How was this patch tested?
   By running the affected test suites:
   ```
   $ build/sbt -Phive-2.3 -Phive-thriftserver "test:testOnly 
org.apache.spark.sql.hive.execution.HiveCatalogedDDLSuite"
   ```
   
   Authored-by: Max Gekk <[email protected]>
   Signed-off-by: Dongjoon Hyun <[email protected]>
   (cherry picked from commit 48297818f37a8e02cc02ba6fa9ec04fe37540aca)
   Signed-off-by: Max Gekk <[email protected]>


----------------------------------------------------------------
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.

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