Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions sql/core/src/test/resources/sql-tests/inputs/group-by.sql
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,3 @@ SELECT every("true");
SELECT k, v, every(v) OVER (PARTITION BY k ORDER BY v) FROM test_agg;
SELECT k, v, some(v) OVER (PARTITION BY k ORDER BY v) FROM test_agg;
SELECT k, v, any(v) OVER (PARTITION BY k ORDER BY v) FROM test_agg;

-- simple explain of queries having every/some/any agregates. Optimized
-- plan should show the rewritten aggregate expression.
EXPLAIN EXTENDED SELECT k, every(v), some(v), any(v) FROM test_agg GROUP BY k;

3 changes: 0 additions & 3 deletions sql/core/src/test/resources/sql-tests/inputs/inline-table.sql
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,3 @@ select * from values ("one", count(1)), ("two", 2) as data(a, b);

-- string to timestamp
select * from values (timestamp('1991-12-06 00:00:00.0'), array(timestamp('1991-12-06 01:00:00.0'), timestamp('1991-12-06 12:00:00.0'))) as data(a, b);

-- cross-join inline tables
EXPLAIN EXTENDED SELECT * FROM VALUES ('one', 1), ('three', null) CROSS JOIN VALUES ('one', 1), ('three', null);
21 changes: 0 additions & 21 deletions sql/core/src/test/resources/sql-tests/inputs/operators.sql
Original file line number Diff line number Diff line change
Expand Up @@ -29,27 +29,6 @@ select 2 * 5;
select 5 % 3;
select pmod(-7, 3);

-- check operator precedence.
-- We follow Oracle operator precedence in the table below that lists the levels of precedence
-- among SQL operators from high to low:
------------------------------------------------------------------------------------------
-- Operator Operation
------------------------------------------------------------------------------------------
-- +, - identity, negation
-- *, / multiplication, division
-- +, -, || addition, subtraction, concatenation
-- =, !=, <, >, <=, >=, IS NULL, LIKE, BETWEEN, IN comparison
-- NOT exponentiation, logical negation
-- AND conjunction
-- OR disjunction
------------------------------------------------------------------------------------------
explain select 'a' || 1 + 2;
explain select 1 - 2 || 'b';
explain select 2 * 4 + 3 || 'b';
explain select 3 + 1 || 'a' || 4 / 2;
explain select 1 == 1 OR 'a' || 'b' == 'ab';
explain select 'a' || 'c' == 'ac' AND 2 == 3;

-- math functions
select cot(1);
select cot(null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@ SELECT nullif(1, 2.1d), nullif(1, 1.0d);
SELECT nvl(1, 2.1d), nvl(null, 2.1d);
SELECT nvl2(null, 1, 2.1d), nvl2('n', 1, 2.1d);

-- explain for these functions; use range to avoid constant folding
explain extended
select ifnull(id, 'x'), nullif(id, 'x'), nvl(id, 'x'), nvl2(id, 'x', 'y')
from range(2);

-- SPARK-16730 cast alias functions for Hive compatibility
SELECT boolean(1), tinyint(1), smallint(1), int(1), bigint(1);
SELECT float(1), double(1), decimal(1);
Expand Down
27 changes: 0 additions & 27 deletions sql/core/src/test/resources/sql-tests/inputs/string-functions.sql
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ select format_string();
-- A pipe operator for string concatenation
select 'a' || 'b' || 'c';

-- Check if catalyst combine nested `Concat`s
EXPLAIN EXTENDED SELECT (col1 || col2 || col3 || col4) col
FROM (SELECT id col1, id col2, id col3, id col4 FROM range(10));

-- replace function
select replace('abc', 'b', '123');
select replace('abc', 'b');
Expand All @@ -25,29 +21,6 @@ select left(null, -2), left("abcd", -2), left("abcd", 0), left("abcd", 'a');
select right("abcd", 2), right("abcd", 5), right("abcd", '2'), right("abcd", null);
select right(null, -2), right("abcd", -2), right("abcd", 0), right("abcd", 'a');

-- turn off concatBinaryAsString
set spark.sql.function.concatBinaryAsString=false;

-- Check if catalyst combine nested `Concat`s if concatBinaryAsString=false
EXPLAIN SELECT ((col1 || col2) || (col3 || col4)) col
FROM (
SELECT
string(id) col1,
string(id + 1) col2,
encode(string(id + 2), 'utf-8') col3,
encode(string(id + 3), 'utf-8') col4
FROM range(10)
);

EXPLAIN SELECT (col1 || (col3 || col4)) col
FROM (
SELECT
string(id) col1,
encode(string(id + 2), 'utf-8') col3,
encode(string(id + 3), 'utf-8') col4
FROM range(10)
);

-- split function
SELECT split('aa1cc2ee3', '[1-9]+');
SELECT split('aa1cc2ee3', '[1-9]+', 2);
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,3 @@ select * from range(1, null);

-- range call with a mixed-case function name
select * from RaNgE(2);

-- Explain
EXPLAIN select * from RaNgE(2);

-- cross-join table valued functions
EXPLAIN EXTENDED SELECT * FROM range(3) CROSS JOIN range(3);
30 changes: 1 addition & 29 deletions sql/core/src/test/resources/sql-tests/results/group-by.sql.out
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
-- Automatically generated by SQLQueryTestSuite
-- Number of queries: 47
-- Number of queries: 46


-- !query 0
Expand Down Expand Up @@ -459,31 +459,3 @@ struct<k:int,v:boolean,any(v) OVER (PARTITION BY k ORDER BY v ASC NULLS FIRST RA
5 NULL NULL
5 false false
5 true true


-- !query 46
EXPLAIN EXTENDED SELECT k, every(v), some(v), any(v) FROM test_agg GROUP BY k
-- !query 46 schema
struct<plan:string>
-- !query 46 output
== Parsed Logical Plan ==
'Aggregate ['k], ['k, unresolvedalias('every('v), None), unresolvedalias('some('v), None), unresolvedalias('any('v), None)]
+- 'UnresolvedRelation `test_agg`

== Analyzed Logical Plan ==
k: int, every(v): boolean, some(v): boolean, any(v): boolean
Aggregate [k#x], [k#x, every(v#x) AS every(v)#x, some(v#x) AS some(v)#x, any(v#x) AS any(v)#x]
+- SubqueryAlias `test_agg`
+- Project [k#x, v#x]
+- SubqueryAlias `test_agg`
+- LocalRelation [k#x, v#x]

== Optimized Logical Plan ==
Aggregate [k#x], [k#x, min(v#x) AS every(v)#x, max(v#x) AS some(v)#x, max(v#x) AS any(v)#x]
+- LocalRelation [k#x, v#x]

== Physical Plan ==
*HashAggregate(keys=[k#x], functions=[min(v#x), max(v#x)], output=[k#x, every(v)#x, some(v)#x, any(v)#x])
+- Exchange hashpartitioning(k#x, 200)
+- *HashAggregate(keys=[k#x], functions=[partial_min(v#x), partial_max(v#x)], output=[k#x, min#x, max#x])
+- LocalTableScan [k#x, v#x]
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
-- Automatically generated by SQLQueryTestSuite
-- Number of queries: 18
-- Number of queries: 17


-- !query 0
Expand Down Expand Up @@ -151,33 +151,3 @@ select * from values (timestamp('1991-12-06 00:00:00.0'), array(timestamp('1991-
struct<a:timestamp,b:array<timestamp>>
-- !query 16 output
1991-12-06 00:00:00 [1991-12-06 01:00:00.0,1991-12-06 12:00:00.0]


-- !query 17
EXPLAIN EXTENDED SELECT * FROM VALUES ('one', 1), ('three', null) CROSS JOIN VALUES ('one', 1), ('three', null)
-- !query 17 schema
struct<plan:string>
-- !query 17 output
== Parsed Logical Plan ==
'Project [*]
+- 'Join Cross
:- 'UnresolvedInlineTable [col1, col2], [List(one, 1), List(three, null)]
+- 'UnresolvedInlineTable [col1, col2], [List(one, 1), List(three, null)]

== Analyzed Logical Plan ==
col1: string, col2: int, col1: string, col2: int
Project [col1#x, col2#x, col1#x, col2#x]
+- Join Cross
:- LocalRelation [col1#x, col2#x]
+- LocalRelation [col1#x, col2#x]

== Optimized Logical Plan ==
Join Cross
:- LocalRelation [col1#x, col2#x]
+- LocalRelation [col1#x, col2#x]

== Physical Plan ==
BroadcastNestedLoopJoin BuildRight, Cross
:- LocalTableScan [col1#x, col2#x]
+- BroadcastExchange IdentityBroadcastMode
+- LocalTableScan [col1#x, col2#x]
Loading