You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/07/27 13:17:42 UTC

[GitHub] [arrow] raulcd commented on a diff in pull request #13629: ARROW-16719: [Python] Add path/URI /+ filesystem handling to parquet.read_metadata

raulcd commented on code in PR #13629:
URL: https://github.com/apache/arrow/pull/13629#discussion_r931047338


##########
python/pyarrow/parquet/__init__.py:
##########
@@ -3453,6 +3471,13 @@ def read_schema(where, memory_map=False, decryption_properties=None):
     n_legs: int64
     animal: string
     """
-    return ParquetFile(
-        where, memory_map=memory_map,
-        decryption_properties=decryption_properties).schema.to_arrow_schema()
+    filesystem, where = _resolve_filesystem_and_path(where, filesystem)
+    source = filesystem.open_input_file(
+        where) if filesystem is not None else where
+    ctx = source if filesystem is not None else nullcontext()

Review Comment:
   I find these lines slightly difficult to follow due to using both `source` and `where` variables and the two inline ifs for the same case, would something like:
   ```
       ctx = nullcontext()
       if filesystem is not None:
           ctx = where = filesystem.open_input_file(where)
   ```
   be slightly more readable?
   In thas case we should use `where` instead of `source` on the `ParquetFile` but this was how it was originally too.



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