Github user kiszk commented on a diff in the pull request:

    https://github.com/apache/spark/pull/11636#discussion_r56744501
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/BoundAttribute.scala
 ---
    @@ -104,3 +104,32 @@ object BindReferences extends Logging {
         }.asInstanceOf[A] // Kind of a hack, but safe.  TODO: Tighten return 
type when possible.
       }
     }
    +
    +/**
    + * A column vector reference points to a specific column for ColumnVector.
    + * columnVar is a variable that keeps ColumnVector, and ordinal is row 
index in ColumnVector
    + */
    +case class ColumnVectorReference(
    +  columnVar: String, ordinal: String, dataType: DataType, nullable: 
Boolean)
    +  extends LeafExpression {
    +
    +  override def toString: String = s"columnVector[$columnVar, $ordinal, 
${dataType.simpleString}]"
    +
    +  override def eval(input: InternalRow): Any = null
    +
    +  override def genCode(ctx: CodegenContext, ev: ExprCode): String = {
    +    val javaType = ctx.javaType(dataType)
    +    val value = ctx.getValue(columnVar, dataType, ordinal)
    +    if (nullable) {
    +      s"""
    +        boolean ${ev.isNull} = ${columnVar}.isNullAt($ordinal);
    +        $javaType ${ev.value} = ${ev.isNull} ? 
${ctx.defaultValue(dataType)} : ($value);
    --- End diff --
    
    Let me confirm you suggestion. Is your suggestion to move the definition of 
```ColumnVectorReference``` to ```ExistingRDD.scala```?  Or, is this to move 
```genCode``` into ```DataSourceScan``` by dropping ```ColumnVectorReference``` 
and copy ```Expression.gen()``` into ```DataSourceScan```?



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to