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


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/CursorReference.scala:
##########
@@ -0,0 +1,61 @@
+/*
+ * 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.expressions
+
+import org.apache.spark.sql.catalyst.InternalRow
+import org.apache.spark.sql.catalyst.analysis.UnresolvedException
+import org.apache.spark.sql.catalyst.trees.TreePattern.{CURSOR_REFERENCE, 
TreePattern => TP, UNRESOLVED_CURSOR}
+import org.apache.spark.sql.types.DataType
+
+/**
+ * An unresolved reference to a cursor. This is used during parsing and will 
be resolved
+ * to a [[CursorReference]] by the [[ResolveCursors]] analyzer rule.
+ *
+ * @param nameParts The parts of the cursor name (e.g., Seq("cursor") or 
Seq("label", "cursor"))
+ */
+case class UnresolvedCursor(nameParts: Seq[String]) extends LeafExpression 
with Unevaluable {
+  override def dataType: DataType = throw new UnresolvedException("dataType")
+  override def nullable: Boolean = throw new UnresolvedException("nullable")
+  override lazy val resolved: Boolean = false
+  override def sql: String = nameParts.mkString(".")
+  override def toString: String = 
s"UnresolvedCursor(${nameParts.mkString(".")})"
+
+  final override val nodePatterns: Seq[TP] = Seq(UNRESOLVED_CURSOR)
+}
+
+/**
+ * A resolved reference to a cursor. This is created by the [[ResolveCursors]] 
analyzer rule
+ * after normalizing the cursor name parts and checking case sensitivity.
+ *
+ * @param nameParts The original cursor name parts (unnormalized)
+ * @param normalizedName The normalized cursor name (for lookups considering 
case sensitivity)
+ * @param scopePath The scope path (e.g., Seq("label") for qualified cursors, 
empty for unqualified)
+ */
+case class CursorReference(
+    nameParts: Seq[String],
+    normalizedName: String,
+    scopePath: Seq[String]) extends LeafExpression with Unevaluable {

Review Comment:
   should it be `Option[String]` or we pick `Seq[String]` for the future? For 
now the qualifier can only be label name which only has one name part.



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