nssalian commented on code in PR #3119:
URL: https://github.com/apache/iceberg-python/pull/3119#discussion_r3103353127


##########
pyiceberg/io/fileformat.py:
##########
@@ -0,0 +1,182 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+"""File Format API for writing Iceberg data files."""
+
+from __future__ import annotations
+
+from abc import ABC, abstractmethod
+from dataclasses import dataclass
+from typing import TYPE_CHECKING, Any
+
+from pyiceberg.io import OutputFile
+from pyiceberg.manifest import FileFormat
+from pyiceberg.partitioning import PartitionField, PartitionSpec, 
partition_record_value
+from pyiceberg.schema import Schema
+from pyiceberg.typedef import Properties, Record
+
+if TYPE_CHECKING:
+    import pyarrow as pa
+
+    from pyiceberg.io.pyarrow import StatsAggregator
+
+
+@dataclass(frozen=True)
+class DataFileStatistics:
+    record_count: int
+    column_sizes: dict[int, int]
+    value_counts: dict[int, int]
+    null_value_counts: dict[int, int]
+    nan_value_counts: dict[int, int]
+    column_aggregates: dict[int, StatsAggregator]

Review Comment:
   The rest of the class (to_serialized_dict(), counts, sizes) is already 
format-agnostic. It's just the `column_aggregates` that is the concern.
   
   For this PR, it's a pure move with no behavioral change. When I'm adding ORC 
write support, I'll refactor `_partition_value()` to work from serialized 
bounds (or define a minimal protocol that both Parquet row group stats and ORC 
stripe stats can satisfy). That way the refactor happens alongside a concrete 
second format.
   
   Let me know what you think.



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to