Skip to content

Apache DataFusion SQL Query Engine

Add test for reading back file created with FORMAT options (#9753)

Andrew Lambb50f3aad043d
diff --git a/datafusion/sqllogictest/test_files/copy.slt b/datafusion/sqllogictest/test_files/copy.slt
index fca892dfcd..95b6d29db4 100644
--- a/datafusion/sqllogictest/test_files/copy.slt
+++ b/datafusion/sqllogictest/test_files/copy.slt
@@ -514,10 +514,31 @@ OPTIONS (
);
-# Format Options Support with format in OPTIONS i.e. COPY { table_name | query } TO 'file_name' OPTIONS (format <format-name>, ...)
+# Format Options Support with format in OPTIONS
+#
+# i.e. COPY { table_name | query } TO 'file_name' OPTIONS (format <format-name>, ...)
+# Ensure that the format is set in the OPTIONS, not extension
query I
-COPY (select * from (values (1))) to 'test_files/scratch/copy/'
+COPY (select * from (values (1))) to 'test_files/scratch/copy/foo.dat'
+OPTIONS (format parquet);
+----
+1
+
+statement ok
+CREATE EXTERNAL TABLE foo_dat STORED AS PARQUET LOCATION 'test_files/scratch/copy/foo.dat';
+
+query I
+select * from foo_dat;
+----
+1
+
+statement ok
+DROP TABLE foo_dat;
+
+
+query I
+COPY (select * from (values (1))) to 'test_files/scratch/copy'
OPTIONS (format parquet);
----
1