You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@arrow.apache.org by "r2evans (via GitHub)" <gi...@apache.org> on 2025/04/15 15:33:02 UTC

[I] fcntl difference between collect and read_parquet [arrow]

r2evans opened a new issue, #46149:
URL: https://github.com/apache/arrow/issues/46149

   ### Describe the bug, including details regarding any error messages, version, and platform.
   
   I'm using `sshfs` to read parquet files remotely. Using `sshfs-2.10` (and FUSE 2.9.9), everything works fine.
   
   I updated to macfuse-4.10.2 and sshfs-3.7.3 (from https://macfuse.github.io/), `read_parquet` works but `open_dataset() |> collect()` fails with:
   
   ```
   ### truncated for privacy reasons, but this works completely
   str(arrow::read_parquet("/sshfs/path/to/file.pq")[0,])
   # Classes ‘data.table’ and 'data.frame':	0 obs. of  10 variables:
   #  $ Name                : chr 
   #  $ Coordinates         : chr 
   #  $ Type                : int 
   #  $ Enabled             : logi 
   #  $ TrackAbbrev         : chr 
   #  $ TrackName           : chr 
   #  $ TrackId             : chr 
   #  $ SessionId           : chr 
   #  $ TrackConfigurationId: chr 
   #  $ ModifiedTime        : 'POSIXct' num(0) 
   #  - attr(*, "tzone")= chr "UTC"
   
   ### open_dataset works, collect does not
   arr <- arrow::open_dataset("/sshfs/path/to/file.pq")
   arr
   # FileSystemDataset with 1 Parquet file
   # 10 columns
   # Name: string
   # Coordinates: string
   # Type: int32
   # Enabled: bool
   # TrackAbbrev: string
   # TrackName: string
   # TrackId: string
   # SessionId: string
   # TrackConfigurationId: string
   # ModifiedTime: timestamp[us, tz=UTC]
   # See $metadata for additional Schema metadata
   
   collect(arr)
   # Error in `compute.Dataset()`:
   # ! IOError: fcntl(fd, F_RDADVISE, ...) failed. Detail: [errno 22] Invalid argument
   # Run `rlang::last_trace()` to see where the error occurred.
   
   rlang::last_trace(drop=FALSE)
   # <error/rlang_error>
   # Error in `compute.Dataset()`:
   # ! IOError: fcntl(fd, F_RDADVISE, ...) failed. Detail: [errno 22] Invalid argument
   # ---
   # Backtrace:
   #      ▆
   #   1. ├─dplyr::collect(arrow::open_dataset("/sshfs/path/to/file.pq"))
   #   2. └─arrow:::collect.Dataset(arrow::open_dataset("/sshfs/path/to/file.pq"))
   #   3.   ├─arrow:::collect.ArrowTabular(compute.Dataset(x), as_data_frame)
   #   4.   └─arrow:::compute.Dataset(x)
   #   5.     └─base::tryCatch(...)
   #   6.       └─base (local) tryCatchList(expr, classes, parentenv, handlers)
   #   7.         └─base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]])
   #   8.           └─value[[3L]](cond)
   #   9.             └─arrow:::augment_io_error_msg(e, call, schema = schema())
   #  10.               └─rlang::abort(msg, call = call)
   ```
   
   Versions:
   
   ```r
   packageVersion("arrow")
   # [1] ‘19.0.1.1’
   packageVersion("dplyr")
   # [1] ‘1.1.4’
   R.version
   #                _                           
   # platform       aarch64-apple-darwin20      
   # arch           aarch64                     
   # os             darwin20                    
   # system         aarch64, darwin20           
   # status                                     
   # major          4                           
   # minor          4.3                         
   # year           2025                        
   # month          02                          
   # day            28                          
   # svn rev        87843                       
   # language       R                           
   # version.string R version 4.4.3 (2025-02-28)
   # nickname       Trophy Case                 
   ```
   
   I've not found another file access that fails (on various file formats).
   
   I don't know that it's _not_ a bug in `sshfs`, perhaps there's a specific system call that `collect()` uses that others do not. I'm not familiar enough with the underlying code to be able to parse that out. Can somebody help to understand and qualify that aspect of the problem?
   
   ### Component(s)
   
   R


-- 
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: issues-unsubscribe@arrow.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [C++] Opening dataset fails with sshfs-3.7.3 due to F_RDADVISE error [arrow]

Posted by "thisisnic (via GitHub)" <gi...@apache.org>.
thisisnic commented on issue #46149:
URL: https://github.com/apache/arrow/issues/46149#issuecomment-2844913791

   I'll give it a go!


-- 
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: [I] [R] fcntl difference between collect and read_parquet [arrow]

Posted by "thisisnic (via GitHub)" <gi...@apache.org>.
thisisnic commented on issue #46149:
URL: https://github.com/apache/arrow/issues/46149#issuecomment-2834208001

   Hi @r2evans, thanks for reporting this.
   
   Strange error and odd that you get 2 different behaviours between the two functions.
   
   My initial guess is that, as `read_parquet()` reads the file immediately into memory and `open_dataset()` scans the path and then later retrieves the data, there's something weird happening with the connection there.
   
   I'm not familiar with `fcntl` and asked chatGPT - now I don't know if this is accurate, but the gist of the answer is that `fcntl` is used to manipulate file descriptors and `F_RDADVISE` is an optimisation concerned with prefetching parts of an offset into cache.  Here, the version of sshfs you mention doesn't support `F_RDADVISE` properly, and so it fails entirely but really what we should be doing is skipping this optimisation.
   
   If this interpretation is correct, I'm unsure whether this should be fixed on the sshfs side where the `F_RDADVISE` isn't working as expected or for arrow to fail gracefully or skip the optimisation, but pinging @pitrou to check if any of this is accurate before I suggest concrete action here.  
   
   The section in the code that is the source of the error:
   
   https://github.com/apache/arrow/blob/6e84d990379a0fe20a0a89311aa864f40efded23/cpp/src/arrow/io/file.cc#L275-L282


-- 
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: [I] [C++] Opening dataset fails with sshfs-3.7.3 due to F_RDADVISE error [arrow]

Posted by "r2evans (via GitHub)" <gi...@apache.org>.
r2evans commented on issue #46149:
URL: https://github.com/apache/arrow/issues/46149#issuecomment-2841411741

   I'd be lying if I said I was comfortable with exception handling in C++ ... while I'm eager to help, I'm not well suited to start that PR :-(
   
   Thank you for the direction, I hope somebody is able to take that and run with 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


Re: [I] [C++] Opening dataset fails with sshfs-3.7.3 due to F_RDADVISE error [arrow]

Posted by "pitrou (via GitHub)" <gi...@apache.org>.
pitrou commented on issue #46149:
URL: https://github.com/apache/arrow/issues/46149#issuecomment-2841292221

   Ok, I agree the error shouldn't prevent from reading the dataset. We should relax this.


-- 
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: [I] [C++] Opening dataset fails with sshfs-3.7.3 due to F_RDADVISE error [arrow]

Posted by "thisisnic (via GitHub)" <gi...@apache.org>.
thisisnic closed issue #46149: [C++] Opening dataset fails with sshfs-3.7.3 due to F_RDADVISE error
URL: https://github.com/apache/arrow/issues/46149


-- 
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: issues-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [C++] Opening dataset fails with sshfs-3.7.3 due to F_RDADVISE error [arrow]

Posted by "thisisnic (via GitHub)" <gi...@apache.org>.
thisisnic commented on issue #46149:
URL: https://github.com/apache/arrow/issues/46149#issuecomment-2872706379

   Issue resolved by pull request 46346
   https://github.com/apache/arrow/pull/46346


-- 
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: [I] [C++] Opening dataset fails with sshfs-3.7.3 due to F_RDADVISE error [arrow]

Posted by "r2evans (via GitHub)" <gi...@apache.org>.
r2evans commented on issue #46149:
URL: https://github.com/apache/arrow/issues/46149#issuecomment-2835256802

   Thanks @thisisnic , your understanding of `fcntl` is spot-on (this is one case chatgpt did not hallucinate :-D ).
   
   > I'm unsure whether this should be fixed on the sshfs side where the `F_RDADVISE` isn't working as expected or for arrow to fail gracefully or skip the optimisation
   
   Yes, that's what I was thinking when I said _"I don't know that it's not a bug in sshfs"_, but I wanted to make sure. And since I don't understand all of the inner workings. I will likely go to `sshfs`-devs in a bit, but wanted to make sure this error wasn't a red-herring for something else `open_dataset()` might be doing that I don't understand. Thanks again!


-- 
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: [I] [C++] Opening dataset fails with sshfs-3.7.3 due to F_RDADVISE error [arrow]

Posted by "pitrou (via GitHub)" <gi...@apache.org>.
pitrou commented on issue #46149:
URL: https://github.com/apache/arrow/issues/46149#issuecomment-2841381149

   So, it looks like this could be relaxed by ignoring `WillNeed` errors in `ReadRangeCache::Cache`. This should be a relatively easy fix.


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