spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chenghao-intel <...@git.apache.org>
Subject [GitHub] spark pull request: [SPARK-4244] [SQL] Support Hive Generic UDFs w...
Date Fri, 21 Nov 2014 00:49:12 GMT
Github user chenghao-intel commented on a diff in the pull request:

    https://github.com/apache/spark/pull/3109#discussion_r20690457
  
    --- 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 --
    
    The key change here is we need to get the folded result via Hive the method `initializeAndFoldConstants`
of UDF, not the `initialize` method, that's why I made the change in L155-L156. UDF itself
knows better how to constant fold the computing if it's applicable, and the return value of
`initializeAndFoldConstants` tells us if it's can be or not and what the result it is.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


Mime
View raw message