This is an automated email from the ASF dual-hosted git repository.

gurwls223 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/master by this push:
     new 27e41d6  [SPARK-28270][TEST-MAVEN][FOLLOW-UP][SQL][PYTHON][TESTS] 
Avoid cast input of UDF as double in the failed test in udf-aggregate_part1.sql
27e41d6 is described below

commit 27e41d65f158e8f0b04e73df195d3651c7eae485
Author: HyukjinKwon <[email protected]>
AuthorDate: Fri Jul 12 14:33:16 2019 +0900

    [SPARK-28270][TEST-MAVEN][FOLLOW-UP][SQL][PYTHON][TESTS] Avoid cast input 
of UDF as double in the failed test in udf-aggregate_part1.sql
    
    ## What changes were proposed in this pull request?
    
    It still can be flaky on certain environments due to float limitation 
described at https://github.com/apache/spark/pull/25110 . See 
https://github.com/apache/spark/pull/25110#discussion_r302735905
    
    - 
https://amplab.cs.berkeley.edu/jenkins/view/Spark%20QA%20Test%20(Dashboard)/job/spark-master-test-maven-hadoop-2.7/6584/testReport/org.apache.spark.sql/SQLQueryTestSuite/udf_pgSQL_udf_aggregates_part1_sql___Regular_Python_UDF/
    
    ```
    Expected "700000000000[6] 1", but got "700000000000[5] 1" Result did not 
match for query #33&#010;SELECT CAST(avg(udf(CAST(x AS DOUBLE))) AS long), 
CAST(udf(var_pop(CAST(x AS DOUBLE))) AS decimal(10,3))&#010;FROM (VALUES 
(7000000000005), (7000000000007)) v(x)
    ```
    
    Here;s what's going on: 
https://github.com/apache/spark/pull/25110#discussion_r302791930
    
    ```
    scala> Seq("7000000000004.999", 
"7000000000006.999").toDF().selectExpr("CAST(avg(value) AS long)").show()
    +--------------------------+
    |CAST(avg(value) AS BIGINT)|
    +--------------------------+
    |             7000000000005|
    +--------------------------+
    ```
    
    Therefore, this PR just avoid to cast in the specific test.
    
    This is a temp fix. We need more robust way to avoid such cases.
    
    ## How was this patch tested?
    
    It passes with Maven in my local before/after this PR. I believe the 
problem seems similarly the Python or OS installed in the machine. I should 
test this against PR builder with `test-maven` for sure..
    
    Closes #25128 from HyukjinKwon/SPARK-28270-2.
    
    Authored-by: HyukjinKwon <[email protected]>
    Signed-off-by: HyukjinKwon <[email protected]>
---
 .../resources/sql-tests/inputs/udf/pgSQL/udf-aggregates_part1.sql     | 2 +-
 .../sql-tests/results/udf/pgSQL/udf-aggregates_part1.sql.out          | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git 
a/sql/core/src/test/resources/sql-tests/inputs/udf/pgSQL/udf-aggregates_part1.sql
 
b/sql/core/src/test/resources/sql-tests/inputs/udf/pgSQL/udf-aggregates_part1.sql
index 5b97d3d..3e87733 100644
--- 
a/sql/core/src/test/resources/sql-tests/inputs/udf/pgSQL/udf-aggregates_part1.sql
+++ 
b/sql/core/src/test/resources/sql-tests/inputs/udf/pgSQL/udf-aggregates_part1.sql
@@ -78,7 +78,7 @@ FROM (VALUES ('-Infinity'), ('Infinity')) v(x);
 -- test accuracy with a large input offset
 SELECT CAST(avg(udf(CAST(x AS DOUBLE))) AS int), CAST(udf(var_pop(CAST(x AS 
DOUBLE))) AS decimal(10,3))
 FROM (VALUES (100000003), (100000004), (100000006), (100000007)) v(x);
-SELECT CAST(avg(udf(CAST(x AS DOUBLE))) AS long), CAST(udf(var_pop(CAST(x AS 
DOUBLE))) AS decimal(10,3))
+SELECT CAST(avg(udf(x)) AS long), CAST(udf(var_pop(CAST(x AS DOUBLE))) AS 
decimal(10,3))
 FROM (VALUES (7000000000005), (7000000000007)) v(x);
 
 -- SQL2003 binary aggregates [SPARK-23907]
diff --git 
a/sql/core/src/test/resources/sql-tests/results/udf/pgSQL/udf-aggregates_part1.sql.out
 
b/sql/core/src/test/resources/sql-tests/results/udf/pgSQL/udf-aggregates_part1.sql.out
index 98e04b4..5c08245 100644
--- 
a/sql/core/src/test/resources/sql-tests/results/udf/pgSQL/udf-aggregates_part1.sql.out
+++ 
b/sql/core/src/test/resources/sql-tests/results/udf/pgSQL/udf-aggregates_part1.sql.out
@@ -271,10 +271,10 @@ struct<CAST(avg(CAST(udf(cast(x as double)) AS DOUBLE)) 
AS INT):int,CAST(udf(var
 
 
 -- !query 33
-SELECT CAST(avg(udf(CAST(x AS DOUBLE))) AS long), CAST(udf(var_pop(CAST(x AS 
DOUBLE))) AS decimal(10,3))
+SELECT CAST(avg(udf(x)) AS long), CAST(udf(var_pop(CAST(x AS DOUBLE))) AS 
decimal(10,3))
 FROM (VALUES (7000000000005), (7000000000007)) v(x)
 -- !query 33 schema
-struct<CAST(avg(CAST(udf(cast(x as double)) AS DOUBLE)) AS 
BIGINT):bigint,CAST(udf(var_pop(cast(x as double))) AS 
DECIMAL(10,3)):decimal(10,3)>
+struct<CAST(avg(CAST(udf(x) AS DOUBLE)) AS 
BIGINT):bigint,CAST(udf(var_pop(cast(x as double))) AS 
DECIMAL(10,3)):decimal(10,3)>
 -- !query 33 output
 7000000000006  1
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to