Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ package org.apache.spark.sql.catalyst.expressions
import org.apache.spark.sql.catalyst.InternalRow
import org.apache.spark.sql.catalyst.catalog.VariableDefinition
import org.apache.spark.sql.catalyst.expressions.codegen.{CodegenContext, ExprCode}
import org.apache.spark.sql.catalyst.trees.TreePattern.{TreePattern, VARIABLE_REFERENCE}
import org.apache.spark.sql.catalyst.util.quoteIfNeeded
import org.apache.spark.sql.connector.catalog.{CatalogPlugin, Identifier}
import org.apache.spark.sql.types.DataType
Expand Down Expand Up @@ -57,4 +58,6 @@ case class VariableReference(
override protected def doGenCode(ctx: CodegenContext, ev: ExprCode): ExprCode = {
varDef.currentValue.doGenCode(ctx, ev)
}

final override val nodePatterns: Seq[TreePattern] = Seq(VARIABLE_REFERENCE)
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,12 @@ import org.apache.spark.sql.catalyst.expressions.codegen._
import org.apache.spark.sql.catalyst.expressions.codegen.Block._
import org.apache.spark.sql.catalyst.expressions.objects.StaticInvoke
import org.apache.spark.sql.catalyst.trees.{BinaryLike, UnaryLike}
import org.apache.spark.sql.catalyst.trees.TreePattern.{ARRAYS_ZIP, CONCAT, TreePattern}
import org.apache.spark.sql.catalyst.trees.TreePattern.{
ARRAYS_ZIP,
CONCAT,
MAP_FROM_ENTRIES,
TreePattern
}
import org.apache.spark.sql.catalyst.types.{DataTypeUtils, PhysicalDataType, PhysicalIntegralType}
import org.apache.spark.sql.catalyst.util._
import org.apache.spark.sql.catalyst.util.DateTimeConstants._
Expand Down Expand Up @@ -895,6 +900,8 @@ case class MapFromEntries(child: Expression)

override protected def withNewChildInternal(newChild: Expression): MapFromEntries =
copy(child = newChild)

final override val nodePatterns: Seq[TreePattern] = Seq(MAP_FROM_ENTRIES)
}

case class MapSort(base: Expression)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,8 @@ case class CreateMap(children: Seq[Expression], useStringTypeWhenEmpty: Boolean)

override protected def withNewChildrenInternal(newChildren: IndexedSeq[Expression]): CreateMap =
copy(children = newChildren)

final override val nodePatterns: Seq[TreePattern] = Seq(CREATE_MAP)
}

object CreateMap {
Expand Down Expand Up @@ -348,6 +350,8 @@ case class MapFromArrays(left: Expression, right: Expression)
override protected def withNewChildrenInternal(
newLeft: Expression, newRight: Expression): MapFromArrays =
copy(left = newLeft, right = newRight)

final override val nodePatterns: Seq[TreePattern] = Seq(MAP_FROM_ARRAYS)
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ object TreePattern extends Enumeration {
val COMMON_EXPR_REF: Value = Value
val CONCAT: Value = Value
val COUNT: Value = Value
val CREATE_MAP: Value = Value
val CREATE_NAMED_STRUCT: Value = Value
val CURRENT_LIKE: Value = Value
val DYNAMIC_PRUNING_EXPRESSION: Value = Value
Expand All @@ -65,6 +66,8 @@ object TreePattern extends Enumeration {
val LIKE_FAMLIY: Value = Value
val LIST_SUBQUERY: Value = Value
val LITERAL: Value = Value
val MAP_FROM_ARRAYS: Value = Value
val MAP_FROM_ENTRIES: Value = Value
val MAP_OBJECTS: Value = Value
val MULTI_ALIAS: Value = Value
val NEW_INSTANCE: Value = Value
Expand Down Expand Up @@ -99,6 +102,7 @@ object TreePattern extends Enumeration {
val UPDATE_FIELDS: Value = Value
val UPPER_OR_LOWER: Value = Value
val UP_CAST: Value = Value
val VARIABLE_REFERENCE: Value = Value
val DISTRIBUTED_SEQUENCE_ID: Value = Value

// Unresolved expression patterns (Alphabetically ordered)
Expand Down