spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chenghao-intel <>
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:
    --- 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 &&
    -  }
    +  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 or file a JIRA ticket
with INFRA.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message