cloud-fan commented on code in PR #49445:
URL: https://github.com/apache/spark/pull/49445#discussion_r1946101345


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/catalog/VariableManager.scala:
##########
@@ -0,0 +1,159 @@
+/*
+ * 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.catalog
+
+import javax.annotation.concurrent.GuardedBy
+
+import scala.collection.mutable
+
+import org.apache.spark.sql.AnalysisException
+import org.apache.spark.sql.catalyst.expressions.Literal
+import org.apache.spark.sql.connector.catalog.{CatalogManager, Identifier}
+import 
org.apache.spark.sql.connector.catalog.CatalogManager.{SESSION_NAMESPACE, 
SYSTEM_CATALOG_NAME}
+import org.apache.spark.sql.errors.DataTypeErrorsBase
+import 
org.apache.spark.sql.errors.QueryCompilationErrors.unresolvedVariableError
+
+/**
+ * Trait which provides an interface for variable managers. Methods are case 
sensitive regarding
+ * the variable name/nameParts/identifier, callers are responsible to
+ * format them w.r.t. case-sensitive config.
+ */
+trait VariableManager {
+  /**
+   * Create a variable.
+   * @param identifier Identifier of the variable.
+   * @param defaultValueSQL SQL text of the variable's DEFAULT expression.
+   * @param initValue Initial value of the variable.
+   * @param overrideIfExists If true, the new variable will replace an 
existing one
+   *                         with the same identifier, if it exists.
+   */
+  def create(
+      identifier: Identifier,
+      defaultValueSQL: String,
+      initValue: Literal,
+      overrideIfExists: Boolean): Unit
+
+  /**
+   * Set an existing variable to a new value.
+ *
+   * @param nameParts Name parts of the variable.
+   * @param defaultValueSQL SQL text of the variable's DEFAULT expression.
+   * @param initValue Initial value of the variable.
+   * @param identifier Identifier of the variable.
+   */
+  def set(
+      nameParts: Seq[String],

Review Comment:
   shall we also use `Identifier` to match `def create`?



-- 
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-unsubscr...@spark.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to