cloud-fan commented on code in PR #36468:
URL: https://github.com/apache/spark/pull/36468#discussion_r868772636
##########
sql/core/src/test/resources/sql-tests/inputs/ansi/conditional-functions.sql:
##########
@@ -1,6 +1,41 @@
-- Tests for conditional functions
-CREATE TABLE t USING PARQUET AS SELECT c1, c2 FROM VALUES(1, 0),(2, 1) AS
t(c1, c2);
+--SET spark.sql.maxMetadataStringLength = 500
+
+CREATE TABLE t USING PARQUET AS SELECT c1, c2 FROM VALUES(1d, 0),(2d,
1),(null, 1),(CAST('NaN' AS DOUBLE), 0) AS t(c1, c2);
SELECT nanvl(c1, c1/c2 + c1/c2) FROM t;
+-- do not fail at compile side
+EXPLAIN SELECT nanvl(c1, c1/c2 + c1/c2) FROM t;
+
+SELECT nanvl(c2, c1/c2 + c1/c2) FROM t;
+SELECT nanvl(c1, 1/0) FROM t;
+SELECT nanvl(1-0, 1/0) FROM t;
+SELECT nanvl(1/0, 1/0) FROM t;
Review Comment:
let's only test the cases that do not fail without constant folding, and
fails with constant folding before this PR.
For more detailed test, please put it in `ConstantFoldingSuite`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]