Skip to content

Commit 1c7b1ca

Browse files
committed
Add reproducer for query metadata error
1 parent f57da83 commit 1c7b1ca

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

datafusion/sqllogictest/test_files/metadata.slt

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,22 @@
2424
## in the test harness as there is no way to define schema
2525
## with metadata in SQL.
2626

27+
query ITTPT
28+
select * from table_with_metadata;
29+
----
30+
1 NULL NULL 2020-09-08T13:42:29.190855123 no_foo
31+
NULL bar l_bar 2020-09-08T13:42:29.190855123 no_bar
32+
3 baz l_baz 2020-09-08T13:42:29.190855123 no_baz
33+
34+
query TTT
35+
describe table_with_metadata;
36+
----
37+
id Int32 YES
38+
name Utf8 YES
39+
l_name Utf8 YES
40+
ts Timestamp(ns) NO
41+
nonnull_name Utf8 NO
42+
2743
query IT
2844
select id, name from table_with_metadata;
2945
----
@@ -235,6 +251,28 @@ order by 1 asc nulls last;
235251
3 1
236252
NULL 1
237253

254+
# reproducer for https://github.com/apache/datafusion/issues/18337
255+
# shoudl not get an internal error
256+
query error
257+
SELECT
258+
'foo' AS name,
259+
COUNT(
260+
CASE
261+
WHEN prev_value = 'no_bar' AND value = 'no_baz' THEN 1
262+
ELSE NULL
263+
END
264+
) AS count_rises
265+
FROM
266+
(
267+
SELECT
268+
nonnull_name as value,
269+
LAG(nonnull_name) OVER (ORDER BY ts) AS prev_value
270+
FROM
271+
table_with_metadata
272+
);
273+
----
274+
DataFusion error: Internal error: Physical input schema should be the same as the one converted from logical input schema. Differences: .
275+
This issue was likely caused by a bug in DataFusion's code. Please help us to resolve this by filing a bug report in our issue tracker: https://github.com/apache/datafusion/issues
238276

239277

240278
statement ok

0 commit comments

Comments
 (0)