juliuszsompolski commented on code in PR #54126:
URL: https://github.com/apache/spark/pull/54126#discussion_r2768765889
##########
sql/catalyst/src/main/java/org/apache/spark/sql/connector/catalog/Column.java:
##########
@@ -67,13 +67,39 @@ static Column create(
null, null, metadataInJSON);
}
+ /**
+ * Creates a column with a generation expression in SQL string form.
+ *
+ * @since 4.1.0
+ * @deprecated Use
+ * {@link #create(String, DataType, boolean, String, GenerationExpression,
String)} instead.
+ */
+ @Deprecated
static Column create(
String name,
DataType dataType,
boolean nullable,
String comment,
String generationExpression,
String metadataInJSON) {
+ GenerationExpression genExpr = generationExpression != null
+ ? new GenerationExpression(generationExpression) : null;
+ return new ColumnImpl(name, dataType, nullable, comment, null,
+ genExpr, null, metadataInJSON);
+ }
+
+ /**
+ * Creates a column with a generation expression object.
+ *
+ * @since 4.1.0
Review Comment:
nit: 4.2.0 I presume?
##########
sql/catalyst/src/main/java/org/apache/spark/sql/connector/catalog/GenerationExpression.java:
##########
@@ -0,0 +1,97 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.spark.sql.connector.catalog;
+
+import java.util.Map;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+import org.apache.spark.SparkIllegalArgumentException;
+import org.apache.spark.annotation.Evolving;
+import org.apache.spark.sql.connector.expressions.Expression;
+
+/**
+ * A class that represents generation expressions for computed/generated
columns.
+ * <p>
+ * Connectors can define generation expressions using either a SQL string
(Spark SQL dialect) or an
Review Comment:
How do the connectors define if they use Spark SQL or ANSI Spark SQL?
When creating a view in Spark, the view definition retains the ANSI mode ans
session time zone from the time of the view creation (captured by
`CapturesConfig` trait and applied via `View.effectiveSQLConf()`), and not ANSI
mode set in Spark at the time of using the view. I suppose that V2 Expressions
stored as generation expressions (or similar use cases) should behave the same.
--
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]