Packages

package codegen

A collection of generators that build custom bytecode at runtime for performing the evaluation of catalyst expression.

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. codegen
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. abstract class BaseMutableProjection extends MutableProjection
  2. abstract class BaseProjection extends Projection

    Java can not access Projection (in package object)

  3. trait Block extends TreeNode[Block] with JavaCode

    A trait representing a block of java code.

  4. case class ByteCodeStats(maxMethodCodeSize: Int, maxConstPoolSize: Int, numInnerClasses: Int) extends Product with Serializable

    Java bytecode statistics of a compiled class by Janino.

  5. class CodeAndComment extends Serializable

    A wrapper for the source code to be compiled by CodeGenerator.

  6. case class CodeBlock(codeParts: Seq[String], blockInputs: Seq[JavaCode]) extends TreeNode[Block] with Block with Product with Serializable

    A block of java code.

    A block of java code. Including a sequence of code parts and some inputs to this block. The actual java code is generated by embedding the inputs into the code parts. Here we keep inputs of JavaCode instead of simply folding them as a string of code, because we need to track expressions (ExprValue) in this code block. We need to be able to manipulate the expressions later without changing the behavior of this code block in some applications, e.g., method splitting.

  7. abstract class CodeGenerator[InType <: AnyRef, OutType <: AnyRef] extends Logging

    A base class for generators of byte code to perform expression evaluation.

    A base class for generators of byte code to perform expression evaluation. Includes a set of helpers for referring to Catalyst types and building trees that perform evaluation of individual expressions.

  8. class CodegenContext extends Logging

    A context for codegen, tracking a list of objects that could be passed into generated Java function.

  9. trait CodegenFallback extends Expression

    A trait that can be used to provide a fallback mode for expression code generation.

  10. case class ExprCode(code: Block, isNull: ExprValue, value: ExprValue) extends Product with Serializable

    Java source for evaluating an Expression given a InternalRow of input.

    Java source for evaluating an Expression given a InternalRow of input.

    code

    The sequence of statements required to evaluate the expression. It should be empty string, if isNull and value are already existed, or no code needed to evaluate them (literals).

    isNull

    A term that holds a boolean value representing whether the expression evaluated to null.

    value

    A term for a (possibly primitive) value of the result of the evaluation. Not valid if isNull is set to true.

  11. trait ExprValue extends JavaCode

    A typed java fragment that must be a valid java expression.

  12. abstract class GeneratedClass extends AnyRef

    A wrapper for generated class, defines a generate method so that we can pass extra objects into generated class.

  13. case class GlobalValue(value: String, javaType: Class[_]) extends ExprValue with Product with Serializable

    A global variable java expression.

  14. case class Inline(codeString: String) extends JavaCode with Product with Serializable

    A piece of java code snippet inlines all types of input arguments into a string without tracking any reference of JavaCode instances.

  15. trait JavaCode extends AnyRef

    Trait representing an opaque fragments of java code.

  16. class LazilyGeneratedOrdering extends Ordering[InternalRow] with KryoSerializable

    A lazily generated row ordering comparator.

  17. class LiteralValue extends ExprValue with Serializable

    A literal java expression.

  18. case class SimpleExprValue(expr: String, javaType: Class[_]) extends ExprValue with Product with Serializable

    A java expression fragment.

  19. case class SubExprCodes(codes: Seq[String], states: Map[Expression, SubExprEliminationState]) extends Product with Serializable

    Codes and common subexpressions mapping used for subexpression elimination.

    Codes and common subexpressions mapping used for subexpression elimination.

    codes

    Strings representing the codes that evaluate common subexpressions.

    states

    Foreach expression that is participating in subexpression elimination, the state to use.

  20. case class SubExprEliminationState(isNull: ExprValue, value: ExprValue) extends Product with Serializable

    State used for subexpression elimination.

    State used for subexpression elimination.

    isNull

    A term that holds a boolean value representing whether the expression evaluated to null.

    value

    A term for a value of a common sub-expression. Not valid if isNull is set to true.

  21. final class UnsafeArrayWriter extends UnsafeWriter

    A helper class to write data into global row buffer using UnsafeArrayData format, used by org.apache.spark.sql.catalyst.expressions.codegen.GenerateUnsafeProjection.

  22. abstract class UnsafeRowJoiner extends AnyRef
  23. final class UnsafeRowWriter extends UnsafeWriter

    A helper class to write data into global row buffer using UnsafeRow format.

    A helper class to write data into global row buffer using UnsafeRow format.

    It will remember the offset of row buffer which it starts to write, and move the cursor of row buffer while writing. If new data(can be the input record if this is the outermost writer, or nested struct if this is an inner writer) comes, the starting cursor of row buffer may be changed, so we need to call UnsafeRowWriter.resetRowWriter before writing, to update the startingOffset and clear out null bits.

    Note that if this is the outermost writer, which means we will always write from the very beginning of the global row buffer, we don't need to update startingOffset and can just call zeroOutNullBytes before writing new data.

  24. abstract class UnsafeWriter extends AnyRef

    Base class for writing Unsafe* structures.

  25. case class VariableValue(variableName: String, javaType: Class[_]) extends ExprValue with Product with Serializable

    A local variable java expression.

Value Members

  1. object Block
  2. object ByteCodeStats extends Serializable
  3. object CodeFormatter

    An utility class that indents a block of code based on the curly braces and parentheses.

    An utility class that indents a block of code based on the curly braces and parentheses. This is used to prettify generated code when in debug mode (or exceptions).

    Written by Matei Zaharia.

  4. object CodeGenerator extends Logging
  5. object DumpByteCode

    Dumps the bytecode from a class to the screen using javap.

  6. object EmptyBlock extends TreeNode[Block] with Block with Serializable with Product
  7. object ExprCode extends Serializable
  8. object ExprValue
  9. object ExpressionCanonicalizer extends RuleExecutor[Expression]

    Canonicalizes an expression so those that differ only by names can reuse the same code.

  10. object FalseLiteral extends LiteralValue with Product with Serializable
  11. object GenerateMutableProjection extends CodeGenerator[Seq[Expression], MutableProjection]

    Generates byte code that produces a InternalRow object that can update itself based on a new input InternalRow for a fixed set of Expressions.

    Generates byte code that produces a InternalRow object that can update itself based on a new input InternalRow for a fixed set of Expressions. It exposes a target method, which is used to set the row that will be updated. The internal InternalRow object created internally is used only when target is not used.

  12. object GenerateOrdering extends CodeGenerator[Seq[SortOrder], BaseOrdering] with Logging

    Generates bytecode for an Ordering of rows for a given set of expressions.

  13. object GeneratePredicate extends CodeGenerator[Expression, BasePredicate]

    Generates bytecode that evaluates a boolean Expression on a given input InternalRow.

  14. object GenerateSafeProjection extends CodeGenerator[Seq[Expression], Projection]

    Generates byte code that produces a InternalRow object (not an UnsafeRow) that can update itself based on a new input InternalRow for a fixed set of Expressions.

  15. object GenerateUnsafeProjection extends CodeGenerator[Seq[Expression], UnsafeProjection]

    Generates a Projection that returns an UnsafeRow.

    Generates a Projection that returns an UnsafeRow.

    It generates the code for all the expressions, computes the total length for all the columns (can be accessed via variables), and then copies the data into a scratch buffer space in the form of UnsafeRow (the scratch buffer will grow as needed).

    Note

    The returned UnsafeRow will be pointed to a scratch buffer inside the projection.

  16. object GenerateUnsafeRowJoiner extends CodeGenerator[(StructType, StructType), UnsafeRowJoiner]

    A code generator for concatenating two UnsafeRows into a single UnsafeRow.

    A code generator for concatenating two UnsafeRows into a single UnsafeRow.

    The high level algorithm is:

    1. Concatenate the two bitsets together into a single one, taking padding into account. 2. Move fixed-length data. 3. Move variable-length data. 4. Update the offset position (i.e. the upper 32 bits in the fixed length part) for all variable-length data.

  17. object JavaCode

    Utility functions for creating JavaCode fragments.

  18. object LazilyGeneratedOrdering extends Serializable
  19. object TrueLiteral extends LiteralValue with Product with Serializable

Inherited from AnyRef

Inherited from Any

Ungrouped