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


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/AstBuilder.scala:
##########
@@ -4055,19 +4055,28 @@ class AstBuilder extends DataTypeAstBuilder with 
SQLConfHelper with Logging {
   }
 
   /**
-   * Create a [[ShowTableExtended]] command.
+   * Create a [[ShowTablesExtended]] or [[ShowTablePartition]] command.
    */
   override def visitShowTableExtended(
       ctx: ShowTableExtendedContext): LogicalPlan = withOrigin(ctx) {
-    val partitionKeys = Option(ctx.partitionSpec).map { specCtx =>
-      UnresolvedPartitionSpec(visitNonOptionalPartitionSpec(specCtx), None)
+    def createUnresolvedTable(

Review Comment:
   It seems difficult to reuse because
   - In existing functions `createUnresolvedTable `, `ctx: 
IdentifierReferenceContext,` represents `namespace. tablename`, it is a 
complete name.
   
https://github.com/apache/spark/blob/e499ba80be6828dcf0c34d3f06f1cd12321ce5b8/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/AstBuilder.scala#L2828-L2833
   
   - But in our scenario, `nsCtx: IdentifierReferenceContext` represents 
namespace, and `patternCtx: StringLitContext represents` tablename.
   <img width="809" alt="image" 
src="https://github.com/apache/spark/assets/15246973/c957c28f-b9ba-4714-971c-ced3e069bd13";>
   If we wang to reuse it, we must use `nsCtx + patternCtx` to construct an 
`IdentifierReferenceContext`.



##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/v2Commands.scala:
##########
@@ -884,19 +884,39 @@ object ShowTables {
 }
 
 /**
- * The logical plan of the SHOW TABLE EXTENDED command.
+ * The logical plan of the SHOW TABLE EXTENDED (without PARTITION) command.
  */
-case class ShowTableExtended(
+case class ShowTablesExtended(
     namespace: LogicalPlan,
     pattern: String,
-    partitionSpec: Option[PartitionSpec],
-    override val output: Seq[Attribute] = ShowTableExtended.getOutputAttrs) 
extends UnaryCommand {
+    override val output: Seq[Attribute] = ShowTablesExtended.getOutputAttrs)
+  extends UnaryCommand {
   override def child: LogicalPlan = namespace
-  override protected def withNewChildInternal(newChild: LogicalPlan): 
ShowTableExtended =
+  override protected def withNewChildInternal(newChild: LogicalPlan): 
ShowTablesExtended =
     copy(namespace = newChild)
 }
 
-object ShowTableExtended {
+object ShowTablesExtended {

Review Comment:
   Done



-- 
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: reviews-unsubscr...@spark.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to