From 3f219bc929cfd418b0e3d3501f8eba1d5a2c87ae Mon Sep 17 00:00:00 2001 From: Dejan Simic <10134699+simicd@users.noreply.github.com> Date: Tue, 16 Jan 2024 22:02:05 +0100 Subject: [PATCH] Remove migrated unit tests (#8885) --- datafusion/core/tests/sql/csv_files.rs | 125 ------------------------- datafusion/core/tests/sql/mod.rs | 1 - 2 files changed, 126 deletions(-) delete mode 100644 datafusion/core/tests/sql/csv_files.rs diff --git a/datafusion/core/tests/sql/csv_files.rs b/datafusion/core/tests/sql/csv_files.rs deleted file mode 100644 index 5ed0068d6135..000000000000 --- a/datafusion/core/tests/sql/csv_files.rs +++ /dev/null @@ -1,125 +0,0 @@ -// 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. - -use super::*; - -#[tokio::test] -async fn csv_custom_quote() -> Result<()> { - let tmp_dir = TempDir::new()?; - let ctx = SessionContext::new(); - - let schema = Arc::new(Schema::new(vec![ - Field::new("c1", DataType::Utf8, false), - Field::new("c2", DataType::Utf8, false), - ])); - let filename = format!("partition.{}", "csv"); - let file_path = tmp_dir.path().join(filename); - let mut file = File::create(file_path)?; - - // 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())?; - } - ctx.register_csv( - "test", - tmp_dir.path().to_str().unwrap(), - CsvReadOptions::new() - .schema(&schema) - .has_header(false) - .quote(b'~'), - ) - .await?; - - let results = plan_and_collect(&ctx, "SELECT * from test").await?; - - let expected = vec![ - "+-----+--------+", - "| c1 | c2 |", - "+-----+--------+", - "| id0 | value0 |", - "| id1 | value1 |", - "| id2 | value2 |", - "| id3 | value3 |", - "| id4 | value4 |", - "| id5 | value5 |", - "| id6 | value6 |", - "| id7 | value7 |", - "| id8 | value8 |", - "| id9 | value9 |", - "+-----+--------+", - ]; - - assert_batches_sorted_eq!(expected, &results); - Ok(()) -} - -#[tokio::test] -async fn csv_custom_escape() -> Result<()> { - let tmp_dir = TempDir::new()?; - let ctx = SessionContext::new(); - - let schema = Arc::new(Schema::new(vec![ - Field::new("c1", DataType::Utf8, false), - Field::new("c2", DataType::Utf8, false), - ])); - let filename = format!("partition.{}", "csv"); - let file_path = tmp_dir.path().join(filename); - let mut file = File::create(file_path)?; - - // 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())?; - } - - ctx.register_csv( - "test", - tmp_dir.path().to_str().unwrap(), - CsvReadOptions::new() - .schema(&schema) - .has_header(false) - .escape(b'\\'), - ) - .await?; - - let results = plan_and_collect(&ctx, "SELECT * from test").await?; - - let expected = vec![ - "+-----+---------+", - "| c1 | c2 |", - "+-----+---------+", - "| id0 | value\"0 |", - "| id1 | value\"1 |", - "| id2 | value\"2 |", - "| id3 | value\"3 |", - "| id4 | value\"4 |", - "| id5 | value\"5 |", - "| id6 | value\"6 |", - "| id7 | value\"7 |", - "| id8 | value\"8 |", - "| id9 | value\"9 |", - "+-----+---------+", - ]; - - assert_batches_sorted_eq!(expected, &results); - Ok(()) -} diff --git a/datafusion/core/tests/sql/mod.rs b/datafusion/core/tests/sql/mod.rs index 0960f93ae103..140eeb91d1a9 100644 --- a/datafusion/core/tests/sql/mod.rs +++ b/datafusion/core/tests/sql/mod.rs @@ -69,7 +69,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 joins;