From 0cef2317426884037677fa835eedba72a954ad42 Mon Sep 17 00:00:00 2001 From: Andrew Lamb Date: Sat, 23 Mar 2024 07:26:02 -0400 Subject: [PATCH] Add test for reading back file created with FORMAT options --- datafusion/sqllogictest/test_files/copy.slt | 25 +++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/datafusion/sqllogictest/test_files/copy.slt b/datafusion/sqllogictest/test_files/copy.slt index fca892dfcdad..95b6d29db407 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 Options Support with format in OPTIONS +# +# i.e. COPY { table_name | query } TO 'file_name' OPTIONS (format , ...) +# 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