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

dongjoon 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 eeaf185  [SPARK-28617][SQL][TEST] Fix misplacement when comment is at 
the end of the query
eeaf185 is described below

commit eeaf1851b2eced82afad10eb731f0ecebf22c6e3
Author: Yuming Wang <yumw...@ebay.com>
AuthorDate: Wed Aug 7 16:45:23 2019 -0700

    [SPARK-28617][SQL][TEST] Fix misplacement when comment is at the end of the 
query
    
    ## What changes were proposed in this pull request?
    
    This PR fixes the issue of misplacement when the comment at the end of the 
query. Example:
    Comment for ` SELECT date '5874898-01-01'`:
    
https://github.com/apache/spark/blob/2d74f14d74e7b24109f347822600ebf9819b04c1/sql/core/src/test/resources/sql-tests/inputs/pgSQL/date.sql#L200
    But the golden file is:
    
https://github.com/apache/spark/blob/a5a5da78cfbb1b439c139fd2ffd5744fc60ebafe/sql/core/src/test/resources/sql-tests/results/pgSQL/date.sql.out#L484-L507
    
    After this PR:
    
https://github.com/apache/spark/blob/eeb7405ad0c7cc1004e2cad36929d20d95ab2726/sql/core/src/test/resources/sql-tests/results/pgSQL/date.sql.out#L482-L501
    
    ## How was this patch tested?
    
    N/A
    
    Closes #25357 from wangyum/SPARK-28617.
    
    Authored-by: Yuming Wang <yumw...@ebay.com>
    Signed-off-by: Dongjoon Hyun <dh...@apple.com>
---
 .../results/pgSQL/aggregates_part2.sql.out         |  6 ----
 .../sql-tests/results/pgSQL/boolean.sql.out        |  3 --
 .../resources/sql-tests/results/pgSQL/date.sql.out |  8 +----
 .../resources/sql-tests/results/pgSQL/join.sql.out | 42 +++-------------------
 .../sql-tests/results/pgSQL/select.sql.out         |  1 -
 .../resources/sql-tests/results/pgSQL/with.sql.out |  5 +--
 .../not-in-unit-tests-multi-column-literal.sql.out |  6 ----
 .../not-in-unit-tests-multi-column.sql.out         | 14 --------
 ...not-in-unit-tests-single-column-literal.sql.out | 12 -------
 .../not-in-unit-tests-single-column.sql.out        | 18 ----------
 .../results/udf/pgSQL/udf-aggregates_part2.sql.out |  6 ----
 .../sql-tests/results/udf/udf-udaf.sql.out         |  2 --
 .../org/apache/spark/sql/SQLQueryTestSuite.scala   |  4 ++-
 13 files changed, 10 insertions(+), 117 deletions(-)

diff --git 
a/sql/core/src/test/resources/sql-tests/results/pgSQL/aggregates_part2.sql.out 
b/sql/core/src/test/resources/sql-tests/results/pgSQL/aggregates_part2.sql.out
index 2606d2e..2b5371a 100644
--- 
a/sql/core/src/test/resources/sql-tests/results/pgSQL/aggregates_part2.sql.out
+++ 
b/sql/core/src/test/resources/sql-tests/results/pgSQL/aggregates_part2.sql.out
@@ -18,14 +18,11 @@ struct<>
 
 -- !query 1
 SELECT
-  -- boolean and transitions
-  -- null because strict
   (NULL AND NULL) IS NULL AS `t`,
   (TRUE AND NULL) IS NULL AS `t`,
   (FALSE AND NULL) IS NULL AS `t`,
   (NULL AND TRUE) IS NULL AS `t`,
   (NULL AND FALSE) IS NULL AS `t`,
-  -- and actual computations
   (TRUE AND TRUE) AS `t`,
   NOT (TRUE AND FALSE) AS `t`,
   NOT (FALSE AND TRUE) AS `t`,
@@ -38,14 +35,11 @@ true        true    false   true    false   true    true    
true    true
 
 -- !query 2
 SELECT
-  -- boolean or transitions
-  -- null because strict
   (NULL OR NULL) IS NULL AS `t`,
   (TRUE OR NULL) IS NULL AS `t`,
   (FALSE OR NULL) IS NULL AS `t`,
   (NULL OR TRUE) IS NULL AS `t`,
   (NULL OR FALSE) IS NULL AS `t`,
-  -- actual computations
   (TRUE OR TRUE) AS `t`,
   (TRUE OR FALSE) AS `t`,
   (FALSE OR TRUE) AS `t`,
diff --git 
a/sql/core/src/test/resources/sql-tests/results/pgSQL/boolean.sql.out 
b/sql/core/src/test/resources/sql-tests/results/pgSQL/boolean.sql.out
index 3327546..c7903c8 100644
--- a/sql/core/src/test/resources/sql-tests/results/pgSQL/boolean.sql.out
+++ b/sql/core/src/test/resources/sql-tests/results/pgSQL/boolean.sql.out
@@ -316,7 +316,6 @@ NULL
 
 
 -- !query 39
--- error
 SELECT boolean(string('')) AS invalid
 -- !query 39 schema
 struct<invalid:boolean>
@@ -325,8 +324,6 @@ NULL
 
 
 -- !query 40
--- error
-
 CREATE TABLE BOOLTBL1 (f1 boolean) USING parquet
 -- !query 40 schema
 struct<>
diff --git a/sql/core/src/test/resources/sql-tests/results/pgSQL/date.sql.out 
b/sql/core/src/test/resources/sql-tests/results/pgSQL/date.sql.out
index 3f45c38..46101eb 100644
--- a/sql/core/src/test/resources/sql-tests/results/pgSQL/date.sql.out
+++ b/sql/core/src/test/resources/sql-tests/results/pgSQL/date.sql.out
@@ -452,17 +452,15 @@ struct<DATE '4714-11-23':date>
 
 
 -- !query 44
--- out of range
 SELECT date '5874897-12-31'
 -- !query 44 schema
 struct<>
 -- !query 44 output
 org.apache.spark.sql.catalyst.parser.ParseException
 
-Cannot parse the DATE value: 5874897-12-31(line 2, pos 7)
+Cannot parse the DATE value: 5874897-12-31(line 1, pos 7)
 
 == SQL ==
--- out of range
 SELECT date '5874897-12-31'
 -------^^^
 
@@ -482,10 +480,6 @@ SELECT date '5874898-01-01'
 
 
 -- !query 46
--- out of range
-
-
-
 SELECT f1 - date '2000-01-01' AS `Days From 2K` FROM DATE_TBL
 -- !query 46 schema
 struct<Days From 2K:int>
diff --git a/sql/core/src/test/resources/sql-tests/results/pgSQL/join.sql.out 
b/sql/core/src/test/resources/sql-tests/results/pgSQL/join.sql.out
index 0730066..f75fe05 100644
--- a/sql/core/src/test/resources/sql-tests/results/pgSQL/join.sql.out
+++ b/sql/core/src/test/resources/sql-tests/results/pgSQL/join.sql.out
@@ -3257,18 +3257,16 @@ Reference 'f1' is ambiguous, could be: j.f1, j.f1.; 
line 2 pos 63
 
 
 -- !query 168
--- error
 select * from
   int8_tbl x join (int4_tbl x cross join int4_tbl y) j on q1 = y.f1
 -- !query 168 schema
 struct<>
 -- !query 168 output
 org.apache.spark.sql.AnalysisException
-cannot resolve '`y.f1`' given input columns: [j.f1, j.f1, x.q1, x.q2]; line 3 
pos 63
+cannot resolve '`y.f1`' given input columns: [j.f1, j.f1, x.q1, x.q2]; line 2 
pos 63
 
 
 -- !query 169
--- error
 select * from
   int8_tbl x join (int4_tbl x cross join int4_tbl y(ff)) j on q1 = f1
 -- !query 169 schema
@@ -3278,72 +3276,42 @@ struct<q1:bigint,q2:bigint,f1:int,ff:int>
 
 
 -- !query 170
--- ok
-
-
 select t1.uunique1 from
   tenk1 t1 join tenk2 t2 on t1.two = t2.two
 -- !query 170 schema
 struct<>
 -- !query 170 output
 org.apache.spark.sql.AnalysisException
-cannot resolve '`t1.uunique1`' given input columns: [t1.even, t2.even, 
t1.fivethous, t2.fivethous, t1.four, t2.four, t1.hundred, t2.hundred, t1.odd, 
t2.odd, t1.string4, t2.string4, t1.stringu1, t2.stringu1, t1.stringu2, 
t2.stringu2, t1.ten, t2.ten, t1.tenthous, t2.tenthous, t1.thousand, 
t2.thousand, t1.twenty, t2.twenty, t1.two, t2.two, t1.twothousand, 
t2.twothousand, t1.unique1, t2.unique1, t1.unique2, t2.unique2]; line 4 pos 7
+cannot resolve '`t1.uunique1`' given input columns: [t1.even, t2.even, 
t1.fivethous, t2.fivethous, t1.four, t2.four, t1.hundred, t2.hundred, t1.odd, 
t2.odd, t1.string4, t2.string4, t1.stringu1, t2.stringu1, t1.stringu2, 
t2.stringu2, t1.ten, t2.ten, t1.tenthous, t2.tenthous, t1.thousand, 
t2.thousand, t1.twenty, t2.twenty, t1.two, t2.two, t1.twothousand, 
t2.twothousand, t1.unique1, t2.unique1, t1.unique2, t2.unique2]; line 1 pos 7
 
 
 -- !query 171
--- error, prefer "t1" suggestion
 select t2.uunique1 from
   tenk1 t1 join tenk2 t2 on t1.two = t2.two
 -- !query 171 schema
 struct<>
 -- !query 171 output
 org.apache.spark.sql.AnalysisException
-cannot resolve '`t2.uunique1`' given input columns: [t1.even, t2.even, 
t1.fivethous, t2.fivethous, t1.four, t2.four, t1.hundred, t2.hundred, t1.odd, 
t2.odd, t1.string4, t2.string4, t1.stringu1, t2.stringu1, t1.stringu2, 
t2.stringu2, t1.ten, t2.ten, t1.tenthous, t2.tenthous, t1.thousand, 
t2.thousand, t1.twenty, t2.twenty, t1.two, t2.two, t1.twothousand, 
t2.twothousand, t1.unique1, t2.unique1, t1.unique2, t2.unique2]; line 2 pos 7
+cannot resolve '`t2.uunique1`' given input columns: [t1.even, t2.even, 
t1.fivethous, t2.fivethous, t1.four, t2.four, t1.hundred, t2.hundred, t1.odd, 
t2.odd, t1.string4, t2.string4, t1.stringu1, t2.stringu1, t1.stringu2, 
t2.stringu2, t1.ten, t2.ten, t1.tenthous, t2.tenthous, t1.thousand, 
t2.thousand, t1.twenty, t2.twenty, t1.two, t2.two, t1.twothousand, 
t2.twothousand, t1.unique1, t2.unique1, t1.unique2, t2.unique2]; line 1 pos 7
 
 
 -- !query 172
--- error, prefer "t2" suggestion
 select uunique1 from
   tenk1 t1 join tenk2 t2 on t1.two = t2.two
 -- !query 172 schema
 struct<>
 -- !query 172 output
 org.apache.spark.sql.AnalysisException
-cannot resolve '`uunique1`' given input columns: [t1.even, t2.even, 
t1.fivethous, t2.fivethous, t1.four, t2.four, t1.hundred, t2.hundred, t1.odd, 
t2.odd, t1.string4, t2.string4, t1.stringu1, t2.stringu1, t1.stringu2, 
t2.stringu2, t1.ten, t2.ten, t1.tenthous, t2.tenthous, t1.thousand, 
t2.thousand, t1.twenty, t2.twenty, t1.two, t2.two, t1.twothousand, 
t2.twothousand, t1.unique1, t2.unique1, t1.unique2, t2.unique2]; line 2 pos 7
+cannot resolve '`uunique1`' given input columns: [t1.even, t2.even, 
t1.fivethous, t2.fivethous, t1.four, t2.four, t1.hundred, t2.hundred, t1.odd, 
t2.odd, t1.string4, t2.string4, t1.stringu1, t2.stringu1, t1.stringu2, 
t2.stringu2, t1.ten, t2.ten, t1.tenthous, t2.tenthous, t1.thousand, 
t2.thousand, t1.twenty, t2.twenty, t1.two, t2.two, t1.twothousand, 
t2.twothousand, t1.unique1, t2.unique1, t1.unique2, t2.unique2]; line 1 pos 7
 
 
 -- !query 173
--- error, suggest both at once
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
 select f1,g from int4_tbl a, (select f1 as g) ss
 -- !query 173 schema
 struct<>
 -- !query 173 output
 org.apache.spark.sql.AnalysisException
-cannot resolve '`f1`' given input columns: []; line 26 pos 37
+cannot resolve '`f1`' given input columns: []; line 1 pos 37
 
 
 -- !query 174
diff --git a/sql/core/src/test/resources/sql-tests/results/pgSQL/select.sql.out 
b/sql/core/src/test/resources/sql-tests/results/pgSQL/select.sql.out
index 797f808..e54de1d 100644
--- a/sql/core/src/test/resources/sql-tests/results/pgSQL/select.sql.out
+++ b/sql/core/src/test/resources/sql-tests/results/pgSQL/select.sql.out
@@ -399,7 +399,6 @@ NULL
 
 
 -- !query 22
--- same thing
 SELECT * FROM foo ORDER BY f1 NULLS FIRST
 -- !query 22 schema
 struct<f1:int>
diff --git a/sql/core/src/test/resources/sql-tests/results/pgSQL/with.sql.out 
b/sql/core/src/test/resources/sql-tests/results/pgSQL/with.sql.out
index 366b65f..91b0ff2 100644
--- a/sql/core/src/test/resources/sql-tests/results/pgSQL/with.sql.out
+++ b/sql/core/src/test/resources/sql-tests/results/pgSQL/with.sql.out
@@ -358,23 +358,20 @@ create table foo (with baz)
 
 
 -- !query 38
--- fail, WITH is a reserved word
 create table foo (with ordinality)
 -- !query 38 schema
 struct<>
 -- !query 38 output
 org.apache.spark.sql.catalyst.parser.ParseException
 
-no viable alternative at input 'with'(line 2, pos 18)
+no viable alternative at input 'with'(line 1, pos 18)
 
 == SQL ==
--- fail, WITH is a reserved word
 create table foo (with ordinality)
 ------------------^^^
 
 
 -- !query 39
--- fail, WITH is a reserved word
 with ordinality as (select 1 as x) select * from ordinality
 -- !query 39 schema
 struct<x:int>
diff --git 
a/sql/core/src/test/resources/sql-tests/results/subquery/in-subquery/not-in-unit-tests-multi-column-literal.sql.out
 
b/sql/core/src/test/resources/sql-tests/results/subquery/in-subquery/not-in-unit-tests-multi-column-literal.sql.out
index a16e98a..f02f760 100644
--- 
a/sql/core/src/test/resources/sql-tests/results/subquery/in-subquery/not-in-unit-tests-multi-column-literal.sql.out
+++ 
b/sql/core/src/test/resources/sql-tests/results/subquery/in-subquery/not-in-unit-tests-multi-column-literal.sql.out
@@ -16,8 +16,6 @@ struct<>
 
 
 -- !query 1
--- Case 5
-  -- (one null column with no match -> row is returned)
 SELECT *
 FROM   m
 WHERE  b = 1.0 -- Matches (null, 1.0)
@@ -29,8 +27,6 @@ NULL  1
 
 
 -- !query 2
--- Case 6
-  -- (no null columns with match -> row not returned)
 SELECT *
 FROM   m
 WHERE  b = 3.0 -- Matches (2, 3.0)
@@ -42,8 +38,6 @@ struct<a:int,b:decimal(2,1)>
 
 
 -- !query 3
--- Case 7
-  -- (no null columns with no match -> row is returned)
 SELECT *
 FROM   m
 WHERE  b = 5.0 -- Matches (4, 5.0)
diff --git 
a/sql/core/src/test/resources/sql-tests/results/subquery/in-subquery/not-in-unit-tests-multi-column.sql.out
 
b/sql/core/src/test/resources/sql-tests/results/subquery/in-subquery/not-in-unit-tests-multi-column.sql.out
index aa5f64b..a27a66e 100644
--- 
a/sql/core/src/test/resources/sql-tests/results/subquery/in-subquery/not-in-unit-tests-multi-column.sql.out
+++ 
b/sql/core/src/test/resources/sql-tests/results/subquery/in-subquery/not-in-unit-tests-multi-column.sql.out
@@ -29,8 +29,6 @@ struct<>
 
 
 -- !query 2
--- Case 1
-  -- (subquery is empty -> row is returned)
 SELECT *
 FROM   m
 WHERE  (a, b) NOT IN (SELECT *
@@ -46,8 +44,6 @@ NULL  NULL
 
 
 -- !query 3
--- Case 2
-  -- (subquery contains a row with null in all columns -> row not returned)
 SELECT *
 FROM   m
 WHERE  (a, b) NOT IN (SELECT *
@@ -60,8 +56,6 @@ struct<a:int,b:decimal(2,1)>
 
 
 -- !query 4
--- Case 3
-  -- (probe-side columns are all null -> row not returned)
 SELECT *
 FROM   m
 WHERE  a IS NULL AND b IS NULL -- Matches only (null, null)
@@ -75,8 +69,6 @@ struct<a:int,b:decimal(2,1)>
 
 
 -- !query 5
--- Case 4
-  -- (one column null, other column matches a row in the subquery result -> 
row not returned)
 SELECT *
 FROM   m
 WHERE  b = 1.0 -- Matches (null, 1.0)
@@ -90,8 +82,6 @@ struct<a:int,b:decimal(2,1)>
 
 
 -- !query 6
--- Case 5
-  -- (one null column with no match -> row is returned)
 SELECT *
 FROM   m
 WHERE  b = 1.0 -- Matches (null, 1.0)
@@ -105,8 +95,6 @@ NULL 1
 
 
 -- !query 7
--- Case 6
-  -- (no null columns with match -> row not returned)
 SELECT *
 FROM   m
 WHERE  b = 3.0 -- Matches (2, 3.0)
@@ -120,8 +108,6 @@ struct<a:int,b:decimal(2,1)>
 
 
 -- !query 8
--- Case 7
-  -- (no null columns with no match -> row is returned)
 SELECT *
 FROM   m
 WHERE  b = 5.0 -- Matches (4, 5.0)
diff --git 
a/sql/core/src/test/resources/sql-tests/results/subquery/in-subquery/not-in-unit-tests-single-column-literal.sql.out
 
b/sql/core/src/test/resources/sql-tests/results/subquery/in-subquery/not-in-unit-tests-single-column-literal.sql.out
index 446447e..cf8f03e 100644
--- 
a/sql/core/src/test/resources/sql-tests/results/subquery/in-subquery/not-in-unit-tests-single-column-literal.sql.out
+++ 
b/sql/core/src/test/resources/sql-tests/results/subquery/in-subquery/not-in-unit-tests-single-column-literal.sql.out
@@ -15,12 +15,6 @@ struct<>
 
 
 -- !query 1
--- Uncorrelated NOT IN Subquery test cases
-  -- Case 1 (not possible to write a literal with no rows, so we ignore it.)
-  -- (empty subquery -> all rows returned)
-
-  -- Case 2
-  -- (subquery includes null -> no rows returned)
 SELECT *
 FROM   m
 WHERE  a NOT IN (null)
@@ -31,8 +25,6 @@ struct<a:int,b:decimal(2,1)>
 
 
 -- !query 2
--- Case 3
-  -- (probe column is null -> row not returned)
 SELECT *
 FROM   m
 WHERE  b = 1.0 -- Only matches (null, 1.0)
@@ -44,8 +36,6 @@ struct<a:int,b:decimal(2,1)>
 
 
 -- !query 3
--- Case 4
-  -- (probe column matches subquery row -> row not returned)
 SELECT *
 FROM   m
 WHERE  b = 3.0 -- Only matches (2, 3.0)
@@ -57,8 +47,6 @@ struct<a:int,b:decimal(2,1)>
 
 
 -- !query 4
--- Case 5
-  -- (probe column does not match subquery row -> row is returned)
 SELECT *
 FROM   m
 WHERE  b = 3.0 -- Only matches (2, 3.0)
diff --git 
a/sql/core/src/test/resources/sql-tests/results/subquery/in-subquery/not-in-unit-tests-single-column.sql.out
 
b/sql/core/src/test/resources/sql-tests/results/subquery/in-subquery/not-in-unit-tests-single-column.sql.out
index f58ebea..d07981c 100644
--- 
a/sql/core/src/test/resources/sql-tests/results/subquery/in-subquery/not-in-unit-tests-single-column.sql.out
+++ 
b/sql/core/src/test/resources/sql-tests/results/subquery/in-subquery/not-in-unit-tests-single-column.sql.out
@@ -27,9 +27,6 @@ struct<>
 
 
 -- !query 2
--- Uncorrelated NOT IN Subquery test cases
-  -- Case 1
-  -- (empty subquery -> all rows returned)
 SELECT *
 FROM   m
 WHERE  a NOT IN (SELECT c
@@ -44,8 +41,6 @@ NULL  1
 
 
 -- !query 3
--- Case 2
-  -- (subquery includes null -> no rows returned)
 SELECT *
 FROM   m
 WHERE  a NOT IN (SELECT c
@@ -58,8 +53,6 @@ struct<a:int,b:decimal(2,1)>
 
 
 -- !query 4
--- Case 3
-  -- (probe column is null -> row not returned)
 SELECT *
 FROM   m
 WHERE  b = 1.0 -- Only matches (null, 1.0)
@@ -73,8 +66,6 @@ struct<a:int,b:decimal(2,1)>
 
 
 -- !query 5
--- Case 4
-  -- (probe column matches subquery row -> row not returned)
 SELECT *
 FROM   m
 WHERE  b = 3.0 -- Only matches (2, 3.0)
@@ -88,8 +79,6 @@ struct<a:int,b:decimal(2,1)>
 
 
 -- !query 6
--- Case 5
-  -- (probe column does not match subquery row -> row is returned)
 SELECT *
 FROM   m
 WHERE  b = 3.0 -- Only matches (2, 3.0)
@@ -103,9 +92,6 @@ struct<a:int,b:decimal(2,1)>
 
 
 -- !query 7
--- Correlated NOT IN subquery test cases
-  -- Case 2->1
-  -- (subquery had nulls but they are removed by correlated subquery -> all 
rows returned)
 SELECT *
 FROM   m
 WHERE a NOT IN (SELECT c
@@ -120,8 +106,6 @@ NULL        1
 
 
 -- !query 8
--- Case 3->1
-  -- (probe column is null but subquery returns no rows -> row is returned)
 SELECT *
 FROM   m
 WHERE  b = 1.0 -- Only matches (null, 1.0)
@@ -135,8 +119,6 @@ NULL        1
 
 
 -- !query 9
--- Case 4->1
-  -- (probe column matches row which is filtered out by correlated subquery -> 
row is returned)
 SELECT *
 FROM   m
 WHERE  b = 3.0 -- Only matches (2, 3.0)
diff --git 
a/sql/core/src/test/resources/sql-tests/results/udf/pgSQL/udf-aggregates_part2.sql.out
 
b/sql/core/src/test/resources/sql-tests/results/udf/pgSQL/udf-aggregates_part2.sql.out
index 9fe9438..ad2f1bd 100644
--- 
a/sql/core/src/test/resources/sql-tests/results/udf/pgSQL/udf-aggregates_part2.sql.out
+++ 
b/sql/core/src/test/resources/sql-tests/results/udf/pgSQL/udf-aggregates_part2.sql.out
@@ -18,14 +18,11 @@ struct<>
 
 -- !query 1
 SELECT
-  -- boolean and transitions
-  -- null because strict
   (NULL AND NULL) IS NULL AS `t`,
   (TRUE AND NULL) IS NULL AS `t`,
   (FALSE AND NULL) IS NULL AS `t`,
   (NULL AND TRUE) IS NULL AS `t`,
   (NULL AND FALSE) IS NULL AS `t`,
-  -- and actual computations
   (TRUE AND TRUE) AS `t`,
   NOT (TRUE AND FALSE) AS `t`,
   NOT (FALSE AND TRUE) AS `t`,
@@ -38,14 +35,11 @@ true        true    false   true    false   true    true    
true    true
 
 -- !query 2
 SELECT
-  -- boolean or transitions
-  -- null because strict
   (NULL OR NULL) IS NULL AS `t`,
   (TRUE OR NULL) IS NULL AS `t`,
   (FALSE OR NULL) IS NULL AS `t`,
   (NULL OR TRUE) IS NULL AS `t`,
   (NULL OR FALSE) IS NULL AS `t`,
-  -- actual computations
   (TRUE OR TRUE) AS `t`,
   (TRUE OR FALSE) AS `t`,
   (FALSE OR TRUE) AS `t`,
diff --git a/sql/core/src/test/resources/sql-tests/results/udf/udf-udaf.sql.out 
b/sql/core/src/test/resources/sql-tests/results/udf/udf-udaf.sql.out
index e1747f4..f8e5fe6 100644
--- a/sql/core/src/test/resources/sql-tests/results/udf/udf-udaf.sql.out
+++ b/sql/core/src/test/resources/sql-tests/results/udf/udf-udaf.sql.out
@@ -3,8 +3,6 @@
 
 
 -- !query 0
--- This test file was converted from udaf.sql.
-
 CREATE OR REPLACE TEMPORARY VIEW t1 AS SELECT * FROM VALUES
 (1), (2), (3), (4)
 as t1(int_col1)
diff --git 
a/sql/core/src/test/scala/org/apache/spark/sql/SQLQueryTestSuite.scala 
b/sql/core/src/test/scala/org/apache/spark/sql/SQLQueryTestSuite.scala
index c6fc848..4bdf250 100644
--- a/sql/core/src/test/scala/org/apache/spark/sql/SQLQueryTestSuite.scala
+++ b/sql/core/src/test/scala/org/apache/spark/sql/SQLQueryTestSuite.scala
@@ -225,11 +225,13 @@ class SQLQueryTestSuite extends QueryTest with 
SharedSQLContext {
   private def runTest(testCase: TestCase): Unit = {
     val input = fileToString(new File(testCase.inputFile))
 
-    val (comments, code) = input.split("\n").partition(_.startsWith("--"))
+    val (comments, code) = input.split("\n").partition(_.trim.startsWith("--"))
 
     // List of SQL queries to run
     // note: this is not a robust way to split queries using semicolon, but 
works for now.
     val queries = 
code.mkString("\n").split("(?<=[^\\\\]);").map(_.trim).filter(_ != "").toSeq
+      // Fix misplacement when comment is at the end of the query.
+      
.map(_.split("\n").filterNot(_.startsWith("--")).mkString("\n")).map(_.trim).filter(_
 != "")
 
     // When we are regenerating the golden files, we don't need to set any 
config as they
     // all need to return the same result


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org
For additional commands, e-mail: commits-h...@spark.apache.org

Reply via email to