You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by yhuai <gi...@git.apache.org> on 2015/10/01 05:57:23 UTC

[GitHub] spark pull request: [SPARK-10671] [SQL] Throws an analysis excepti...

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

    https://github.com/apache/spark/pull/8941#discussion_r40877292
  
    --- Diff: sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveUDFSuite.scala ---
    @@ -299,6 +300,42 @@ class HiveUDFSuite extends QueryTest with TestHiveSingleton {
     
         hiveContext.reset()
       }
    +
    +  test("Hive UDFs with insufficient number of input arguments should trigger an analysis error") {
    +    Seq((1, 2)).toDF("a", "b").registerTempTable("testUDF")
    +
    +    {
    +      // Hive UDF
    +      sql(s"CREATE TEMPORARY FUNCTION testUDFTwoListList AS '${classOf[UDFTwoListList].getName}'")
    +      val message = intercept[AnalysisException] {
    +        sql("SELECT testUDFTwoListList() FROM testUDF")
    +      }.getMessage
    +      assert(message.contains("No handler for Hive udf"))
    +    }
    +
    +    {
    +      // Hive UDAF
    +      sql(s"CREATE TEMPORARY FUNCTION testUDAFPercentile AS '${classOf[UDAFPercentile].getName}'")
    +      val message = intercept[AnalysisException] {
    +        sql("SELECT testUDAFPercentile(a) FROM testUDF GROUP BY b")
    +      }.getMessage
    +      assert(message.contains("No handler for Hive udf"))
    +    }
    +
    +    {
    +      // Hive UDTF
    +      sql(s"CREATE TEMPORARY FUNCTION testUDTFExplode AS '${classOf[GenericUDTFExplode].getName}'")
    +      val message = intercept[AnalysisException] {
    +        sql("SELECT testUDTFExplode() FROM testUDF")
    +      }.getMessage
    +      assert(message.contains("No handler for Hive udf"))
    +    }
    --- End diff --
    
    Can we also add tests for `GenericUDF` and `AbstractGenericUDAFResolver` (we have tests of `UDAF`, `UDF`, and `GenericUDTF` at here)?


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