szehon-ho commented on code in PR #60368:
URL: https://github.com/apache/spark/pull/60368#discussion_r4559026012
##########
sql/core/src/test/scala/org/apache/spark/sql/connector/GeneratedColumnWriteSuite.scala:
##########
@@ -347,6 +348,283 @@ class GeneratedColumnWriteSuite extends QueryTest with
DatasourceV2SQLBase {
}
}
+ gridTest("modeled generation expression auto-fill")(
+ Seq("insert", "insert overwrite", "append", "overwrite", "overwrite
partitions")) { mode =>
+ val tblName = "my_tab"
+ val genExpr = new GeneralScalarExpression("+", Array[V2Expression](
+ FieldReference(Seq("a.b")), FieldReference(Seq("s", "f"))))
+ val generation = new GenerationExpression(new V2Cast(genExpr, IntegerType,
LongType))
+ withTable(s"testcat.$tblName") {
+ catalog("testcat").asInstanceOf[InMemoryCatalog].createTable(
Review Comment:
Updated in 2befeffe91a. Added `createCatalogTable` using
`TableInfo.Builder`, with an optional properties argument, and replaced the
repeated deprecated catalog calls, including the capability-property case. All
160 generated-column tests pass.
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/StoredExpressionText.scala:
##########
@@ -38,9 +38,12 @@ object StoredExpressionText {
* also one that a function reads while it is built, such as
* `spark.sql.legacy.negativeIndexInArrayInsert`. With
* `spark.sql.legacy.useCurrentConfigsForGeneratedColumn`, these are the
settings of the session.
+ * Set `useCurrentConfigs` to false for modeled expressions, which always
use the fixed settings.
*/
- def conf(session: SQLConf): SQLConf = {
- if (session.useCurrentSQLConfigsForGeneratedColumn) {
+ def conf(session: SQLConf): SQLConf = conf(session, useCurrentConfigs = true)
+
+ private[sql] def conf(session: SQLConf, useCurrentConfigs: Boolean): SQLConf
= {
Review Comment:
Updated in 2befeffe91a. Removed the Boolean overload and extracted
`private[sql] fixedConf(session)`. `conf(session)` clones the session under the
legacy flag and otherwise calls `fixedConf`; modeled construction and strict
analysis call `fixedConf` directly.
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/V2ExpressionUtils.scala:
##########
@@ -407,9 +408,13 @@ object V2ExpressionUtils extends SQLConfHelper with
Logging {
case "RADIANS" => convertUnaryExpr(expr, ToRadians)
case "SIGN" => convertUnaryExpr(expr, Signum)
case "WIDTH_BUCKET" =>
Review Comment:
Changed in 2befeffe91a to `case "WIDTH_BUCKET" if expr.children.length == 4
=>`, matching the sibling arity guards and using the existing default `None`
case. Converter boundary tests pass.
--
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]