HaoYang670 commented on code in PR #5224:
URL: https://github.com/apache/arrow-datafusion/pull/5224#discussion_r1102326985


##########
datafusion/core/tests/sql/timestamp.rs:
##########
@@ -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"
     );
 
     // 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: \

Review Comment:
   Ditto.



##########
datafusion/core/src/physical_plan/planner.rs:
##########
@@ -2191,7 +2190,12 @@ mod tests {
             .build()?;
         let e = plan(&logical_plan).await.unwrap_err().to_string();
 
-        assert_contains!(&e, "The data type inlist should be same, the value 
type is Boolean, one of list expr type is Struct([Field { name: \"foo\", 
data_type: Boolean, nullable: false, dict_id: 0, dict_is_ordered: false, 
metadata: {} }])");
+        assert_contains!(
+            &e,
+            r#"type_coercion
+caused by
+Internal error: Optimizer rule 'type_coercion' failed due to unexpected error: 
Error during planning: Can not find compatible types to compare Boolean with 
[Struct([Field { name: "foo", data_type: Boolean, nullable: false, dict_id: 0, 
dict_is_ordered: false, metadata: {} }]), Utf8]. 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"#
+        );

Review Comment:
   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.



##########
datafusion/core/tests/sql/timestamp.rs:
##########
@@ -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"

Review Comment:
   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 
`skip_failed_rules` is `false` and customers won't see this error message.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to