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

    https://github.com/apache/spark/pull/9904#discussion_r45638276
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/objects.scala
 ---
    @@ -531,15 +526,15 @@ case class GetInternalRowField(child: Expression, 
ordinal: Int, dataType: DataTy
         throw new UnsupportedOperationException("Only code-generated 
evaluation is supported")
     
       override def genCode(ctx: CodeGenContext, ev: GeneratedExpressionCode): 
String = {
    -    val row = child.gen(ctx)
    -    s"""
    -      ${row.code}
    -      final boolean ${ev.isNull} = ${row.isNull};
    -      ${ctx.javaType(dataType)} ${ev.value} = 
${ctx.defaultValue(dataType)};
    -      if (!${ev.isNull}) {
    -        ${ev.value} = ${ctx.getValue(row.value, dataType, 
ordinal.toString)};
    -      }
    -    """
    +    nullSafeCodeGen(ctx, ev, eval => {
    --- End diff --
    
    This is fine for now, but this why we shouldn't have two different 
expressions for performing the same task.  We should have a single way to 
extract a field from a struct.


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to