Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
72 changes: 0 additions & 72 deletions datafusion/core/tests/sql/aggregates.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<()> {
Copy link
Contributor

Choose a reason for hiding this comment

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

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<()> {
Expand Down Expand Up @@ -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();
Expand Down
139 changes: 0 additions & 139 deletions datafusion/core/tests/sql/arrow_typeof.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 @@ -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;
Expand Down
28 changes: 13 additions & 15 deletions datafusion/core/tests/sqllogictests/test_files/aggregate.slt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

# 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
Expand Down Expand Up @@ -976,6 +973,7 @@ select max(c1) from d_table
----
110.009

# FIX: doesn't check datatype
Copy link
Contributor

Choose a reason for hiding this comment

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

This is tracked by #4499

# aggregate_decimal_sum
query R
select sum(c1) from d_table
Expand Down