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/06/02 16:36:41 UTC

[GitHub] [arrow-rs] tustvold opened a new pull request, #4351: Fix ObjectStore::get_range for GetResult::File (#4350)

tustvold opened a new pull request, #4351:
URL: https://github.com/apache/arrow-rs/pull/4351

   # 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 #4350
   
   # 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.
   -->
   
   I'm not a massive fan of this, as `GetResult::bytes()` not taking into account any range feels like a bit of a footgun, however, I couldn't see a way around this without making a breaking change. I may revisit this at a later date, but this at least fixes the bug.
   
   # 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.
   -->
   
   Changes the default implementation of get_range to correctly handle a returned file
   
   # 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] alamb commented on a diff in pull request #4351: Fix ObjectStore::get_range for GetResult::File (#4350)

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on code in PR #4351:
URL: https://github.com/apache/arrow-rs/pull/4351#discussion_r1214627268


##########
object_store/src/lib.rs:
##########
@@ -359,10 +359,16 @@ pub trait ObjectStore: std::fmt::Display + Send + Sync + Debug + 'static {
     /// in the given byte range
     async fn get_range(&self, location: &Path, range: Range<usize>) -> Result<Bytes> {
         let options = GetOptions {
-            range: Some(range),
+            range: Some(range.clone()),
             ..Default::default()
         };
-        self.get_opts(location, options).await?.bytes().await
+        match self.get_opts(location, options).await? {

Review Comment:
   Let's
   1. Document that this is a workaround in comments for our future selves (and others who find this)
   2. Add a ticket to track (I can do so if you wish)



-- 
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 #4351: Fix ObjectStore::get_range for GetResult::File (#4350)

Posted by "tustvold (via GitHub)" <gi...@apache.org>.
tustvold commented on code in PR #4351:
URL: https://github.com/apache/arrow-rs/pull/4351#discussion_r1214625269


##########
object_store/src/lib.rs:
##########
@@ -359,10 +359,16 @@ pub trait ObjectStore: std::fmt::Display + Send + Sync + Debug + 'static {
     /// in the given byte range
     async fn get_range(&self, location: &Path, range: Range<usize>) -> Result<Bytes> {
         let options = GetOptions {
-            range: Some(range),
+            range: Some(range.clone()),
             ..Default::default()
         };
-        self.get_opts(location, options).await?.bytes().await
+        match self.get_opts(location, options).await? {

Review Comment:
   I considered 2. but aside from it also being a breaking change, it would make it hard to support a use-case where you want to do range requests if talking to a remote store to avoid fetching the entire file, but if a local filesystem want to get a file as then you can handle it directly.
   
   I also considered 1. and it is where my thinking is headed, but I would rather not rush into something on Friday afternoon :laughing:
   
   TLDR this is a quick fix, I definitely intend to revisit it at a later date
   



-- 
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 #4351: Fix ObjectStore::get_range for GetResult::File (#4350)

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on code in PR #4351:
URL: https://github.com/apache/arrow-rs/pull/4351#discussion_r1214619522


##########
object_store/src/lib.rs:
##########
@@ -359,10 +359,16 @@ pub trait ObjectStore: std::fmt::Display + Send + Sync + Debug + 'static {
     /// in the given byte range
     async fn get_range(&self, location: &Path, range: Range<usize>) -> Result<Bytes> {
         let options = GetOptions {
-            range: Some(range),
+            range: Some(range.clone()),
             ..Default::default()
         };
-        self.get_opts(location, options).await?.bytes().await
+        match self.get_opts(location, options).await? {

Review Comment:
   This doesn't seem quite right to me -- the issue is if `GetResult::File` returns a file in the first place, because `GetResult::File` doesn't have a way to represent a range of a file.
   
   I think there are two better/cleaner ways:
   1. Add an (optional) range to `GetResult::File`
   2. Update `LocalFileSystem::get_opts` to to not return `GetResult::File` if there is a range and instead return a stream
   
   I think 1 is cleaner but I think it would be an API change and thus require releasing object_store 0.7
   
   



-- 
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 pull request #4351: Fix ObjectStore::get_range for GetResult::File (#4350)

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on PR #4351:
URL: https://github.com/apache/arrow-rs/pull/4351#issuecomment-1574040224

   There appears to be a wasm failure: https://github.com/apache/arrow-rs/actions/runs/5157697965/jobs/9290441031?pr=4351
   


-- 
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 #4351: Fix ObjectStore::get_range for GetResult::File (#4350)

Posted by "tustvold (via GitHub)" <gi...@apache.org>.
tustvold commented on code in PR #4351:
URL: https://github.com/apache/arrow-rs/pull/4351#discussion_r1214625269


##########
object_store/src/lib.rs:
##########
@@ -359,10 +359,16 @@ pub trait ObjectStore: std::fmt::Display + Send + Sync + Debug + 'static {
     /// in the given byte range
     async fn get_range(&self, location: &Path, range: Range<usize>) -> Result<Bytes> {
         let options = GetOptions {
-            range: Some(range),
+            range: Some(range.clone()),
             ..Default::default()
         };
-        self.get_opts(location, options).await?.bytes().await
+        match self.get_opts(location, options).await? {

Review Comment:
   I considered 2. but aside from it also being a breaking change, it would make it hard to support a use-case where you want to do range requests if talking to a remote store to avoid fetching the entire file, but if a local filesystem want to get a file as then you can handle it directly.
   
   I also considered 1. and it is where my thinking is headed, but I would rather not rush into something on Friday afternoon :laughing: 
   



-- 
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 #4351: Fix ObjectStore::get_range for GetResult::File (#4350)

Posted by "tustvold (via GitHub)" <gi...@apache.org>.
tustvold merged PR #4351:
URL: https://github.com/apache/arrow-rs/pull/4351


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