alamb commented on code in PR #19819:
URL: https://github.com/apache/datafusion/pull/19819#discussion_r2699605463


##########
datafusion/expr/src/type_coercion/functions.rs:
##########
@@ -635,8 +635,13 @@ fn get_valid_types(
                         default_casted_type.default_cast_for(current_type)?;
                     new_types.push(casted_type);
                 } else {
-                    return internal_err!(
-                        "Expect {} but received NativeType::{}, DataType: {}",
+                    let hint = if matches!(current_native_type, 
NativeType::Binary) {
+                        "\n\nHint: Binary types are not automatically coerced 
to String. Use CAST(column AS VARCHAR) to convert Binary data to String."
+                    } else {
+                        ""
+                    };
+                    return plan_err!(

Review Comment:
   this looks good to me -- thank you @lemorage 
   
   Couuld you please add a test (for this new error) to the slt tests?



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to