Skip to content

Apache DataFusion SQL Query Engine

Add test for nullable doesn't work when create memory table (#14624)

xudong.w3e6d70ee71aa
diff --git a/datafusion/sqllogictest/test_files/ddl.slt b/datafusion/sqllogictest/test_files/ddl.slt
index 5e22907527..196e2f3051 100644
--- a/datafusion/sqllogictest/test_files/ddl.slt
+++ b/datafusion/sqllogictest/test_files/ddl.slt
@@ -840,3 +840,31 @@ DROP TABLE t1;
statement ok
DROP TABLE t2;
+
+# Test memory table fields with correct nullable
+statement ok
+CREATE or replace TABLE table_with_pk (
+ sn INT PRIMARY KEY NOT NULL,
+ ts TIMESTAMP WITH TIME ZONE NOT NULL,
+ currency VARCHAR(3) NOT NULL,
+ amount FLOAT
+ ) as VALUES
+ (0, '2022-01-01 06:00:00Z'::timestamp, 'EUR', 30.0),
+ (1, '2022-01-01 08:00:00Z'::timestamp, 'EUR', 50.0),
+ (2, '2022-01-01 11:30:00Z'::timestamp, 'TRY', 75.0),
+ (3, '2022-01-02 12:00:00Z'::timestamp, 'EUR', 200.0);
+
+query TTTTTT
+show columns FROM table_with_pk;
+----
+datafusion public table_with_pk sn Int32 NO
+datafusion public table_with_pk ts Timestamp(Nanosecond, Some("+00:00")) NO
+datafusion public table_with_pk currency Utf8 NO
+datafusion public table_with_pk amount Float32 YES
+
+statement ok
+drop table table_with_pk;
+
+statement ok
+set datafusion.catalog.information_schema = false;
+