pitrou commented on a change in pull request #11688:
URL: https://github.com/apache/arrow/pull/11688#discussion_r766039157



##########
File path: python/pyarrow/_dataset.pyx
##########
@@ -75,6 +70,59 @@ def _get_orc_fileformat():
     return _orc_fileformat
 
 
+_dataset_pq = False
+
+
+def _get_parquet_classes():
+    """
+    Import Parquet class files on first usage (to avoid circular import issue
+    when `pyarrow._dataset_parquet` would be imported first)
+    """
+    global _dataset_pq
+    if _dataset_pq is False:
+        try:
+            import pyarrow._dataset_parquet as _dataset_pq
+        except ImportError:
+            _dataset_pq = None
+
+
+def _get_parquet_symbol(name):
+    _get_parquet_classes()
+    return _dataset_pq and getattr(_dataset_pq, name)
+
+
+def _get_parquet_fileformat():
+    """
+    Import ParquetFileFormat on first usage (to avoid circular import issue
+    when `pyarrow._dataset_parquet` would be imported first)
+    """
+    return _get_parquet_symbol('ParquetFileFormat')

Review comment:
       Ah, perhaps indeed.




-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to