-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
fix: correct expected error in test #5224
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 |
---|---|---|
|
@@ -17,6 +17,7 @@ | |
|
||
use super::*; | ||
use datafusion::from_slice::FromSlice; | ||
use datafusion_common::ScalarValue; | ||
use std::ops::Add; | ||
|
||
#[tokio::test] | ||
|
@@ -1046,7 +1047,11 @@ async fn sub_interval_day() -> Result<()> { | |
|
||
#[tokio::test] | ||
async fn cast_string_to_time() { | ||
let ctx = SessionContext::new(); | ||
let config = SessionConfig::new().set( | ||
"datafusion.optimizer.skip_failed_rules", | ||
ScalarValue::Boolean(Some(false)), | ||
); | ||
let ctx = SessionContext::with_config(config); | ||
|
||
let sql = "select \ | ||
time '08:09:10.123456789' as time_nano, \ | ||
|
@@ -1070,15 +1075,19 @@ async fn cast_string_to_time() { | |
let result = try_execute_to_batches(&ctx, sql).await; | ||
assert_eq!( | ||
result.err().unwrap().to_string(), | ||
"Arrow error: Cast error: Cannot cast string 'not a time' to value of Time64(Nanosecond) type" | ||
"simplify_expressions\ncaused by\nInternal error: Optimizer rule 'simplify_expressions' failed due to unexpected error: \ | ||
Arrow error: Cast error: Cannot cast string 'not a time' to value of Time64(Nanosecond) type. \ | ||
This was likely caused by a bug in DataFusion's code and we would welcome that you file an bug report in our issue tracker" | ||
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. Ditto. We should find a way to update the error message when the error is expected. However, this is not a big deal now, because the default value of |
||
); | ||
|
||
// An invalid time | ||
let sql = "SELECT TIME '24:01:02' as time;"; | ||
let result = try_execute_to_batches(&ctx, sql).await; | ||
assert_eq!( | ||
result.err().unwrap().to_string(), | ||
"Arrow error: Cast error: Cannot cast string '24:01:02' to value of Time64(Nanosecond) type" | ||
"simplify_expressions\ncaused by\nInternal error: Optimizer rule 'simplify_expressions' failed due to unexpected error: \ | ||
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. Ditto. |
||
Arrow error: Cast error: Cannot cast string '24:01:02' to value of Time64(Nanosecond) type. \ | ||
This was likely caused by a bug in DataFusion's code and we would welcome that you file an bug report in our issue tracker" | ||
); | ||
} | ||
|
||
|
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.
We should update this error message somehow, because it is a type error, not a bug in Datafusion.
We could do this in the following PRs.
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.
Agree with you.
I think we can do it in next PR.