You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/11/21 22:59:04 UTC
[GitHub] [arrow-datafusion] retikulum opened a new pull request, #4313: Refactor downcasting functions with downcastvalue macro and improve error handling of `ListArray` downcasting
retikulum opened a new pull request, #4313:
URL: https://github.com/apache/arrow-datafusion/pull/4313
# Which issue does this PR close?
<!--
We generally require a GitHub issue to be filed for all bug fixes and enhancements and this helps us generate change logs for our releases. You can link an issue to this PR using the GitHub syntax. For example `Closes #123` indicates that this PR will close issue #123.
-->
This is discussed in #3152.
# Rationale for this change
<!--
Why are you proposing this change? If this is already explained clearly in the issue then this section is not needed.
Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes.
-->
This is the new PR of improving error handling for downcasting. In #4261 we found out that there is a `downcast_value!` macro which also covers our casting functions. Implementing `as_xxx_array` function with `downcast_value!` is nearly decided for now for future PRs. This PR is small compared to last two PR because I want to hear your feedback about if my implementation is correct/desired?
# What changes are included in this PR?
<!--
There is no need to duplicate the description in the issue here but it is sometimes worth providing a summary of the individual changes in this PR.
-->
- Refactor previous casting functions. Old function:
```rust
pub fn as_int32_array(array: &dyn Array) -> Result<&Int32Array, DataFusionError> {
array.as_any().downcast_ref::<Int32Array>().ok_or_else(|| {
DataFusionError::Internal(format!(
"Expected a Int32Array, got: {}",
array.data_type()
))
})
```
New function:
```rust
pub fn as_int32_array(array: &dyn Array) -> Result<&Int32Array, DataFusionError> {
Ok(downcast_value!(array, Int32Array))
}
```
- Refactor `ListArray` downcasting parts where following lines are used:
```rust
as_any().downcast_ref::<ListArray>().unwrap()
```
# Are these changes tested?
These changes passed related tests.
<!--
We typically require tests for all PRs in order to:
1. Prevent the code from being accidentally broken by subsequent changes
2. Serve as another way to document the expected behavior of the code
If tests are not included in your PR, please explain why (for example, are they covered by existing 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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] alamb commented on pull request #4313: Refactor downcasting functions with downcastvalue macro and improve error handling of `ListArray` downcasting
Posted by GitBox <gi...@apache.org>.
alamb commented on PR #4313:
URL: https://github.com/apache/arrow-datafusion/pull/4313#issuecomment-1324314672
I love to see the code train chugging along!
--
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@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] ursabot commented on pull request #4313: Refactor downcasting functions with downcastvalue macro and improve error handling of `ListArray` downcasting
Posted by GitBox <gi...@apache.org>.
ursabot commented on PR #4313:
URL: https://github.com/apache/arrow-datafusion/pull/4313#issuecomment-1324325287
Benchmark runs are scheduled for baseline = 92325bf167c0d215564695717cb56d01448887c8 and contender = bfce076527e40e51357b3815ed367a28e8b73b3a. bfce076527e40e51357b3815ed367a28e8b73b3a is a master commit associated with this PR. Results will be available as each benchmark for each run completes.
Conbench compare runs links:
[Skipped :warning: Benchmarking of arrow-datafusion-commits is not supported on ec2-t3-xlarge-us-east-2] [ec2-t3-xlarge-us-east-2](https://conbench.ursa.dev/compare/runs/0ff8445206304873957930456639c712...a95e3da0b6c546e5b346cefe6ce2e366/)
[Skipped :warning: Benchmarking of arrow-datafusion-commits is not supported on test-mac-arm] [test-mac-arm](https://conbench.ursa.dev/compare/runs/381b9593a1124abaa419a30ed11595ec...255da1432cff4a5c8dec0d8a5d6a93cc/)
[Skipped :warning: Benchmarking of arrow-datafusion-commits is not supported on ursa-i9-9960x] [ursa-i9-9960x](https://conbench.ursa.dev/compare/runs/6d82de1dbc974726867152c7eacab666...4df4d81602e742f6b8d5c467f97c8dfe/)
[Skipped :warning: Benchmarking of arrow-datafusion-commits is not supported on ursa-thinkcentre-m75q] [ursa-thinkcentre-m75q](https://conbench.ursa.dev/compare/runs/a6ba07860c2a4eecad52794d4d7e9429...2498e32b58b545c79a022a76ac9588f6/)
Buildkite builds:
Supported benchmarks:
ec2-t3-xlarge-us-east-2: Supported benchmark langs: Python, R. Runs only benchmarks with cloud = True
test-mac-arm: Supported benchmark langs: C++, Python, R
ursa-i9-9960x: Supported benchmark langs: Python, R, JavaScript
ursa-thinkcentre-m75q: Supported benchmark langs: C++, Java
--
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@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] alamb merged pull request #4313: Refactor downcasting functions with downcastvalue macro and improve error handling of `ListArray` downcasting
Posted by GitBox <gi...@apache.org>.
alamb merged PR #4313:
URL: https://github.com/apache/arrow-datafusion/pull/4313
--
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@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org