diff --git a/sql/core/src/main/scala/org/apache/spark/sql/execution/command/tables.scala b/sql/core/src/main/scala/org/apache/spark/sql/execution/command/tables.scala index f740915b6d033..7b8216eb75755 100644 --- a/sql/core/src/main/scala/org/apache/spark/sql/execution/command/tables.scala +++ b/sql/core/src/main/scala/org/apache/spark/sql/execution/command/tables.scala @@ -658,7 +658,12 @@ case class DescribeTableCommand( throw QueryCompilationErrors.descPartitionNotAllowedOnView(table.identifier) } DDLUtils.verifyPartitionProviderIsHive(spark, metadata, "DESC PARTITION") - val partition = catalog.getPartition(table, partitionSpec) + val normalizedPartSpec = PartitioningUtils.normalizePartitionSpec( + partitionSpec, + metadata.partitionSchema, + table.quotedString, + spark.sessionState.conf.resolver) + val partition = catalog.getPartition(table, normalizedPartSpec) if (isExtended) describeFormattedDetailedPartitionInfo(table, metadata, partition, result) } diff --git a/sql/core/src/test/resources/sql-tests/inputs/describe.sql b/sql/core/src/test/resources/sql-tests/inputs/describe.sql index a0ee9322372ba..deff5bb7ca6fc 100644 --- a/sql/core/src/test/resources/sql-tests/inputs/describe.sql +++ b/sql/core/src/test/resources/sql-tests/inputs/describe.sql @@ -43,6 +43,8 @@ DESC EXTENDED t PARTITION (c='Us', d=1); DESC FORMATTED t PARTITION (c='Us', d=1); +DESC EXTENDED t PARTITION (C='Us', D=1); + -- NoSuchPartitionException: Partition not found in table DESC t PARTITION (c='Us', d=2); diff --git a/sql/core/src/test/resources/sql-tests/results/describe.sql.out b/sql/core/src/test/resources/sql-tests/results/describe.sql.out index 7634c112ab81a..8a2a59eb8f988 100644 --- a/sql/core/src/test/resources/sql-tests/results/describe.sql.out +++ b/sql/core/src/test/resources/sql-tests/results/describe.sql.out @@ -1,5 +1,5 @@ -- Automatically generated by SQLQueryTestSuite --- Number of queries: 41 +-- Number of queries: 42 -- !query @@ -324,6 +324,37 @@ Location [not included in comparison]/{warehouse_dir}/t Storage Properties [a=1, b=2] +-- !query +DESC EXTENDED t PARTITION (C='Us', D=1) +-- !query schema +struct +-- !query output +a string +b int +c string +d string +# Partition Information +# col_name data_type comment +c string +d string + +# Detailed Partition Information +Database default +Table t +Partition Values [c=Us, d=1] +Location [not included in comparison]/{warehouse_dir}/t/c=Us/d=1 +Storage Properties [a=1, b=2] +Created Time [not included in comparison] +Last Access [not included in comparison] + +# Storage Information +Num Buckets 2 +Bucket Columns [`a`] +Sort Columns [`b`] +Location [not included in comparison]/{warehouse_dir}/t +Storage Properties [a=1, b=2] + + -- !query DESC t PARTITION (c='Us', d=2) -- !query schema