Fokko commented on code in PR #931: URL: https://github.com/apache/iceberg-python/pull/931#discussion_r1680739942
########## tests/integration/test_writes/test_partitioned_writes.py: ########## @@ -181,6 +181,73 @@ def test_query_filter_appended_null_partitioned( assert len(rows) == 6 +@pytest.mark.integration +@pytest.mark.parametrize( + "part_col", + [ + "int", + "bool", + "string", + "string_long", + "long", + "float", + "double", + "date", + "timestamp", + "binary", + "timestamptz", + ], +) +@pytest.mark.parametrize( + "format_version", + [1, 2], +) +def test_query_filter_dynamic_overwrite_null_partitioned( + session_catalog: Catalog, spark: SparkSession, arrow_table_with_null: pa.Table, part_col: str, format_version: int +) -> None: + # Given + identifier = f"default.arrow_table_v{format_version}_appended_with_null_partitioned_on_col_{part_col}" + nested_field = TABLE_SCHEMA.find_field(part_col) + partition_spec = PartitionSpec( + PartitionField(source_id=nested_field.field_id, field_id=1001, transform=IdentityTransform(), name=part_col) + ) + + # When + tbl = _create_table( + session_catalog=session_catalog, + identifier=identifier, + properties={"format-version": str(format_version)}, + data=[], + partition_spec=partition_spec, + ) + # Append with arrow_table_1 with lines [A,B,C] and then arrow_table_2 with lines[A,B,C,A,B,C] + tbl.append(arrow_table_with_null) + tbl.append(pa.concat_tables([arrow_table_with_null, arrow_table_with_null])) + # Then + assert tbl.format_version == format_version, f"Expected v{format_version}, got: v{tbl.format_version}" + df = spark.table(identifier) + for col in arrow_table_with_null.column_names: + df = spark.table(identifier) Review Comment: Makes the tests a faster :) ```suggestion ``` ########## tests/integration/test_writes/test_partitioned_writes.py: ########## @@ -181,6 +181,73 @@ def test_query_filter_appended_null_partitioned( assert len(rows) == 6 +@pytest.mark.integration +@pytest.mark.parametrize( + "part_col", + [ + "int", + "bool", + "string", + "string_long", + "long", + "float", + "double", + "date", + "timestamp", + "binary", + "timestamptz", + ], +) +@pytest.mark.parametrize( + "format_version", + [1, 2], +) +def test_query_filter_dynamic_overwrite_null_partitioned( + session_catalog: Catalog, spark: SparkSession, arrow_table_with_null: pa.Table, part_col: str, format_version: int +) -> None: + # Given + identifier = f"default.arrow_table_v{format_version}_appended_with_null_partitioned_on_col_{part_col}" + nested_field = TABLE_SCHEMA.find_field(part_col) + partition_spec = PartitionSpec( + PartitionField(source_id=nested_field.field_id, field_id=1001, transform=IdentityTransform(), name=part_col) + ) + + # When + tbl = _create_table( + session_catalog=session_catalog, + identifier=identifier, + properties={"format-version": str(format_version)}, + data=[], + partition_spec=partition_spec, + ) + # Append with arrow_table_1 with lines [A,B,C] and then arrow_table_2 with lines[A,B,C,A,B,C] + tbl.append(arrow_table_with_null) + tbl.append(pa.concat_tables([arrow_table_with_null, arrow_table_with_null])) + # Then + assert tbl.format_version == format_version, f"Expected v{format_version}, got: v{tbl.format_version}" + df = spark.table(identifier) + for col in arrow_table_with_null.column_names: + df = spark.table(identifier) Review Comment: Makes the tests a bit faster :) ```suggestion ``` -- 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-unsubscr...@iceberg.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For additional commands, e-mail: issues-h...@iceberg.apache.org