Class EvaluationVisitor.VectorVariableHolder

java.lang.Object
org.apache.drill.exec.expr.ClassGenerator.HoldingContainer
org.apache.drill.exec.expr.EvaluationVisitor.VectorVariableHolder
Enclosing class:
EvaluationVisitor

public static class EvaluationVisitor.VectorVariableHolder extends ClassGenerator.HoldingContainer
Extended variable descriptor ("holding container") for the variable which references the value holder ("FooHolder") that stores the value from a value vector. Used to pass along the original value vector variable along with the value holder. In particular, this class allows "time travel": to retroactively generate a reader for a union once we realize we need the reader.

TODO: This is not especially elegant. But the code that declares the holder/reader does not know about the parameter(s) that will use it, and the normal HoldingContainer can hold only one variable, not a broader context. This version holds more context. Perhaps this idea should be generalized.

  • Constructor Details

    • VectorVariableHolder

      public VectorVariableHolder(ClassGenerator.HoldingContainer base, ClassGenerator<?> classGen, com.sun.codemodel.JBlock vvSetupBlock, com.sun.codemodel.JExpression vectorExpr, com.sun.codemodel.JExpression recordIndex)
  • Method Details

    • generateUnionReader

      public com.sun.codemodel.JVar generateUnionReader()
      Specialized hack for the UNION type to obtain a FieldReader directly from the value vector, bypassing the UnionHolder created from that vector. Handles setting the reader position only once in an eval block rather than on each reference. There may be multiple functions that need the reader. To ensure we create only one common reader, we "go back in time" to add the reader at the point after we declared the UnionHolder.