Class

org.apache.spark.sql.catalyst.expressions

DynamicFoldableExpression

Related Doc: package expressions

Permalink

case class DynamicFoldableExpression(expr: Expression) extends UnaryExpression with DynamicReplacableConstant with KryoSerializable with Product with Serializable

Wrap any TokenizedLiteral expression with this so that we can invoke literal initialization code within the .init() method of the generated class.

This pushes itself as reference object and uses a call to eval() on itself for actual evaluation and avoids embedding any generated code. This allows it to keep the generated code identical regardless of the constant expression (and in addition DynamicReplacableConstant trait casts to itself rather than actual object type).

We try to locate first foldable expression in a query tree such that all its child is foldable but parent isn't. That way we locate the exact point where an expression is safe to evaluate once instead of evaluating every row.

Expressions like select c from tab where case col2 when 1 then col3 else 'y' end = 22 like queries don't convert literal evaluation into init method.

expr

minimal expression tree that can be evaluated only once and turn into a constant.

Linear Supertypes
Serializable, Serializable, KryoSerializable, DynamicReplacableConstant, UnaryExpression, Expression, TreeNode[Expression], Product, Equals, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. DynamicFoldableExpression
  2. Serializable
  3. Serializable
  4. KryoSerializable
  5. DynamicReplacableConstant
  6. UnaryExpression
  7. Expression
  8. TreeNode
  9. Product
  10. Equals
  11. AnyRef
  12. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new DynamicFoldableExpression(expr: Expression)

    Permalink

    expr

    minimal expression tree that can be evaluated only once and turn into a constant.

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. def apply(number: Int): TreeNode[_]

    Permalink
    Definition Classes
    TreeNode
  5. def argString: String

    Permalink
    Definition Classes
    TreeNode
  6. def asCode: String

    Permalink
    Definition Classes
    TreeNode
  7. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  8. lazy val canonicalized: Expression

    Permalink
    Definition Classes
    Expression
  9. def checkInputDataTypes(): TypeCheckResult

    Permalink
    Definition Classes
    DynamicFoldableExpression → Expression
  10. def child: Expression

    Permalink
    Definition Classes
    DynamicFoldableExpression → UnaryExpression
  11. final def children: Seq[Expression]

    Permalink
    Definition Classes
    UnaryExpression → TreeNode
  12. def childrenResolved: Boolean

    Permalink
    Definition Classes
    Expression
  13. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  14. def collect[B](pf: PartialFunction[Expression, B]): Seq[B]

    Permalink
    Definition Classes
    TreeNode
  15. def collectFirst[B](pf: PartialFunction[Expression, B]): Option[B]

    Permalink
    Definition Classes
    TreeNode
  16. def collectLeaves(): Seq[Expression]

    Permalink
    Definition Classes
    TreeNode
  17. lazy val containsChild: Set[TreeNode[_]]

    Permalink
    Definition Classes
    TreeNode
  18. def dataType: DataType

    Permalink
    Definition Classes
    DynamicFoldableExpression → Expression
  19. def defineCodeGen(ctx: CodegenContext, ev: ExprCode, f: (String) ⇒ String): ExprCode

    Permalink
    Attributes
    protected
    Definition Classes
    UnaryExpression
  20. final def deterministic: Boolean

    Permalink
    Definition Classes
    DynamicReplacableConstant → Expression
  21. final def doGenCode(ctx: CodegenContext, ev: ExprCode): ExprCode

    Permalink
    Definition Classes
    DynamicReplacableConstant → Expression
  22. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  23. def eval(input: InternalRow): Any

    Permalink
    Definition Classes
    DynamicFoldableExpression → UnaryExpression → Expression
  24. var expr: Expression

    Permalink

    minimal expression tree that can be evaluated only once and turn into a constant.

  25. def fastEquals(other: TreeNode[_]): Boolean

    Permalink
    Definition Classes
    TreeNode
  26. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  27. def find(f: (Expression) ⇒ Boolean): Option[Expression]

    Permalink
    Definition Classes
    TreeNode
  28. def flatArguments: Iterator[Any]

    Permalink
    Attributes
    protected
    Definition Classes
    Expression
  29. def flatMap[A](f: (Expression) ⇒ TraversableOnce[A]): Seq[A]

    Permalink
    Definition Classes
    TreeNode
  30. def foldable: Boolean

    Permalink
    Definition Classes
    UnaryExpression → Expression
  31. def foreach(f: (Expression) ⇒ Unit): Unit

    Permalink
    Definition Classes
    TreeNode
  32. def foreachUp(f: (Expression) ⇒ Unit): Unit

    Permalink
    Definition Classes
    TreeNode
  33. def genCode(ctx: CodegenContext): ExprCode

    Permalink
    Definition Classes
    Expression
  34. def generateTreeString(depth: Int, lastChildren: Seq[Boolean], builder: StringBuilder, verbose: Boolean, prefix: String): StringBuilder

    Permalink
    Definition Classes
    TreeNode
  35. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  36. def hashCode(): Int

    Permalink
    Definition Classes
    TreeNode → AnyRef → Any
  37. def innerChildren: Seq[TreeNode[_]]

    Permalink
    Attributes
    protected
    Definition Classes
    TreeNode
  38. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  39. def jsonFields: List[JField]

    Permalink
    Attributes
    protected
    Definition Classes
    TreeNode
  40. def makeCopy(newArgs: Array[AnyRef]): Expression

    Permalink
    Definition Classes
    DynamicFoldableExpression → TreeNode
  41. def map[A](f: (Expression) ⇒ A): Seq[A]

    Permalink
    Definition Classes
    TreeNode
  42. def mapChildren(f: (Expression) ⇒ Expression): Expression

    Permalink
    Definition Classes
    TreeNode
  43. def mapProductIterator[B](f: (Any) ⇒ B)(implicit arg0: ClassTag[B]): Array[B]

    Permalink
    Attributes
    protected
    Definition Classes
    TreeNode
  44. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  45. def nodeName: String

    Permalink
    Definition Classes
    DynamicFoldableExpression → TreeNode
  46. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  47. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  48. def nullSafeCodeGen(ctx: CodegenContext, ev: ExprCode, f: (String) ⇒ String): ExprCode

    Permalink
    Attributes
    protected
    Definition Classes
    UnaryExpression
  49. def nullSafeEval(input: Any): Any

    Permalink
    Attributes
    protected
    Definition Classes
    UnaryExpression
  50. def nullable: Boolean

    Permalink
    Definition Classes
    UnaryExpression → Expression
  51. def numberedTreeString: String

    Permalink
    Definition Classes
    TreeNode
  52. val origin: Origin

    Permalink
    Definition Classes
    TreeNode
  53. def otherCopyArgs: Seq[AnyRef]

    Permalink
    Attributes
    protected
    Definition Classes
    TreeNode
  54. def p(number: Int): Expression

    Permalink
    Definition Classes
    TreeNode
  55. def prettyJson: String

    Permalink
    Definition Classes
    TreeNode
  56. def prettyName: String

    Permalink
    Definition Classes
    DynamicFoldableExpression → Expression
  57. def read(kryo: Kryo, input: Input): Unit

    Permalink
    Definition Classes
    DynamicFoldableExpression → KryoSerializable
  58. def references: AttributeSet

    Permalink
    Definition Classes
    Expression
  59. lazy val resolved: Boolean

    Permalink
    Definition Classes
    Expression
  60. def semanticEquals(other: Expression): Boolean

    Permalink
    Definition Classes
    Expression
  61. def semanticHash(): Int

    Permalink
    Definition Classes
    Expression
  62. def simpleString: String

    Permalink
    Definition Classes
    Expression → TreeNode
  63. def sql: String

    Permalink
    Definition Classes
    Expression
  64. def stringArgs: Iterator[Any]

    Permalink
    Attributes
    protected
    Definition Classes
    TreeNode
  65. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  66. def toJSON: String

    Permalink
    Definition Classes
    TreeNode
  67. def toString(): String

    Permalink
    Definition Classes
    DynamicFoldableExpression → Expression → TreeNode → AnyRef → Any
  68. def transform(rule: PartialFunction[Expression, Expression]): Expression

    Permalink
    Definition Classes
    TreeNode
  69. def transformDown(rule: PartialFunction[Expression, Expression]): Expression

    Permalink
    Definition Classes
    TreeNode
  70. def transformUp(rule: PartialFunction[Expression, Expression]): Expression

    Permalink
    Definition Classes
    TreeNode
  71. def treeString(verbose: Boolean): String

    Permalink
    Definition Classes
    TreeNode
  72. def treeString: String

    Permalink
    Definition Classes
    TreeNode
  73. def value: Any

    Permalink
  74. final def verboseString: String

    Permalink
    Definition Classes
    Expression → TreeNode
  75. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  76. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  77. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  78. def withNewChildren(newChildren: Seq[Expression]): Expression

    Permalink
    Definition Classes
    DynamicFoldableExpression → TreeNode
  79. def write(kryo: Kryo, output: Output): Unit

    Permalink
    Definition Classes
    DynamicFoldableExpression → KryoSerializable

Inherited from Serializable

Inherited from Serializable

Inherited from KryoSerializable

Inherited from DynamicReplacableConstant

Inherited from UnaryExpression

Inherited from Expression

Inherited from TreeNode[Expression]

Inherited from Product

Inherited from Equals

Inherited from AnyRef

Inherited from Any

Ungrouped