You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by al...@apache.org on 2022/08/15 12:25:54 UTC
[arrow-datafusion] branch master updated: Minor: Clean up `array` test (#3121)
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 ff53f8ba0 Minor: Clean up `array` test (#3121)
ff53f8ba0 is described below
commit ff53f8ba019214575ff0cf860e7610ddb5651074
Author: Andrew Lamb <an...@nerdnetworks.org>
AuthorDate: Mon Aug 15 08:25:49 2022 -0400
Minor: Clean up `array` test (#3121)
---
datafusion/core/tests/sql/functions.rs | 29 +++++++++++++++++++----------
1 file changed, 19 insertions(+), 10 deletions(-)
diff --git a/datafusion/core/tests/sql/functions.rs b/datafusion/core/tests/sql/functions.rs
index 4b58b379e..88c00b45e 100644
--- a/datafusion/core/tests/sql/functions.rs
+++ b/datafusion/core/tests/sql/functions.rs
@@ -111,7 +111,6 @@ async fn query_concat() -> Result<()> {
Ok(())
}
-// Revisit after implementing https://github.com/apache/arrow-rs/issues/925
#[tokio::test]
async fn query_array() -> Result<()> {
let schema = Arc::new(Schema::new(vec![
@@ -132,14 +131,18 @@ async fn query_array() -> Result<()> {
let ctx = SessionContext::new();
ctx.register_table("test", Arc::new(table))?;
let sql = "SELECT array(c1, cast(c2 as varchar)) FROM test";
- let actual = execute(&ctx, sql).await;
+ let actual = execute_to_batches(&ctx, sql).await;
let expected = vec![
- vec!["[,0]"],
- vec!["[a,1]"],
- vec!["[aa,NULL]"],
- vec!["[aaa,3]"],
+ "+--------------------------------------+",
+ "| array(test.c1,CAST(test.c2 AS Utf8)) |",
+ "+--------------------------------------+",
+ "| [, 0] |",
+ "| [a, 1] |",
+ "| [aa, ] |",
+ "| [aaa, 3] |",
+ "+--------------------------------------+",
];
- assert_eq!(expected, actual);
+ assert_batches_eq!(expected, &actual);
Ok(())
}
@@ -148,9 +151,15 @@ async fn query_array_scalar() -> Result<()> {
let ctx = SessionContext::new();
let sql = "SELECT array(1, 2, 3);";
- let actual = execute(&ctx, sql).await;
- let expected = vec![vec!["[1, 2, 3]"]];
- assert_eq!(expected, actual);
+ let actual = execute_to_batches(&ctx, sql).await;
+ let expected = vec![
+ "+-----------------------------------+",
+ "| array(Int64(1),Int64(2),Int64(3)) |",
+ "+-----------------------------------+",
+ "| [1, 2, 3] |",
+ "+-----------------------------------+",
+ ];
+ assert_batches_eq!(expected, &actual);
Ok(())
}