panbingkun commented on code in PR #37588:
URL: https://github.com/apache/spark/pull/37588#discussion_r1376969387


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/errors/QueryCompilationErrors.scala:
##########
@@ -2483,7 +2477,7 @@ private[sql] object QueryCompilationErrors extends 
QueryErrorsBase with Compilat
       messageParameters = Map(
         "specKeys" -> specKeys,
         "partitionColumnNames" -> partitionColumnNames.mkString(", "),
-        "tableName" -> tableName))
+        "tableName" -> toSQLId(tableName)))

Review Comment:
   If this is not modified, the following issues will occur
   
   - When executes UT 
`org.apache.spark.sql.execution.command.v1.ShowTablesSuite.show table extended 
in multi partition key - the command's partition parameters are incomplete`, 
its error message is:
      ```
      org.apache.spark.sql.AnalysisException: Partition spec is invalid. The 
spec (id1) must match the partition spec (id1, id2) defined in table 
'`spark_catalog`.`ns1`.`tbl`'.
      ```
   
https://github.com/apache/spark/blob/efa891c4ea869a7fac58eabf187ac8aeff1fcd38/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/catalog/SessionCatalog.scala#L1343-L1346
   
   - When executes 
`org.apache.spark.sql.execution.command.v2.ShowTablesSuite.show table extended 
in multi partition key - the command's partition parameters are incomplete`, 
its error message is:
      ```
      org.apache.spark.sql.AnalysisException: Partition spec is invalid. The 
spec (id1) must match the partition spec (id1, id2) defined in table 
'test_catalog.ns1.tbl'.
      ```
   
https://github.com/apache/spark/blob/efa891c4ea869a7fac58eabf187ac8aeff1fcd38/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/ResolvePartitionSpec.scala#L66
   
   
   
   The reason is that there are two entrances to calling the method 
`PartitioningUtils.requireExactMatchedPartitionSpec`, 
   <img width="466" alt="image" 
src="https://github.com/apache/spark/assets/15246973/41e3ecaa-d699-4b43-92da-53568dae3b10";>
   
   and the format of the parameter `tableName: String` inside is not 
consistent, so it has been unified here. In this way, we can put this UT into 
`show table extended in multi partition key - the command's partition 
parameters are incomplete` to maintain consistency.
   



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