You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "tustvold (via GitHub)" <gi...@apache.org> on 2023/05/22 16:18:53 UTC
[GitHub] [arrow-rs] tustvold opened a new pull request, #4260: Add safe zero-copy converion from bytes::Bytes (#4254)
tustvold opened a new pull request, #4260:
URL: https://github.com/apache/arrow-rs/pull/4260
_Draft as waiting on https://github.com/apache/arrow-rs/issues/4255_
# 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.
-->
Closes #4254
# 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.
-->
# 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.
-->
# Are there any user-facing changes?
<!--
If there are user-facing changes then we may require documentation to be updated before approving the PR.
-->
<!---
If there are any breaking changes to public APIs, please add the `breaking change` label.
-->
--
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-rs] tustvold commented on a diff in pull request #4260: Add safe zero-copy conversion from bytes::Bytes (#4254)
Posted by "tustvold (via GitHub)" <gi...@apache.org>.
tustvold commented on code in PR #4260:
URL: https://github.com/apache/arrow-rs/pull/4260#discussion_r1295804043
##########
arrow-buffer/Cargo.toml:
##########
@@ -34,6 +34,7 @@ path = "src/lib.rs"
bench = false
[dependencies]
+bytes = { version = "1.4" }
Review Comment:
https://github.com/tokio-rs/bytes/issues/437 is the upstream ticket
--
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-rs] tustvold commented on a diff in pull request #4260: Add safe zero-copy conversion from bytes::Bytes (#4254)
Posted by "tustvold (via GitHub)" <gi...@apache.org>.
tustvold commented on code in PR #4260:
URL: https://github.com/apache/arrow-rs/pull/4260#discussion_r1295800195
##########
arrow-buffer/Cargo.toml:
##########
@@ -34,6 +34,7 @@ path = "src/lib.rs"
bench = false
[dependencies]
+bytes = { version = "1.4" }
Review Comment:
Because the bytes crate doesn't allow foreign allocations
--
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-rs] crepererum commented on a diff in pull request #4260: Add safe zero-copy conversion from bytes::Bytes (#4254)
Posted by "crepererum (via GitHub)" <gi...@apache.org>.
crepererum commented on code in PR #4260:
URL: https://github.com/apache/arrow-rs/pull/4260#discussion_r1295799499
##########
arrow-buffer/Cargo.toml:
##########
@@ -34,6 +34,7 @@ path = "src/lib.rs"
bench = false
[dependencies]
+bytes = { version = "1.4" }
Review Comment:
if it's so common, why do we have our own `Bytes` types in the first place?
--
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-rs] tustvold merged pull request #4260: Add safe zero-copy conversion from bytes::Bytes (#4254)
Posted by "tustvold (via GitHub)" <gi...@apache.org>.
tustvold merged PR #4260:
URL: https://github.com/apache/arrow-rs/pull/4260
--
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-rs] alamb commented on a diff in pull request #4260: Add safe zero-copy conversion from bytes::Bytes (#4254)
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on code in PR #4260:
URL: https://github.com/apache/arrow-rs/pull/4260#discussion_r1295803071
##########
arrow-buffer/Cargo.toml:
##########
@@ -34,6 +34,7 @@ path = "src/lib.rs"
bench = false
[dependencies]
+bytes = { version = "1.4" }
Review Comment:
Perhaps we could file a request upstream? I don't see anything related to this functionality in the currently open issues
https://github.com/tokio-rs/bytes/issues?q=is%3Aissue+is%3Aopen+allocation+
--
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-rs] tustvold commented on a diff in pull request #4260: Add safe zero-copy converion from bytes::Bytes (#4254)
Posted by "tustvold (via GitHub)" <gi...@apache.org>.
tustvold commented on code in PR #4260:
URL: https://github.com/apache/arrow-rs/pull/4260#discussion_r1295724833
##########
arrow-buffer/Cargo.toml:
##########
@@ -34,6 +34,7 @@ path = "src/lib.rs"
bench = false
[dependencies]
+bytes = { version = "1.4" }
Review Comment:
This is such a common dependency that I don't see this being overly burdensome
--
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-rs] tustvold commented on a diff in pull request #4260: Add safe zero-copy converion from bytes::Bytes (#4254)
Posted by "tustvold (via GitHub)" <gi...@apache.org>.
tustvold commented on code in PR #4260:
URL: https://github.com/apache/arrow-rs/pull/4260#discussion_r1295724286
##########
arrow-flight/src/decode.rs:
##########
@@ -258,7 +259,7 @@ impl FlightDataDecoder {
));
};
- let buffer: arrow_buffer::Buffer = data.data_body.into();
+ let buffer = Buffer::from_bytes(data.data_body.into());
Review Comment:
This API is kind of unfortunate, but I've not been able to find a good way to workaround the blanket From<AsRef<[u8]>> impl for Buffer
##########
arrow-flight/src/decode.rs:
##########
@@ -258,7 +259,7 @@ impl FlightDataDecoder {
));
};
- let buffer: arrow_buffer::Buffer = data.data_body.into();
+ let buffer = Buffer::from_bytes(data.data_body.into());
Review Comment:
This API is kind of unfortunate, but I've not been able to find a good way to workaround the blanket `From<AsRef<[u8]>>` impl for Buffer
--
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-rs] alamb commented on a diff in pull request #4260: Add safe zero-copy conversion from bytes::Bytes (#4254)
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on code in PR #4260:
URL: https://github.com/apache/arrow-rs/pull/4260#discussion_r1295797628
##########
arrow-buffer/Cargo.toml:
##########
@@ -34,6 +34,7 @@ path = "src/lib.rs"
bench = false
[dependencies]
+bytes = { version = "1.4" }
Review Comment:
https://crates.io/crates/bytes/reverse_dependencies -- crates.io agrees with you ✅
If it causes problems for anyone, we could also put it behind a feature flag, but perhaps we can wait to see if anyone needs that before doing it
##########
arrow-flight/src/decode.rs:
##########
@@ -258,7 +259,7 @@ impl FlightDataDecoder {
));
};
- let buffer: arrow_buffer::Buffer = data.data_body.into();
+ let buffer = Buffer::from_bytes(data.data_body.into());
Review Comment:
👍 I think we can use this API in IOx as well, FWIW.
##########
arrow-flight/src/decode.rs:
##########
@@ -258,7 +259,7 @@ impl FlightDataDecoder {
));
};
- let buffer: arrow_buffer::Buffer = data.data_body.into();
+ let buffer = Buffer::from_bytes(data.data_body.into());
Review Comment:
👍 I think we can use this API in IOx as well, FWIW.
##########
arrow-buffer/Cargo.toml:
##########
@@ -34,6 +34,7 @@ path = "src/lib.rs"
bench = false
[dependencies]
+bytes = { version = "1.4" }
Review Comment:
https://crates.io/crates/bytes/reverse_dependencies -- crates.io agrees with you ✅
If it causes problems for anyone, we could also put it behind a feature flag, but perhaps we can wait to see if anyone needs that before doing it
--
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