File tree 1 file changed +12
-0
lines changed
1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -335,6 +335,11 @@ def _open(
335
335
self ._metadata .update_file (path , detail )
336
336
logger .debug ("Creating local sparse file for %s" , path )
337
337
338
+ # explicitly submitting the size to the open call will avoid extra
339
+ # operations when opening. This is particularly relevant
340
+ # for any file that is read over a network, e.g. S3.
341
+ size = detail .get ("size" , None )
342
+
338
343
# call target filesystems open
339
344
self ._mkcache ()
340
345
f = self .fs ._open (
@@ -344,8 +349,15 @@ def _open(
344
349
autocommit = autocommit ,
345
350
cache_options = cache_options ,
346
351
cache_type = "none" ,
352
+ size = size ,
347
353
** kwargs ,
348
354
)
355
+
356
+ # set size if not already set
357
+ if size is None :
358
+ detail ["size" ] = f .size
359
+ self ._metadata .update_file (path , detail )
360
+
349
361
if self .compression :
350
362
comp = (
351
363
infer_compression (path )
You can’t perform that action at this time.
0 commit comments