Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
7afeb8b
Minor: Improve the document format of JoinHashMap
Asura7969 Nov 8, 2023
6332bec
Merge remote-tracking branch 'origin/main'
Asura7969 Nov 10, 2023
cc5e0c7
Merge remote-tracking branch 'origin/main'
Asura7969 Nov 10, 2023
a114310
Merge remote-tracking branch 'origin/main'
Asura7969 Nov 11, 2023
928c811
Merge remote-tracking branch 'origin/main'
Asura7969 Nov 11, 2023
839093e
Merge remote-tracking branch 'origin/main'
Asura7969 Nov 12, 2023
a836cde
Merge remote-tracking branch 'origin/main'
Asura7969 Nov 13, 2023
5648dc7
Merge branch 'apache:main' into main
Asura7969 Nov 13, 2023
a670409
Merge branch 'apache:main' into main
Asura7969 Nov 14, 2023
22894a3
Merge branch 'apache:main' into main
Asura7969 Nov 14, 2023
73a59d2
Merge branch 'apache:main' into main
Asura7969 Nov 15, 2023
46409c2
Merge branch 'apache:main' into main
Asura7969 Nov 16, 2023
8a86a4c
Merge branch 'apache:main' into main
Asura7969 Nov 17, 2023
cf5c584
Merge branch 'apache:main' into main
Asura7969 Nov 17, 2023
737d73c
Port tests in csv_files.rs to sqllogictest
Asura7969 Nov 17, 2023
447eed2
Merge branch 'main' into csv_files
Asura7969 Nov 17, 2023
3492266
fix: fmt
Asura7969 Nov 17, 2023
62ae9b9
Merge branch 'apache:main' into main
Asura7969 Nov 19, 2023
da02fa2
Merge branch 'apache:main' into main
Asura7969 Nov 20, 2023
d98eb2e
Merge branch 'apache:main' into main
Asura7969 Nov 21, 2023
79e7216
Merge branch 'apache:main' into main
Asura7969 Nov 21, 2023
fec6eea
Merge branch 'main' into csv_files
Asura7969 Nov 21, 2023
3a6e362
fix: test file
Asura7969 Nov 21, 2023
126b3c2
fix: use enable_testdir
Asura7969 Nov 23, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion datafusion/common/src/file_options/csv_writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ impl TryFrom<(&ConfigOptions, &StatementOptions)> for CsvWriterOptions {
"Unable to convert CSV delimiter into u8".into(),
)
})?)
},
},
_ => return Err(DataFusionError::Configuration(format!("Found unsupported option {option} with value {value} for CSV format!")))
}
}
Expand Down
125 changes: 0 additions & 125 deletions datafusion/core/tests/sql/csv_files.rs

This file was deleted.

1 change: 0 additions & 1 deletion datafusion/core/tests/sql/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ macro_rules! test_expression {

pub mod aggregates;
pub mod create_drop;
pub mod csv_files;
pub mod explain_analyze;
pub mod expr;
pub mod group_by;
Expand Down
36 changes: 36 additions & 0 deletions datafusion/sqllogictest/src/test_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ impl TestContext {
info!("Registering metadata table tables");
register_metadata_tables(test_ctx.session_ctx()).await;
}
"csv_files.slt" => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

info!("Registering metadata table tables");
register_csv_custom_tables(&mut test_ctx).await;
}
_ => {
info!("Using default SessionContext");
}
Expand Down Expand Up @@ -219,6 +223,38 @@ pub async fn register_partition_table(test_ctx: &mut TestContext) {
.unwrap();
}

pub async fn register_csv_custom_tables(test_ctx: &mut TestContext) {
test_ctx.enable_testdir();
let schema = Arc::new(Schema::new(vec![
Field::new("c1", DataType::Utf8, false),
Field::new("c2", DataType::Utf8, false),
]));
let filename = format!("quote_escape.{}", "csv");
let file_path = test_ctx.testdir_path().join(filename);
let mut file = File::create(file_path.clone()).unwrap();

// generate some data
for index in 0..10 {
let text1 = format!("id{index:}");
let text2 = format!("value{index:}");
let data = format!("~{text1}~,~{text2}~\r\n");
file.write_all(data.as_bytes()).unwrap();
}
test_ctx
.ctx
.register_csv(
"test_custom_quote_escape",
file_path.to_str().unwrap(),
CsvReadOptions::new()
.schema(&schema)
.has_header(false)
.quote(b'~')
.escape(b'\\'),
)
.await
.unwrap();
}

// registers a LOCAL TEMPORARY table.
pub async fn register_temp_table(ctx: &SessionContext) {
struct TestTable(TableType);
Expand Down
46 changes: 46 additions & 0 deletions datafusion/sqllogictest/test_files/csv_files.slt
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at

# http://www.apache.org/licenses/LICENSE-2.0

# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

#############
## Csv Files Tests
#############

# TODO: https://github.com/apache/arrow-datafusion/issues/8310
# statement ok
# CREATE EXTERNAL TABLE test_custom_quote_escape (
# c1 VARCHAR DEFAULT NULL,
# c2 VARCHAR DEFAULT NULL
# )
# STORED AS CSV
# WITH HEADER ROW
# DELIMITER ','
# OPTIONS ('quote' '~', 'escape' '\')
# LOCATION 'test_custom_quote_escape.csv';

query TT
SELECT * from test_custom_quote_escape;
----
id0 value0
id1 value1
id2 value2
id3 value3
id4 value4
id5 value5
id6 value6
id7 value7
id8 value8
id9 value9