Skip to content

Apache DataFusion SQL Query Engine

Convert escaped error checks to plain text in five sqllogictest files (#27264)

Ian Tang64c29642d1b5
diff --git a/datafusion/sqllogictest/test_files/explain.slt b/datafusion/sqllogictest/test_files/explain.slt
index 9b0984c129..2ad699a04e 100644
--- a/datafusion/sqllogictest/test_files/explain.slt
+++ b/datafusion/sqllogictest/test_files/explain.slt
@@ -606,8 +606,11 @@ physical_plan
07)└───────────────────────────┘
# number is not a valid format
-query error DataFusion error: SQL error: ParserError\("Expected: an explain format such as TREE, found: 123 at Line: 1, Column: 16"\)
+query error
explain format 123 select * from values (1);
+----
+DataFusion error: SQL error: ParserError("Expected: an explain format such as TREE, found: 123 at Line: 1, Column: 16")
+
# verbose tree mode not supported
query error DataFusion error: Error during planning: EXPLAIN VERBOSE with FORMAT is not supported
@@ -726,11 +729,17 @@ statement ok
set datafusion.explain.format = "indent";
# no such thing as json mode
-query error DataFusion error: Invalid or Unsupported Configuration: Invalid explain format\. Expected 'indent', 'tree', 'pgjson' or 'graphviz'\. Got 'json'
+query error
explain format json select * from values (1);
+----
+DataFusion error: Invalid or Unsupported Configuration: Invalid explain format. Expected 'indent', 'tree', 'pgjson' or 'graphviz'. Got 'json'
+
-query error DataFusion error: Invalid or Unsupported Configuration: Invalid explain format\. Expected 'indent', 'tree', 'pgjson' or 'graphviz'\. Got 'foo'
+query error
explain format foo select * from values (1);
+----
+DataFusion error: Invalid or Unsupported Configuration: Invalid explain format. Expected 'indent', 'tree', 'pgjson' or 'graphviz'. Got 'foo'
+
# pgjson mode
query TT
@@ -905,8 +914,11 @@ statement error DataFusion error: Error during planning: expected boolean for EX
EXPLAIN (COSTS maybe) SELECT 1;
# Unrecognized argument for a string/ident option.
-statement error DataFusion error: Invalid or Unsupported Configuration: Invalid explain format\. Expected 'indent', 'tree', 'pgjson' or 'graphviz'\. Got 'bogus'
+statement error
EXPLAIN (FORMAT bogus) SELECT 1;
+----
+DataFusion error: Invalid or Unsupported Configuration: Invalid explain format. Expected 'indent', 'tree', 'pgjson' or 'graphviz'. Got 'bogus'
+
# Legacy keyword form still works on PostgreSQL dialect.
query TT
diff --git a/datafusion/sqllogictest/test_files/joins.slt b/datafusion/sqllogictest/test_files/joins.slt
index db9d138849..23fef32e66 100644
--- a/datafusion/sqllogictest/test_files/joins.slt
+++ b/datafusion/sqllogictest/test_files/joins.slt
@@ -2703,8 +2703,11 @@ SELECT t1.c1, t2.c2 FROM test_partition_table t1 JOIN test_partition_table t2 US
0 10
# left_join_using_qualified (snowflake syntax)
-query error DataFusion error: This feature is not implemented: Invalid identifier in USING clause\. Expected single identifier, got t2\.c2
+query error
SELECT t1.c1, t2.c2 FROM test_partition_table t1 JOIN test_partition_table t2 USING (t2.c2) ORDER BY t2.c2;
+----
+DataFusion error: This feature is not implemented: Invalid identifier in USING clause. Expected single identifier, got t2.c2
+
# left_join_using_join_key_projection
query III
@@ -4183,8 +4186,11 @@ physical_plan_error This feature is not implemented: Physical plan does not supp
# Test CROSS JOIN LATERAL syntax (execution)
# TODO: https://github.com/apache/datafusion/issues/10048
-query error DataFusion error: This feature is not implemented: Physical plan does not support logical expression OuterReferenceColumn\(Field \{ name: "t1_int", data_type: UInt32, nullable: true \}, Column \{ relation: Some\(Bare \{ table: "t1" \}\), name: "t1_int" \}\)
+query error
select t1_id, t1_name, i from join_t1 t1 cross join lateral (select * from unnest(generate_series(1, t1_int))) as series(i);
+----
+DataFusion error: This feature is not implemented: Physical plan does not support logical expression OuterReferenceColumn(Field { name: "t1_int", data_type: UInt32, nullable: true }, Column { relation: Some(Bare { table: "t1" }), name: "t1_int" })
+
# Test INNER JOIN LATERAL syntax (planning)
@@ -4207,12 +4213,18 @@ physical_plan_error This feature is not implemented: Physical plan does not supp
# Test INNER JOIN LATERAL syntax (execution)
# TODO: https://github.com/apache/datafusion/issues/10048
-query error DataFusion error: This feature is not implemented: Physical plan does not support logical expression OuterReferenceColumn\(Field \{ name: "t1_int", data_type: UInt32, nullable: true \}, Column \{ relation: Some\(Bare \{ table: "t2" \}\), name: "t1_int" \}\)
+query error
select t1_id, t1_name, i from join_t1 t2 inner join lateral (select * from unnest(generate_series(1, t1_int))) as series(i) on(t1_id > i);
+----
+DataFusion error: This feature is not implemented: Physical plan does not support logical expression OuterReferenceColumn(Field { name: "t1_int", data_type: UInt32, nullable: true }, Column { relation: Some(Bare { table: "t2" }), name: "t1_int" })
+
# Test RIGHT JOIN LATERAL syntax (unsupported)
-query error DataFusion error: This feature is not implemented: LATERAL syntax is not supported for FULL OUTER and RIGHT \[OUTER \| ANTI \| SEMI\] joins
+query error
select t1_id, t1_name, i from join_t1 t1 right join lateral (select * from unnest(generate_series(1, t1_int))) as series(i);
+----
+DataFusion error: This feature is not implemented: LATERAL syntax is not supported for FULL OUTER and RIGHT [OUTER | ANTI | SEMI] joins
+
# Functional dependencies across a join
diff --git a/datafusion/sqllogictest/test_files/order.slt b/datafusion/sqllogictest/test_files/order.slt
index d00b437053..bb93634f5b 100644
--- a/datafusion/sqllogictest/test_files/order.slt
+++ b/datafusion/sqllogictest/test_files/order.slt
@@ -633,12 +633,18 @@ reset datafusion.sql_parser.dialect;
# distinct on a column not in the select list should not work
-statement error DataFusion error: Error during planning: For SELECT DISTINCT, ORDER BY expressions t\.time must appear in select list
+statement error
SELECT DISTINCT value FROM t ORDER BY time;
+----
+DataFusion error: Error during planning: For SELECT DISTINCT, ORDER BY expressions t.time must appear in select list
+
# distinct on an expression of a column not in the select list should not work
-statement error DataFusion error: Error during planning: For SELECT DISTINCT, ORDER BY expressions t\.time must appear in select list
+statement error
SELECT DISTINCT date_trunc('hour', time) FROM t ORDER BY time;
+----
+DataFusion error: Error during planning: For SELECT DISTINCT, ORDER BY expressions t.time must appear in select list
+
# distinct on a column that is in the select list but aliasted should work
query P
@@ -1091,8 +1097,11 @@ CREATE EXTERNAL TABLE dt (a_id integer, a_str string, a_bool boolean) STORED AS
# Create external table with order column expression that can't be planned
# This is currently expected to fail, but should not panic
-query error DataFusion error: Schema error: No field named a\.
+query error
CREATE EXTERNAL TABLE dt STORED AS CSV WITH ORDER (a || b) LOCATION 'file://path/to/table';
+----
+DataFusion error: Schema error: No field named a.
+
# Sort with duplicate sort expressions
diff --git a/datafusion/sqllogictest/test_files/scalar.slt b/datafusion/sqllogictest/test_files/scalar.slt
index b62113febe..1585ba2a29 100644
--- a/datafusion/sqllogictest/test_files/scalar.slt
+++ b/datafusion/sqllogictest/test_files/scalar.slt
@@ -2001,8 +2001,11 @@ NULL NULL
query error Error during planning: Unary operator '-' only supports signed numeric, interval and timestamp types
SELECT -'100'
-query error DataFusion error: Error during planning: Unary operator '\+' only supports numeric, interval and timestamp types
+query error
SELECT +true
+----
+DataFusion error: Error during planning: Unary operator '+' only supports numeric, interval and timestamp types
+
statement ok
drop table test_boolean
diff --git a/datafusion/sqllogictest/test_files/select.slt b/datafusion/sqllogictest/test_files/select.slt
index 86c9ca8e8e..a64fe024bb 100644
--- a/datafusion/sqllogictest/test_files/select.slt
+++ b/datafusion/sqllogictest/test_files/select.slt
@@ -322,14 +322,23 @@ three 1
NULL 1
# select_values_list
-statement error DataFusion error: SQL error: ParserError\("Expected: \(, found: EOF"\)
+statement error
VALUES
+----
+DataFusion error: SQL error: ParserError("Expected: (, found: EOF")
+
-statement error DataFusion error: SQL error: ParserError\("Expected: an expression, found: \) at Line: 1, Column: 9"\)
+statement error
VALUES ()
+----
+DataFusion error: SQL error: ParserError("Expected: an expression, found: ) at Line: 1, Column: 9")
+
-statement error DataFusion error: SQL error: ParserError\("Expected: an expression, found: \) at Line: 1, Column: 13"\)
+statement error
VALUES (1),()
+----
+DataFusion error: SQL error: ParserError("Expected: an expression, found: ) at Line: 1, Column: 13")
+
statement error DataFusion error: Error during planning: Inconsistent data length across values list: got 2 values in row 1 but expected 1
VALUES (1),(1,2)
@@ -505,8 +514,11 @@ select '1' from foo order by column1;
1
# foo distinct order by
-statement error DataFusion error: Error during planning: For SELECT DISTINCT, ORDER BY expressions foo\.column1 must appear in select list
+statement error
select distinct '1' from foo order by column1;
+----
+DataFusion error: Error during planning: For SELECT DISTINCT, ORDER BY expressions foo.column1 must appear in select list
+
# distincts for float nan
query BBBBBBBBBBBBBBBBB
@@ -838,8 +850,11 @@ SELECT ALL * FROM aggregate_simple;
# select distinct all (
-query error DataFusion error: SQL error: ParserError\("Cannot specify DISTINCT then ALL at Line: 1, Column: 8"\)
+query error
SELECT DISTINCT ALL * FROM aggregate_simple
+----
+DataFusion error: SQL error: ParserError("Cannot specify DISTINCT then ALL at Line: 1, Column: 8")
+
# select distinct with projection and order by
query R
@@ -1173,8 +1188,13 @@ SELECT * FROM empty_table
statement ok
CREATE TABLE case_sensitive_table("INT32" int) AS VALUES (1), (2), (3), (4), (5);
-statement error DataFusion error: Schema error: No field named int32\. Did you mean 'case_sensitive_table\."INT32"'\?\nColumn names are case sensitive\. You can use double quotes to refer to the case_sensitive_table\."INT32" column or disable the datafusion\.sql_parser\.enable_ident_normalization configuration\.\nValid fields are case_sensitive_table\."INT32"\.
+statement error
select "int32" from case_sensitive_table
+----
+DataFusion error: Schema error: No field named int32. Did you mean 'case_sensitive_table."INT32"'?
+Column names are case sensitive. You can use double quotes to refer to the case_sensitive_table."INT32" column or disable the datafusion.sql_parser.enable_ident_normalization configuration.
+Valid fields are case_sensitive_table."INT32".
+
query I
select "INT32" from case_sensitive_table;
@@ -1311,27 +1331,39 @@ SELECT * EXCLUDE(a, a)
FROM table1
# if EXCEPT all the columns, query should return an error
-statement error DataFusion error: Error during planning: SELECT list is empty after resolving \* expressions, the wildcard expanded to zero columns
+statement error
SELECT * EXCEPT(a, b, c, d)
FROM table1
+----
+DataFusion error: Error during planning: SELECT list is empty after resolving * expressions, the wildcard expanded to zero columns
+
# try zero column with LIMIT, should error
-statement error DataFusion error: Error during planning: SELECT list is empty after resolving \* expressions, the wildcard expanded to zero columns
+statement error
SELECT * EXCEPT (a, b, c, d)
FROM table1
LIMIT 1
+----
+DataFusion error: Error during planning: SELECT list is empty after resolving * expressions, the wildcard expanded to zero columns
+
# try zero column with GROUP BY, should error
-statement error DataFusion error: Error during planning: SELECT list is empty after resolving \* expressions, the wildcard expanded to zero columns
+statement error
SELECT * EXCEPT (a, b, c, d)
FROM table1
GROUP BY a
+----
+DataFusion error: Error during planning: SELECT list is empty after resolving * expressions, the wildcard expanded to zero columns
+
# try zero column with WHERE, should error
-statement error DataFusion error: Error during planning: SELECT list is empty after resolving \* expressions, the wildcard expanded to zero columns
+statement error
SELECT * EXCEPT (a, b, c, d)
FROM table1
WHERE a = 1
+----
+DataFusion error: Error during planning: SELECT list is empty after resolving * expressions, the wildcard expanded to zero columns
+
# create table2 the same with table1
statement ok
@@ -1345,14 +1377,17 @@ CREATE TABLE table2 (
(2, 20, 200, 2000);
# try zero column with inner JOIN, should error
-statement error DataFusion error: Error during planning: SELECT list is empty after resolving \* expressions, the wildcard expanded to zero columns
+statement error
WITH t1 AS (SELECT a AS t1_a FROM table1), t2 AS (SELECT a AS t2_a FROM table2)
SELECT * EXCEPT (t1_a, t2_a)
FROM t1
JOIN t2 ON (t1_a = t2_a)
+----
+DataFusion error: Error during planning: SELECT list is empty after resolving * expressions, the wildcard expanded to zero columns
+
# try zero column with more JOIN, should error
-statement error DataFusion error: Error during planning: SELECT list is empty after resolving \* expressions, the wildcard expanded to zero columns
+statement error
SELECT * EXCEPT (b1, b2)
FROM (
SELECT b AS b1 FROM table1
@@ -1360,9 +1395,12 @@ FROM (
JOIN (
SELECT b AS b2 FROM table2
) ON b1 = b2
+----
+DataFusion error: Error during planning: SELECT list is empty after resolving * expressions, the wildcard expanded to zero columns
+
# try zero column with Window, should error
-statement error DataFusion error: Error during planning: SELECT list is empty after resolving \* expressions, the wildcard expanded to zero columns
+statement error
SELECT * EXCEPT (a, b, row_num)
FROM (
SELECT
@@ -1371,6 +1409,9 @@ FROM (
ROW_NUMBER() OVER (ORDER BY b) AS row_num
FROM table1
)
+----
+DataFusion error: Error during planning: SELECT list is empty after resolving * expressions, the wildcard expanded to zero columns
+
# EXCLUDE order shouldn't matter
query II
@@ -1814,8 +1855,12 @@ select a + b from (select 1 as a, 2 as b, 1 as "a + b");
3
# Can't reference an output column by expression over projection.
-query error DataFusion error: Schema error: No field named a\.\nValid fields are "a \+ Int64\(1\)"\.
+query error
select a + 1 from (select a+1 from (select 1 as a));
+----
+DataFusion error: Schema error: No field named a.
+Valid fields are "a + Int64(1)".
+
query I
select "a + Int64(1)" + 10 from (select a+1 from (select 1 as a));
@@ -1852,12 +1897,19 @@ statement ok
DROP TABLE test;
# Can't reference an unqualified column by a qualified name
-query error DataFusion error: Schema error: No field named t1\.v1\. Did you mean '"t1\.v1"'\?\nValid fields are "t1\.v1"\.
+query error
SELECT t1.v1 FROM (SELECT 1 AS "t1.v1");
+----
+DataFusion error: Schema error: No field named t1.v1. Did you mean '"t1.v1"'?
+Valid fields are "t1.v1".
+
# Test issue: https://github.com/apache/datafusion/issues/14124
-query error DataFusion error: Arrow error: Arithmetic overflow: Overflow happened on: 10000 \* 100000000000000000000000000000000000
+query error
SELECT ('0.54321543215432154321543215432154321'::DECIMAL(35,35) + 10000)::VARCHAR
+----
+DataFusion error: Arrow error: Arithmetic overflow: Overflow happened on: 10000 * 100000000000000000000000000000000000
+
# where_selection_with_ambiguous_column
statement ok