Skip to content

Commit e4eb226

Browse files
committed
Addressed minor comments
1 parent 84ae86d commit e4eb226

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

pyiceberg/io/pyarrow.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2144,7 +2144,7 @@ def _dataframe_to_data_files(
21442144

21452145

21462146
@dataclass(frozen=True)
2147-
class TablePartition:
2147+
class _TablePartition:
21482148
partition_key: PartitionKey
21492149
arrow_table_partition: pa.Table
21502150

@@ -2154,7 +2154,7 @@ def _get_table_partitions(
21542154
partition_spec: PartitionSpec,
21552155
schema: Schema,
21562156
slice_instructions: list[dict[str, Any]],
2157-
) -> list[TablePartition]:
2157+
) -> list[_TablePartition]:
21582158
sorted_slice_instructions = sorted(slice_instructions, key=lambda x: x["offset"])
21592159

21602160
partition_fields = partition_spec.fields
@@ -2175,11 +2175,11 @@ def _get_table_partitions(
21752175
for partition_field in partition_fields
21762176
]
21772177
partition_key = PartitionKey(raw_partition_field_values=fieldvalues, partition_spec=partition_spec, schema=schema)
2178-
table_partitions.append(TablePartition(partition_key=partition_key, arrow_table_partition=partition_slice))
2178+
table_partitions.append(_TablePartition(partition_key=partition_key, arrow_table_partition=partition_slice))
21792179
return table_partitions
21802180

21812181

2182-
def _determine_partitions(spec: PartitionSpec, schema: Schema, arrow_table: pa.Table) -> List[TablePartition]:
2182+
def _determine_partitions(spec: PartitionSpec, schema: Schema, arrow_table: pa.Table) -> List[_TablePartition]:
21832183
"""Based on the iceberg table partition spec, slice the arrow table into partitions with their keys.
21842184
21852185
Example:
@@ -2235,6 +2235,6 @@ def _determine_partitions(spec: PartitionSpec, schema: Schema, arrow_table: pa.T
22352235
last = reversed_indices[ptr]
22362236
ptr = ptr + group_size
22372237

2238-
table_partitions: List[TablePartition] = _get_table_partitions(arrow_table, spec, schema, slice_instructions)
2238+
table_partitions: List[_TablePartition] = _get_table_partitions(arrow_table, spec, schema, slice_instructions)
22392239

22402240
return table_partitions

tests/io/test_pyarrow.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1723,8 +1723,6 @@ def test_bin_pack_arrow_table(arrow_table_with_null: pa.Table) -> None:
17231723

17241724

17251725
def test_partition_for_demo() -> None:
1726-
import pyarrow as pa
1727-
17281726
test_pa_schema = pa.schema([("year", pa.int64()), ("n_legs", pa.int64()), ("animal", pa.string())])
17291727
test_schema = Schema(
17301728
NestedField(field_id=1, name="year", field_type=StringType(), required=False),
@@ -1757,8 +1755,6 @@ def test_partition_for_demo() -> None:
17571755

17581756

17591757
def test_identity_partition_on_multi_columns() -> None:
1760-
import pyarrow as pa
1761-
17621758
test_pa_schema = pa.schema([("born_year", pa.int64()), ("n_legs", pa.int64()), ("animal", pa.string())])
17631759
test_schema = Schema(
17641760
NestedField(field_id=1, name="born_year", field_type=StringType(), required=False),

0 commit comments

Comments
 (0)