You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "jspaezp (via GitHub)" <gi...@apache.org> on 2025/05/24 21:16:20 UTC
[PR] Fix `Result` name collision in parquet_derive [arrow-rs]
jspaezp opened a new pull request, #7548:
URL: https://github.com/apache/arrow-rs/pull/7548
# Which issue does this PR close?
Closes #7547
# Rationale for this change
Explained in the issue.
# What changes are included in this PR?
Pretty simple change from `Result` to `std::result::Result` to prevent the 'name collision' on the code/text generated from the macro.
# Are there any user-facing changes?
None that I can think of.
Please let me know if there is anything else you might want/need on my end! and thank you very much for this project.
--
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
Re: [PR] Fix `Result` name collision in parquet_derive [arrow-rs]
Posted by "jspaezp (via GitHub)" <gi...@apache.org>.
jspaezp commented on code in PR #7548:
URL: https://github.com/apache/arrow-rs/pull/7548#discussion_r2109811423
##########
parquet_derive_test/src/lib.rs:
##########
@@ -347,6 +347,36 @@ mod tests {
assert_eq!(drs[0].isize, out[0].isize);
}
+ #[test]
+ fn test_aliased_result() {
+ // Issue 7547, Where aliasing the `Result` led to
+ // a collision with the macro internals of derive ParquetRecordReader
+
+ mod aliased_result {
+ use parquet_derive::{ParquetRecordReader, ParquetRecordWriter};
+ pub type Result = std::result::Result<(), Box<dyn std::error::Error>>;
Review Comment:
Did the modification but left the other one commented out so there is a bit more historical context (hope thats ok)
--
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
Re: [PR] Fix `Result` name collision in parquet_derive [arrow-rs]
Posted by "jspaezp (via GitHub)" <gi...@apache.org>.
jspaezp commented on PR #7548:
URL: https://github.com/apache/arrow-rs/pull/7548#issuecomment-2910944319
@alamb thanks for the fast reply! I added a test (added it in parquet_derive_test/src/lib.rs rather than parquet-derive/test/macro_hygene.rs).
LMK if this is what you had in mind!
--
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
Re: [PR] Fix `Result` name collision in parquet_derive [arrow-rs]
Posted by "mbrobbel (via GitHub)" <gi...@apache.org>.
mbrobbel merged PR #7548:
URL: https://github.com/apache/arrow-rs/pull/7548
--
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
Re: [PR] Fix `Result` name collision in parquet_derive [arrow-rs]
Posted by "crepererum (via GitHub)" <gi...@apache.org>.
crepererum commented on code in PR #7548:
URL: https://github.com/apache/arrow-rs/pull/7548#discussion_r2108883176
##########
parquet_derive_test/src/lib.rs:
##########
@@ -347,6 +347,36 @@ mod tests {
assert_eq!(drs[0].isize, out[0].isize);
}
+ #[test]
+ fn test_aliased_result() {
+ // Issue 7547, Where aliasing the `Result` led to
+ // a collision with the macro internals of derive ParquetRecordReader
+
+ mod aliased_result {
+ use parquet_derive::{ParquetRecordReader, ParquetRecordWriter};
+ pub type Result = std::result::Result<(), Box<dyn std::error::Error>>;
+
+ #[derive(ParquetRecordReader, ParquetRecordWriter, Debug)]
+ pub struct ARecord {
+ pub bool: bool,
+ pub string: String,
+ }
+
+ impl ARecord {
+ pub fn validate(&self) -> Result {
Review Comment:
```suggestion
pub fn validate(&self) -> std::result::Result<(), Box<dyn std::error::Error>> {
```
(so it doesn't use our `Result` shadow)
##########
parquet_derive_test/src/lib.rs:
##########
@@ -347,6 +347,36 @@ mod tests {
assert_eq!(drs[0].isize, out[0].isize);
}
+ #[test]
+ fn test_aliased_result() {
+ // Issue 7547, Where aliasing the `Result` led to
+ // a collision with the macro internals of derive ParquetRecordReader
+
+ mod aliased_result {
+ use parquet_derive::{ParquetRecordReader, ParquetRecordWriter};
+ pub type Result = std::result::Result<(), Box<dyn std::error::Error>>;
Review Comment:
```suggestion
// not an actual result type
pub type Result = ();
```
--
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
Re: [PR] Fix `Result` name collision in parquet_derive [arrow-rs]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on PR #7548:
URL: https://github.com/apache/arrow-rs/pull/7548#issuecomment-2909210311
Thank you for the contribution @jspaezp
This code looks good to me. Is there any chance you can make a test for this (that would fail if we accidentally broke this feature)? Perhaps you could make a small `parquet-derive/test/macro_hygene.rs` style test , similarly to https://github.com/apache/datafusion/blob/main/datafusion/core/tests/macro_hygiene/mod.rs
--
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