Skip to content

Commit c64d7f0

Browse files
nyamashinyamashimartindurant
authored
add seekable for ArrowFile (#1154)
Co-authored-by: nyamashi <[email protected]> Co-authored-by: Martin Durant <[email protected]>
1 parent 274e2d2 commit c64d7f0

2 files changed

Lines changed: 23 additions & 1 deletion

File tree

‎fsspec/implementations/arrow.py‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,18 @@ def modified(self, path):
200200

201201

202202
@mirror_from(
203-
"stream", ["read", "seek", "tell", "write", "readable", "writable", "close", "size"]
203+
"stream",
204+
[
205+
"read",
206+
"seek",
207+
"tell",
208+
"write",
209+
"readable",
210+
"writable",
211+
"close",
212+
"size",
213+
"seekable",
214+
],
204215
)
205216
class ArrowFile(io.IOBase):
206217
def __init__(self, fs, stream, path, mode, block_size=None, **kwargs):

‎fsspec/implementations/tests/test_arrow.py‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,3 +219,14 @@ def test_open_seekable(fs, remote_dir):
219219
with fs.open(remote_dir + "/a.txt", "rb", seekable=True) as file:
220220
file.seek(2)
221221
assert file.read() == data[2:]
222+
223+
224+
def test_seekable(fs, remote_dir):
225+
data = b"dvc.org"
226+
227+
with fs.open(remote_dir + "/a.txt", "wb") as stream:
228+
stream.write(data)
229+
230+
for seekable in [True, False]:
231+
with fs.open(remote_dir + "/a.txt", "rb", seekable=seekable) as file:
232+
assert file.seekable() == seekable

0 commit comments

Comments
 (0)