Apache DataFusion SQL Query Engine
Remove tests from sql_integration that were ported to sqllogictest (#4836)
Matt Willian42f7dd50913c
diff --git a/datafusion/core/tests/sql/aggregates.rs b/datafusion/core/tests/sql/aggregates.rsindex 89077ae192..9911df9c7f 100644--- a/datafusion/core/tests/sql/aggregates.rs+++ b/datafusion/core/tests/sql/aggregates.rs@@ -20,24 +20,6 @@ use datafusion::scalar::ScalarValue;use datafusion::test_util::scan_empty;use datafusion_common::cast::as_float64_array;-#[tokio::test]-async fn csv_query_avg_multi_batch() -> Result<()> {- let ctx = SessionContext::new();- register_aggregate_csv(&ctx).await?;- let sql = "SELECT avg(c12) FROM aggregate_test_100";- let dataframe = ctx.sql(sql).await.unwrap();- let results = dataframe.collect().await.unwrap();- let batch = &results[0];- let column = batch.column(0);- let array = as_float64_array(column)?;- let actual = array.value(0);- let expected = 0.5089725;- // Due to float number's accuracy, different batch size will lead to different- // answers.- assert!((expected - actual).abs() < 0.01);- Ok(())-}-#[tokio::test]#[ignore] // https://github.com/apache/arrow-datafusion/issues/3353async fn csv_query_approx_count() -> Result<()> {@@ -120,60 +102,6 @@ async fn csv_query_approx_percentile_cont_with_histogram_bins() -> Result<()> {Ok(())}-#[tokio::test]-async fn csv_query_array_agg() -> Result<()> {- let ctx = SessionContext::new();- register_aggregate_csv(&ctx).await?;- let sql =- "SELECT array_agg(c13) FROM (SELECT * FROM aggregate_test_100 ORDER BY c13 LIMIT 2) test";- let actual = execute_to_batches(&ctx, sql).await;- let expected = vec![- "+------------------------------------------------------------------+",- "| ARRAYAGG(test.c13) |",- "+------------------------------------------------------------------+",- "| [0VVIHzxWtNOFLtnhjHEKjXaJOSLJfm, 0keZ5G8BffGwgF2RwQD59TFzMStxCB] |",- "+------------------------------------------------------------------+",- ];- assert_batches_eq!(expected, &actual);- Ok(())-}--#[tokio::test]-async fn csv_query_array_agg_empty() -> Result<()> {- let ctx = SessionContext::new();- register_aggregate_csv(&ctx).await?;- let sql =- "SELECT array_agg(c13) FROM (SELECT * FROM aggregate_test_100 LIMIT 0) test";- let actual = execute_to_batches(&ctx, sql).await;- let expected = vec![- "+--------------------+",- "| ARRAYAGG(test.c13) |",- "+--------------------+",- "| [] |",- "+--------------------+",- ];- assert_batches_eq!(expected, &actual);- Ok(())-}--#[tokio::test]-async fn csv_query_array_agg_one() -> Result<()> {- let ctx = SessionContext::new();- register_aggregate_csv(&ctx).await?;- let sql =- "SELECT array_agg(c13) FROM (SELECT * FROM aggregate_test_100 ORDER BY c13 LIMIT 1) test";- let actual = execute_to_batches(&ctx, sql).await;- let expected = vec![- "+----------------------------------+",- "| ARRAYAGG(test.c13) |",- "+----------------------------------+",- "| [0VVIHzxWtNOFLtnhjHEKjXaJOSLJfm] |",- "+----------------------------------+",- ];- assert_batches_eq!(expected, &actual);- Ok(())-}-#[tokio::test]async fn csv_query_array_agg_unsupported() -> Result<()> {let ctx = SessionContext::new();diff --git a/datafusion/core/tests/sql/arrow_typeof.rs b/datafusion/core/tests/sql/arrow_typeof.rsdeleted file mode 100644index 4477ad53c1..0000000000--- a/datafusion/core/tests/sql/arrow_typeof.rs+++ /dev/null@@ -1,139 +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 arrow_typeof_null() -> Result<()> {- let ctx = SessionContext::new();- let sql = "SELECT arrow_typeof(null)";- let actual = execute(&ctx, sql).await;- let expected = "Null";- assert_eq!(expected, &actual[0][0]);-- Ok(())-}--#[tokio::test]-async fn arrow_typeof_boolean() -> Result<()> {- let ctx = SessionContext::new();- let sql = "SELECT arrow_typeof(true)";- let actual = execute(&ctx, sql).await;- let expected = "Boolean";- assert_eq!(expected, &actual[0][0]);-- Ok(())-}--#[tokio::test]-async fn arrow_typeof_i64() -> Result<()> {- let ctx = SessionContext::new();- let sql = "SELECT arrow_typeof(1)";- let actual = execute(&ctx, sql).await;- let expected = "Int64";- assert_eq!(expected, &actual[0][0]);-- Ok(())-}--#[tokio::test]-async fn arrow_typeof_i32() -> Result<()> {- let ctx = SessionContext::new();- let sql = "SELECT arrow_typeof(1::int)";- let actual = execute(&ctx, sql).await;- let expected = "Int32";- assert_eq!(expected, &actual[0][0]);-- Ok(())-}--#[tokio::test]-async fn arrow_typeof_f64() -> Result<()> {- let ctx = SessionContext::new();- let sql = "SELECT arrow_typeof(1.0)";- let actual = execute(&ctx, sql).await;- let expected = "Float64";- assert_eq!(expected, &actual[0][0]);-- Ok(())-}--#[tokio::test]-async fn arrow_typeof_f32() -> Result<()> {- let ctx = SessionContext::new();- let sql = "SELECT arrow_typeof(1.0::float)";- let actual = execute(&ctx, sql).await;- let expected = "Float32";- assert_eq!(expected, &actual[0][0]);-- Ok(())-}--#[tokio::test]-async fn arrow_typeof_decimal() -> Result<()> {- let ctx = SessionContext::new();- let sql = "SELECT arrow_typeof(1::Decimal)";- let actual = execute(&ctx, sql).await;- let expected = "Decimal128(38, 10)";- assert_eq!(expected, &actual[0][0]);-- Ok(())-}--#[tokio::test]-async fn arrow_typeof_timestamp() -> Result<()> {- let ctx = SessionContext::new();- let sql = "SELECT arrow_typeof(now()::timestamp)";- let actual = execute(&ctx, sql).await;- let expected = "Timestamp(Nanosecond, None)";- assert_eq!(expected, &actual[0][0]);-- Ok(())-}--#[tokio::test]-async fn arrow_typeof_timestamp_utc() -> Result<()> {- let ctx = SessionContext::new();- let sql = "SELECT arrow_typeof(now())";- let actual = execute(&ctx, sql).await;- let expected = "Timestamp(Nanosecond, Some(\"+00:00\"))";- assert_eq!(expected, &actual[0][0]);-- Ok(())-}--#[tokio::test]-async fn arrow_typeof_timestamp_date32() -> Result<()> {- let ctx = SessionContext::new();- let sql = "SELECT arrow_typeof(now()::date)";- let actual = execute(&ctx, sql).await;- let expected = "Date32";- assert_eq!(expected, &actual[0][0]);-- Ok(())-}--#[tokio::test]-async fn arrow_typeof_utf8() -> Result<()> {- let ctx = SessionContext::new();- let sql = "SELECT arrow_typeof('1')";- let actual = execute(&ctx, sql).await;- let expected = "Utf8";- assert_eq!(expected, &actual[0][0]);-- Ok(())-}diff --git a/datafusion/core/tests/sql/mod.rs b/datafusion/core/tests/sql/mod.rsindex 2575bfcdd1..1c50c8ad0f 100644--- a/datafusion/core/tests/sql/mod.rs+++ b/datafusion/core/tests/sql/mod.rs@@ -104,7 +104,6 @@ pub mod union;pub mod wildcard;pub mod window;-pub mod arrow_typeof;pub mod decimal;pub mod explain;pub mod idenfifers;diff --git a/datafusion/core/tests/sqllogictests/test_files/aggregate.slt b/datafusion/core/tests/sqllogictests/test_files/aggregate.sltindex 611fd75eff..dbb3b69ca6 100644--- a/datafusion/core/tests/sqllogictests/test_files/aggregate.slt+++ b/datafusion/core/tests/sqllogictests/test_files/aggregate.slt@@ -846,26 +846,23 @@ SELECT count(1 + 1)----1-# FIX: "CSV Writer does not support List(Field { name: \"item\", data_type: Utf8, nullable: true, dict_id: 0, dict_is_ordered: false, metadata: None }) data type")# csv_query_array_agg-# query T-# SELECT array_agg(c13) FROM (SELECT * FROM aggregate_test_100 ORDER BY c13 LIMIT 2) test-# -----# [0VVIHzxWtNOFLtnhjHEKjXaJOSLJfm0keZ5G8BffGwgF2RwQD59TFzMStxCB]+query T+SELECT array_agg(c13) FROM (SELECT * FROM aggregate_test_100 ORDER BY c13 LIMIT 2) test+----+[0VVIHzxWtNOFLtnhjHEKjXaJOSLJfm, 0keZ5G8BffGwgF2RwQD59TFzMStxCB]-# FIX: see above# csv_query_array_agg_empty-# query I-# SELECT array_agg(c13) FROM (SELECT * FROM aggregate_test_100 LIMIT 0) test-# -----# []+query I+SELECT array_agg(c13) FROM (SELECT * FROM aggregate_test_100 LIMIT 0) test+----+[]-# FIX: see above# csv_query_array_agg_one-# query I-# SELECT array_agg(c13) FROM (SELECT * FROM aggregate_test_100 ORDER BY c13 LIMIT 1) test-# -----# [0VVIHzxWtNOFLtnhjHEKjXaJOSLJfm]+query I+SELECT array_agg(c13) FROM (SELECT * FROM aggregate_test_100 ORDER BY c13 LIMIT 1) test+----+[0VVIHzxWtNOFLtnhjHEKjXaJOSLJfm]# csv_query_array_agg_with_overflowquery IIRIII@@ -976,6 +973,7 @@ select max(c1) from d_table----110.009+# FIX: doesn't check datatype# aggregate_decimal_sumquery Rselect sum(c1) from d_table