spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jaceklaskowski <...@git.apache.org>
Subject [GitHub] spark pull request #17712: [SPARK-20416][SQL] Print UDF names in EXPLAIN
Date Fri, 21 Apr 2017 08:13:47 GMT
Github user jaceklaskowski commented on a diff in the pull request:

    https://github.com/apache/spark/pull/17712#discussion_r112634952
  
    --- Diff: sql/core/src/test/scala/org/apache/spark/sql/UDFSuite.scala ---
    @@ -256,10 +256,12 @@ class UDFSuite extends QueryTest with SharedSQLContext {
           val sparkPlan = spark.sessionState.executePlan(explain).executedPlan
           sparkPlan.executeCollect().map(_.getString(0).trim).headOption.getOrElse("")
         }
    -    val udf1 = "myUdf1"
    -    val udf2 = "myUdf2"
    -    spark.udf.register(udf1, (n: Int) => { n + 1 })
    -    spark.udf.register(udf2, (n: Int) => { n * 1 })
    -    assert(explainStr(sql("SELECT myUdf1(myUdf2(1))")).contains(s"UDF:$udf1(UDF:$udf2(1))"))
    +    val udf1Name = "myUdf1"
    +    val udf2Name = "myUdf2"
    +    val udf1 = spark.udf.register(udf1Name, (n: Int) => { n + 1 })
    +    val udf2 = spark.udf.register(udf2Name, (n: Int) => { n * 1 })
    +    assert(explainStr(sql("SELECT myUdf1(myUdf2(1))")).contains(s"UDF:$udf1Name(UDF:$udf2Name(1))"))
    +    assert(explainStr(spark.range(1).select(udf1(udf2(functions.lit(1)))))
    +      .contains(s"UDF:$udf1Name(UDF:$udf2Name(1))"))
    --- End diff --
    
    The goal of the change was to make sure that the names are the same for SQL and Dataset
"modes". The test should check it (even though it does it using the above two tests the last
one should rather check equality of SQL's and Dataset's outputs).


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