costas-db commented on code in PR #47428:
URL: https://github.com/apache/spark/pull/47428#discussion_r1704708106


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/internal/SQLConf.scala:
##########
@@ -977,6 +977,17 @@ object SQLConf {
       .booleanConf
       .createWithDefault(true)
 
+    val OPTIMIZE_INSERT_INTO_VALUES_PARSER =
+    buildConf("spark.sql.parser.optimizeInsertIntoValuesParser")
+      .internal()
+      .doc(
+        """
+          | Controls whether we optimize the ASTree that gets generated when 
parsing
+          | insert into ... values DML statements.
+          |""")

Review Comment:
   Done!



##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/EvaluateUnresolvedInlineTable.scala:
##########
@@ -0,0 +1,137 @@
+/*
+ * 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.catalyst
+
+import org.apache.spark.sql.catalyst.analysis._
+import org.apache.spark.sql.catalyst.expressions.{AliasHelper, EvalHelper, 
Expression}
+import org.apache.spark.sql.catalyst.optimizer.EvalInlineTables
+import org.apache.spark.sql.catalyst.plans.logical.LogicalPlan
+import org.apache.spark.sql.catalyst.trees.AlwaysProcess
+import org.apache.spark.sql.catalyst.trees.TreePattern.CURRENT_LIKE
+import org.apache.spark.sql.catalyst.types.DataTypeUtils
+import org.apache.spark.sql.catalyst.util.TypeUtils.{toSQLExpr, toSQLId}
+import org.apache.spark.sql.types.{StructField, StructType}
+
+/**
+ * Utility object used to replace [[UnresolvedInlineTable]] with 
[[ResolvedInlineTable]] or
+ * (whenever possible) with [[LocalRelation]]. Typically, 
[[UnresolvedInlineTable]] is
+ * a child of [[InsertIntoStatement]].
+ * Use the method: [[EvaluateUnresolvedInlineTable.evaluate]] as the entry 
point for this
+ * transformation.
+ */
+object EvaluateUnresolvedInlineTable extends SQLConfHelper
+  with AliasHelper with EvalHelper with CastSupport with 
UnresolvedInlineTableUtils {
+
+  def evaluate(plan: LogicalPlan): LogicalPlan = {
+    plan.resolveOperatorsWithPruning(AlwaysProcess.fn) {
+      case table: UnresolvedInlineTable if table.expressionsResolved =>
+        validateInputDimension(table)
+        validateInputEvaluable(table)
+        val resolvedTable = findCommonTypesAndCast(table)
+        val nestedRes = earlyEvalIfPossible(resolvedTable)
+        nestedRes

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