You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
dynamic_partition_overwrite after an in-transaction update_spec loses rows #4192
Currently, Transaction.dynamic_partition_overwrite partitions its files with the committed spec but builds its delete filter with the transaction's, so the new row's a = 1 is read as b = 1 and the row with b = 1 is deleted. Committing update_spec first gives the right rows.
importtempfileimportpyarrowaspafrompyiceberg.catalog.sqlimportSqlCatalogfrompyiceberg.partitioningimportPartitionField, PartitionSpecfrompyiceberg.schemaimportSchemafrompyiceberg.transformsimportIdentityTransformfrompyiceberg.typesimportLongType, NestedFieldcat=SqlCatalog("c", uri="sqlite:///:memory:", warehouse=f"file://{tempfile.mkdtemp()}")
cat.create_namespace("ns")
schema=Schema(NestedField(1, "a", LongType()), NestedField(2, "b", LongType()))
t=cat.create_table("ns.t", schema=schema, partition_spec=PartitionSpec(PartitionField(1, 1000, IdentityTransform(), "a")))
df=lambda*rs: pa.Table.from_pylist([{"a": a, "b": b} fora, binrs], schema=schema.as_arrow())
t.append(df((1, 9), (2, 1)))
witht.transaction() astx:
withtx.update_spec() asu:
u.remove_field("a")
u.add_identity("b")
tx.dynamic_partition_overwrite(df((1, 2)))
rows=lambdaf="True": sorted((r["a"], r["b"]) forrint.scan(row_filter=f).to_arrow().to_pylist())
print(rows())
# [(1, 2), (1, 9)], should be [(1, 2), (1, 9), (2, 1)]print(rows("b == 2"))
# [], should be [(1, 2)]# the new file is recorded under b = 1, its a value
After an in-transaction add_column it raises ValueError: Could not find field with name: w.
tested on pyiceberg 0.12.0 and main
Willingness to contribute
I can contribute a fix for this bug independently
I would be willing to contribute a fix for this bug with guidance from the Iceberg community
I cannot contribute a fix for this bug at this time
Activity