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

    https://github.com/apache/spark/pull/3109#discussion_r20688112
  
    --- Diff: sql/hive/src/main/scala/org/apache/spark/sql/hive/hiveUdfs.scala 
---
    @@ -162,9 +161,8 @@ private[hive] case class 
HiveGenericUdf(functionClassName: String, children: Seq
         (udfType != null && udfType.deterministic())
       }
     
    -  override def foldable = {
    -    isUDFDeterministic && children.foldLeft(true)((prev, n) => prev && 
n.foldable)
    -  }
    +  override def foldable =
    +    isUDFDeterministic && 
returnInspector.isInstanceOf[ConstantObjectInspector]
    --- End diff --
    
    I don't really understand all the contracts here, so please correct me if 
I'm missing something, but why does the return type have to be a Constant?  It 
seems like if a UDF is deterministic it should be safe to fold as long as its 
children are foldable too, independent of the type of inspector it returns.


---
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