-
Notifications
You must be signed in to change notification settings - Fork 984
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upgrade to arrow 16.0.0
#2718
Upgrade to arrow 16.0.0
#2718
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1288,6 +1288,7 @@ fn tuple_err<T, R>(value: (Result<T>, Result<R>)) -> Result<(T, R)> { | |
#[cfg(test)] | ||
mod tests { | ||
use super::*; | ||
use crate::assert_contains; | ||
use crate::execution::context::TaskContext; | ||
use crate::execution::options::CsvReadOptions; | ||
use crate::execution::runtime_env::{RuntimeConfig, RuntimeEnv}; | ||
|
@@ -1516,10 +1517,7 @@ mod tests { | |
#[tokio::test] | ||
async fn in_list_types() -> Result<()> { | ||
// expression: "a in ('a', 1)" | ||
let list = vec![ | ||
Expr::Literal(ScalarValue::Utf8(Some("a".to_string()))), | ||
Expr::Literal(ScalarValue::Int64(Some(1))), | ||
]; | ||
let list = vec![lit("a"), lit(1i64)]; | ||
let logical_plan = test_csv_scan() | ||
.await? | ||
// filter clause needs the type coercion rule applied | ||
|
@@ -1531,11 +1529,9 @@ mod tests { | |
let expected = "InListExpr { expr: Column { name: \"c1\", index: 0 }, list: [Literal { value: Utf8(\"a\") }, CastExpr { expr: Literal { value: Int64(1) }, cast_type: Utf8, cast_options: CastOptions { safe: false } }], negated: false, set: None }"; | ||
assert!(format!("{:?}", execution_plan).contains(expected)); | ||
|
||
// expression: "a in (true, 'a')" | ||
let list = vec![ | ||
Expr::Literal(ScalarValue::Boolean(Some(true))), | ||
Expr::Literal(ScalarValue::Utf8(Some("a".to_string()))), | ||
]; | ||
// expression: "a in (struct::null, 'a')" | ||
let list = vec![struct_literal(), lit("a")]; | ||
|
||
let logical_plan = test_csv_scan() | ||
.await? | ||
// filter clause needs the type coercion rule applied | ||
|
@@ -1544,20 +1540,22 @@ mod tests { | |
.build()?; | ||
let execution_plan = plan(&logical_plan).await; | ||
|
||
let expected_error = "Unsupported CAST from Utf8 to Boolean"; | ||
match execution_plan { | ||
Ok(_) => panic!("Expected planning failure"), | ||
Err(e) => assert!( | ||
e.to_string().contains(expected_error), | ||
"Error '{}' did not contain expected error '{}'", | ||
e, | ||
expected_error | ||
), | ||
} | ||
let e = execution_plan.unwrap_err().to_string(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is great -- arrow 16.0.0 contains support for casting I also took the opportunity to clean up the test in general |
||
assert_contains!(&e, "Unsupported CAST from Struct"); | ||
assert_contains!(&e, "to Boolean"); | ||
|
||
Ok(()) | ||
} | ||
|
||
/// Return a `null` literal representing a struct type like: `{ a: bool }` | ||
fn struct_literal() -> Expr { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Casting from |
||
let struct_literal = ScalarValue::Struct( | ||
None, | ||
Box::new(vec![Field::new("foo", DataType::Boolean, false)]), | ||
); | ||
lit(struct_literal) | ||
} | ||
|
||
#[tokio::test] | ||
async fn in_set_test() -> Result<()> { | ||
// OPTIMIZER_INSET_THRESHOLD = 10 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
used more concise construction of
ScalarValue
s