srielau commented on code in PR #41007:
URL: https://github.com/apache/spark/pull/41007#discussion_r1194384090
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/unresolved.scala:
##########
@@ -276,6 +279,138 @@ object UnresolvedAttribute {
}
}
+/**
+ * Holds an identifier clause for an attribute that has yet to be resolved.
+ */
+case class UnresolvedAttributeIdentifierClause(expr: Expression)
+ extends Expression with Unevaluable {
+
+ override def children: Seq[Expression] = Seq(expr)
+
+ override def dataType: DataType = throw new UnresolvedException("dataType")
+ override def nullable: Boolean = throw new UnresolvedException("nullable")
+ override lazy val resolved = false
+ final override val nodePatterns: Seq[TreePattern] =
Seq(UNRESOLVED_IDENTIFIER_CLAUSE)
+
+ override def prettyName: String = "IDENTIFIER"
+ override def toString: String = {
+ s"'(${children.mkString(", ")})"
+ }
+
+ override protected def withNewChildrenInternal(newChildren:
IndexedSeq[Expression]):
+ UnresolvedAttributeIdentifierClause = {
+ copy(expr = newChildren.head)
+ }
+}
+
+case class UnresolvedFunctionIdentifierClause(
+ identExpr: Expression,
+ arguments: Seq[Expression],
+ isDistinct: Boolean,
+ filter: Option[Expression] = None,
+ ignoreNulls: Boolean = false)
+ extends Expression with Unevaluable {
+
+ override def children: Seq[Expression] = arguments ++ filter.toSeq
+
+ override def dataType: DataType = throw new UnresolvedException("dataType")
+ override def nullable: Boolean = throw new UnresolvedException("nullable")
+ override lazy val resolved = false
+ final override val nodePatterns: Seq[TreePattern] =
Seq(UNRESOLVED_IDENTIFIER_CLAUSE)
+
+ override def prettyName: String = identExpr.toString
+ override def toString: String = {
+ val distinct = if (isDistinct) "distinct " else ""
+ s"'${identExpr.toString}($distinct${children.mkString(", ")})"
+ }
+
+ override protected def withNewChildrenInternal
+ (newChildren: IndexedSeq[Expression]): UnresolvedFunctionIdentifierClause = {
+ if (filter.isDefined) {
+ copy(arguments = newChildren.dropRight(1), filter =
Some(newChildren.last))
+ } else {
+ copy(arguments = newChildren)
+ }
+ }
+}
+
+object UnresolvedFunctionIdentifierClause {
+ def apply(
+ identExpr: Expression,
+ arguments: Seq[Expression],
+ isDistinct: Boolean): UnresolvedFunction = {
+ UnresolvedFunctionIdentifierClause(identExpr, arguments, isDistinct)
+ }
+}
+
+/**
+ * A table-valued function, e.g.
+ * {{{
+ * select id from range(10);
+ * }}}
+ *
+ * @param identExpr user-specified expression with teh name of this
table-value function
+ * @param functionArgs list of function arguments
+ */
+case class UnresolvedTableValuedFunctionIdentifierClause(
+ identExpr: Expression,
+ functionArgs: Seq[Expression])
+ extends LeafNode {
+
+ override def output: Seq[Attribute] = Nil
+
+ override lazy val resolved = false
+
+ final override val nodePatterns: Seq[TreePattern] =
Seq(UNRESOLVED_IDENTIFIER_CLAUSE)
+}
+
+/**
+* A table-valued function with output column aliases, e.g.
+* {{{
+* // Assign alias names
+* select t.a from range(10) t(a);
+* }}}
+*
+* @param identExpr user-specified name of the table-valued function
+* @param child logical plan of the table-valued function
+* @param outputNames alias names of function output columns. The analyzer adds
[[Project]]
+* to rename the output columns.
+*/
+case class UnresolvedTVFAliasesIdentifierClause(
+ identExpr: Expression,
Review Comment:
addressed
--
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]