You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "findepi (via GitHub)" <gi...@apache.org> on 2025/07/03 10:06:00 UTC
[PR] Improve error message when ScalarValue fails to cast array [datafusion]
findepi opened a new pull request, #16670:
URL: https://github.com/apache/datafusion/pull/16670
The `as_*_array` functions and the `downcast_value!` have the benefit of reporting the array type when there is a mismatch. This makes the error message more actionable.
- follows https://github.com/apache/datafusion/pull/14683
--
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: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] Improve error message when ScalarValue fails to cast array [datafusion]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on code in PR #16670:
URL: https://github.com/apache/datafusion/pull/16670#discussion_r2183767743
##########
datafusion/common/src/scalar/mod.rs:
##########
@@ -895,17 +919,8 @@ fn dict_from_values<K: ArrowDictionaryKeyType>(
}
macro_rules! typed_cast_tz {
- ($array:expr, $index:expr, $ARRAYTYPE:ident, $SCALAR:ident, $TZ:expr) => {{
- use std::any::type_name;
- let array = $array
- .as_any()
- .downcast_ref::<$ARRAYTYPE>()
- .ok_or_else(|| {
- DataFusionError::Internal(format!(
- "could not cast value to {}",
- type_name::<$ARRAYTYPE>()
- ))
- })?;
+ ($array:expr, $index:expr, $array_cast:ident, $SCALAR:ident, $TZ:expr) => {{
Review Comment:
❤ this is a nice change
--
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: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] Improve error message when ScalarValue fails to cast array [datafusion]
Posted by "findepi (via GitHub)" <gi...@apache.org>.
findepi commented on PR #16670:
URL: https://github.com/apache/datafusion/pull/16670#issuecomment-3033380496
test added
--
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: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] Improve error message when ScalarValue fails to cast array [datafusion]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb merged PR #16670:
URL: https://github.com/apache/datafusion/pull/16670
--
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: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org