gengliangwang commented on code in PR #41191:
URL: https://github.com/apache/spark/pull/41191#discussion_r1214006267


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/v2Commands.scala:
##########
@@ -1382,11 +1407,59 @@ case class DropIndex(
     copy(table = newChild)
 }
 
-case class TableSpec(
+trait TableSpec {
+  def properties: Map[String, String]
+  def provider: Option[String]
+  def location: Option[String]
+  def comment: Option[String]
+  def serde: Option[SerdeInfo]
+  def external: Boolean
+  def withNewLocation(newLocation: Option[String]): TableSpec
+  def treePatternBits: BitSet
+}
+
+case class UnresolvedTableSpec(
+    properties: Map[String, String],
+    provider: Option[String],
+    optionsExpressions: Map[String, Expression],

Review Comment:
   @dtenedor I got a new idea about this.
   How about we have a new expression for `optionsExpressions`
   ```
   case class UnresolvedTableOptions(options: Seq[(String, Expression)])
     extends Expression with Unevaluable {
     override def nullable: Boolean = true
   
     override def dataType: DataType = MapType[StringType, StringType]
   
     override def children: Seq[Expression] = optionsExpressions.map(_._2)
   
     override protected def withNewChildrenInternal(
       newChildren: IndexedSeq[Expression]): Expression = {
         assert(options.length == newChildren.length)
         ...
         }
     }
   }
   ```
   So that we don't need to handle the treePatternBits or hacking the method 
`mapExpressions`. 
   Note that here the Options is `Seq` instead of `Map` to make sure the 
expression order is fixed.



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