Skip to content

Commit 4d52792

Browse files
committed
test(upsert): cover exact composite match filter recursion
1 parent 221ec1b commit 4d52792

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

tests/table/test_upsert.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -595,6 +595,35 @@ def test_upsert_large_composite_key_initial_scan_does_not_recurse(tmp_path: Posi
595595
assert result.returncode == 0, f"stdout:\n{result.stdout}\nstderr:\n{result.stderr}"
596596

597597

598+
def test_create_match_filter_large_composite_key_binds_without_recursing() -> None:
599+
script = textwrap.dedent(
600+
"""
601+
import pyarrow as pa
602+
603+
from pyiceberg.expressions.visitors import bind
604+
from pyiceberg.io.pyarrow import expression_to_pyarrow
605+
from pyiceberg.schema import Schema
606+
from pyiceberg.table.upsert_util import create_match_filter
607+
from pyiceberg.types import LongType, NestedField
608+
609+
n = 30_000
610+
table = pa.table({
611+
"order_id": pa.array(range(n), type=pa.int64()),
612+
"order_line_id": pa.array(range(100_000, 100_000 + n), type=pa.int64()),
613+
})
614+
expr = create_match_filter(table, ["order_id", "order_line_id"])
615+
schema = Schema(
616+
NestedField(1, "order_id", LongType(), required=False),
617+
NestedField(2, "order_line_id", LongType(), required=False),
618+
)
619+
expression_to_pyarrow(bind(schema, expr, case_sensitive=True))
620+
"""
621+
)
622+
result = subprocess.run([sys.executable, "-c", script], capture_output=True, text=True, check=False)
623+
624+
assert result.returncode == 0, f"stdout:\n{result.stdout}\nstderr:\n{result.stderr}"
625+
626+
598627
def test_upsert_with_duplicate_rows_in_table(catalog: Catalog) -> None:
599628
identifier = "default.test_upsert_with_duplicate_rows_in_table"
600629

0 commit comments

Comments
 (0)