This is an automated email from the ASF dual-hosted git repository. alamb pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/arrow-datafusion.git
The following commit(s) were added to refs/heads/master by this push: new 42f7dd509 Remove tests from sql_integration that were ported to sqllogictest (#4836) 42f7dd509 is described below commit 42f7dd50913c4f6b6d830b88d55dfd4a8d16d44f Author: Matt Willian <matthewwill...@gmail.com> AuthorDate: Mon Jan 9 14:13:17 2023 -0800 Remove tests from sql_integration that were ported to sqllogictest (#4836) * delete tests duplicated between sqllogictests and aggregates / arrow_typeof * recomment failing test * remove typo * add back in test that's broken in sqllogictest * remove arrow module Co-authored-by: Matt <matt@Matts-MacBook-Pro.local> --- datafusion/core/tests/sql/aggregates.rs | 72 ----------- datafusion/core/tests/sql/arrow_typeof.rs | 139 --------------------- datafusion/core/tests/sql/mod.rs | 1 - .../tests/sqllogictests/test_files/aggregate.slt | 28 ++--- 4 files changed, 13 insertions(+), 227 deletions(-) diff --git a/datafusion/core/tests/sql/aggregates.rs b/datafusion/core/tests/sql/aggregates.rs index 89077ae19..9911df9c7 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/3353 async 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.rs deleted file mode 100644 index 4477ad53c..000000000 --- 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.rs index 2575bfcdd..1c50c8ad0 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.slt index 611fd75ef..dbb3b69ca 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_overflow query IIRIII @@ -976,6 +973,7 @@ select max(c1) from d_table ---- 110.009 +# FIX: doesn't check datatype # aggregate_decimal_sum query R select sum(c1) from d_table