CodeGenerator

CodeGenerator is a base class for generators of JVM bytecode for expression evaluation.

Table 1. CodeGenerator’s Internal Properties
Name Description

cache

Guava’s LoadingCache with at most 100 pairs of CodeAndComment and GeneratedClass.

genericMutableRowType

Tip

Enable INFO or DEBUG logging level for org.apache.spark.sql.catalyst.expressions.codegen.CodeGenerator logger to see what happens inside.

Add the following line to conf/log4j.properties:

log4j.logger.org.apache.spark.sql.catalyst.expressions.codegen.CodeGenerator=DEBUG

Refer to Logging.

CodeGenerator Contract

package org.apache.spark.sql.catalyst.expressions.codegen

abstract class CodeGenerator[InType, OutType] {
  def create(in: InType): OutType
  def canonicalize(in: InType): InType
  def bind(in: InType, inputSchema: Seq[Attribute]): InType
  def generate(expressions: InType, inputSchema: Seq[Attribute]): OutType
  def generate(expressions: InType): OutType
}
Table 2. CodeGenerator Contract
Method Description

generate

Generates an evaluator for expression(s) that may (optionally) have expression(s) bound to a schema (i.e. a collection of Attribute).

Used in:

Compiling Java Source Code using Janino — doCompile Internal Method

Caution
FIXME

Finding or Compiling Java Source Code — compile Method

Caution
FIXME

create Method

create(references: Seq[Expression]): UnsafeProjection
Caution
FIXME
Note

create is used when:

Creating CodegenContext — newCodeGenContext Method

newCodeGenContext(): CodegenContext

newCodeGenContext simply creates a new CodegenContext.

Note

newCodeGenContext is used when:

results matching ""

    No results matching ""