The variable name of the input row in generated code.
Add buffer variable which stores data coming from an InternalRow.
Add buffer variable which stores data coming from an InternalRow. This methods guarantees that the variable is safely stored, which is important for (potentially) byte array backed data types like: UTF8String, ArrayData, MapData & InternalRow.
Add an object to references
, create a class member to access it.
Add an object to references
, create a class member to access it.
Returns the name of class member.
Add an object to references
.
Add an object to references
.
Returns the code to access it.
This is for minor objects not to store the object into field but refer it from the references field at the time of use because number of fields in class is limited so we should reduce it.
Holding all the functions those will be added into generated class.
Returns the boxed type in Java.
Whether should we copy the result rows or not.
Whether should we copy the result rows or not.
If any operator inside WholeStageCodegen generate multiple rows from a single row (for example, Join), this should be true.
If an operator starts a new pipeline, this should be reset to false before calling consume()
.
Holding a list of generated columns as input of current operator, will be used by BoundReference to generate code.
Returns the representation of default value for a given Java Type.
Holds expressions that are equivalent.
Holds expressions that are equivalent. Used to perform subexpression elimination during codegen.
For expressions that appear more than once, generate additional code to prevent recomputing the value.
For example, consider two expression generated from this SQL statement: SELECT (col1 + col2), (col1 + col2) / col3.
equivalentExpressions will match the tree containing col1 + col2
and it will only
be evaluated once.
Returns a term name that is unique within this instance of a CodegenContext
.
A prefix used to generate fresh name.
Generates code for comparing two expressions.
Generates code for comparing two expressions.
data type of the expressions
name of the variable of expression 1's output
name of the variable of expression 2's output
Generates code for equal expression in Java.
Generates code for greater of two expressions.
Generates code for greater of two expressions.
data type of the expressions
name of the variable of expression 1's output
name of the variable of expression 2's output
Generates code for expressions.
Generates code for expressions. If doSubexpressionElimination is true, subexpression
elimination will be performed. Subexpression elimination assumes that the code will for each
expression will be combined in the expressions
order.
get a map of the pair of a place holder and a corresponding comment
Returns the specialized code to access a value from a column vector for a given DataType
.
Returns the specialized code to access a value from inputRow
at ordinal
.
Returns true if the Java type has a special accessor and setter in InternalRow.
Returns the Java type for a DataType.
Holding expressions' mutable states like MonotonicallyIncreasingID.count
as a
3-tuple: java type, variable name, code to init it.
Holding expressions' mutable states like MonotonicallyIncreasingID.count
as a
3-tuple: java type, variable name, code to init it.
As an example, ("int", "count", "count = 0;") will produce code:
private int count;
as a member variable, and add
count = 0;
to the constructor.
They will be kept as member variables in generated classes like SpecificProjection
.
Generates code to do null safe execution, i.e.
Generates code to do null safe execution, i.e. only execute the code when the input is not null by adding null check if necessary.
used to decide whether we should add null check or not.
the code to check if the input is null.
the code that should only be executed when the input is not null.
Code statements to initialize states that depend on the partition index.
Code statements to initialize states that depend on the partition index.
An integer partitionIndex
will be made available within the scope.
Returns the name used in accessor and setter for a Java primitive type.
List of java data types that have special accessors and setters in InternalRow.
Holding a list of objects that could be used passed into generated class.
Register a comment and return the corresponding place holder
Returns the code to update a column in Row for a given DataType.
Returns the specialized code to set a given value in a column vector for a given DataType
.
Splits the generated code of expressions into multiple functions, because function has 64kb code size limit in JVM
Splits the generated code of expressions into multiple functions, because function has 64kb code size limit in JVM
the codes to evaluate expressions.
the split function name base.
the list of (type, name) of the arguments of the split function.
the return type of the split function.
makes split function body, e.g. add preparation or cleanup.
folds the split function calls.
Splits the generated code of expressions into multiple functions, because function has 64kb code size limit in JVM
Splits the generated code of expressions into multiple functions, because function has 64kb code size limit in JVM
the variable name of row that is used by expressions
the codes to evaluate expressions.
Checks and sets up the state and codegen for subexpression elimination.
Checks and sets up the state and codegen for subexpression elimination. This finds the common subexpressions, generates the code snippets that evaluate those expressions and populates the mapping of common subexpressions to the generated code snippets. The generated code snippets will be returned and should be inserted into generated codes before these common subexpressions actually are used first time.
Returns the specialized code to set a given value in a column vector for a given DataType
that could potentially be nullable.
Update a column in MutableRow from ExprCode.
Update a column in MutableRow from ExprCode.
True if the underlying row is of type ColumnarBatch.Row
, false otherwise
Perform a function which generates a sequence of ExprCodes with a given mapping between expressions and common expressions, instead of using the mapping in current context.
A context for codegen, tracking a list of objects that could be passed into generated Java function.