You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "gengliangwang (via GitHub)" <gi...@apache.org> on 2023/06/02 07:10:29 UTC
[GitHub] [spark] gengliangwang commented on a diff in pull request #41191: [SPARK-43529][SQL] Support general constant expressions as CREATE/REPLACE TABLE OPTIONS values
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org