You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by "rdblue (via GitHub)" <gi...@apache.org> on 2023/01/27 00:19:03 UTC

[GitHub] [iceberg] rdblue commented on a diff in pull request #6673: Python: Optimize PyArrow reads

rdblue commented on code in PR #6673:
URL: https://github.com/apache/iceberg/pull/6673#discussion_r1088468333


##########
python/pyiceberg/io/pyarrow.py:
##########
@@ -493,31 +495,32 @@ def _file_to_table(
             )
         file_schema = Schema.parse_raw(schema_raw)
 
-    pyarrow_filter = None
-    if bound_row_filter is not AlwaysTrue():
-        translated_row_filter = translate_column_names(bound_row_filter, file_schema, case_sensitive=case_sensitive)
-        bound_file_filter = bind(file_schema, translated_row_filter, case_sensitive=case_sensitive)
-        pyarrow_filter = expression_to_pyarrow(bound_file_filter)
-
-    file_project_schema = prune_columns(file_schema, projected_field_ids, select_full_types=False)
-
-    if file_schema is None:
-        raise ValueError(f"Missing Iceberg schema in Metadata for file: {path}")
-
-    # Prune the stuff that we don't need anyway
-    file_project_schema_arrow = schema_to_pyarrow(file_project_schema)
-
-    read_options = {
-        "pre_buffer": True,
-        "use_buffered_stream": True,
-        "buffer_size": 8388608,
-    }
+        pyarrow_filter = None
+        dnf_filter = None
+        if bound_row_filter is not AlwaysTrue():
+            translated_row_filter = translate_column_names(bound_row_filter, file_schema, case_sensitive=case_sensitive)
+            bound_file_filter = bind(file_schema, translated_row_filter, case_sensitive=case_sensitive)
+            dnf_filter = to_plain_format(rewrite_to_dnf(bound_file_filter), cast_int_to_datetime=True)
+            pyarrow_filter = expression_to_pyarrow(bound_file_filter)
+
+        file_project_schema = prune_columns(file_schema, projected_field_ids, select_full_types=False)
+
+        if file_schema is None:
+            raise ValueError(f"Missing Iceberg schema in Metadata for file: {path}")
+
+        arrow_table = pq.read_table(
+            source=fout,

Review Comment:
   :rocket: 



-- 
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@iceberg.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org