From 32a1d2b8463d582411125563d41bf6e6b736eb57 Mon Sep 17 00:00:00 2001 From: itsjunetime Date: Tue, 22 Oct 2024 15:38:23 -0600 Subject: [PATCH] Add extra test to fix other issue with schema metadata --- datafusion/sqllogictest/test_files/metadata.slt | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/datafusion/sqllogictest/test_files/metadata.slt b/datafusion/sqllogictest/test_files/metadata.slt index 2320409bef65f..50366bc921e50 100644 --- a/datafusion/sqllogictest/test_files/metadata.slt +++ b/datafusion/sqllogictest/test_files/metadata.slt @@ -136,7 +136,21 @@ no_baz no_foo NULL - +# Regression test: missing schema metadata from union when schema with metadata isn't the first one +# and also ensure it works fine with multiple unions +query T +select name from ( + SELECT NULL::string as name + UNION ALL + SELECT nonnull_name as name FROM "table_with_metadata" + UNION ALL + SELECT NULL::string as name +) group by name order by name; +---- +no_bar +no_baz +no_foo +NULL statement ok drop table table_with_metadata;