|
71 | 71 | BoundStartsWith, |
72 | 72 | EqualTo, |
73 | 73 | GreaterThan, |
| 74 | + GreaterThanOrEqual, |
74 | 75 | In, |
75 | 76 | IsNull, |
| 77 | + LessThan, |
76 | 78 | LessThanOrEqual, |
77 | 79 | Not, |
78 | 80 | NotEqualTo, |
@@ -3728,6 +3730,32 @@ def test_scan_filters_on_infinity(catalog: InMemoryCatalog) -> None: |
3728 | 3730 | assert sorted(table.scan(row_filter=In("x", {math.inf, 1.5})).to_arrow()["x"].to_pylist()) == [1.5, math.inf] |
3729 | 3731 |
|
3730 | 3732 |
|
| 3733 | +def test_scan_and_delete_filters_on_infinity(catalog: InMemoryCatalog) -> None: |
| 3734 | + schema = Schema( |
| 3735 | + NestedField(id=1, name="id", field_type=IntegerType(), required=False), |
| 3736 | + NestedField(id=2, name="x", field_type=FloatType(), required=False), |
| 3737 | + ) |
| 3738 | + catalog.create_namespace("default") |
| 3739 | + table = catalog.create_table("default.test_scan_and_delete_infinity", schema=schema) |
| 3740 | + table.append( |
| 3741 | + pa.table( |
| 3742 | + { |
| 3743 | + "id": pa.array([1, 2, 3, 4, 5], type=pa.int32()), |
| 3744 | + "x": pa.array([1.5, math.inf, -math.inf, math.nan, None], type=pa.float32()), |
| 3745 | + } |
| 3746 | + ) |
| 3747 | + ) |
| 3748 | + |
| 3749 | + assert table.scan(row_filter=LessThan("x", math.inf)).to_arrow()["id"].to_pylist() == [1, 3] |
| 3750 | + assert table.scan(row_filter=LessThanOrEqual("x", math.inf)).to_arrow()["id"].to_pylist() == [1, 2, 3] |
| 3751 | + assert table.scan(row_filter=GreaterThan("x", -math.inf)).to_arrow()["id"].to_pylist() == [1, 2] |
| 3752 | + assert table.scan(row_filter=GreaterThanOrEqual("x", math.inf)).to_arrow()["id"].to_pylist() == [2] |
| 3753 | + |
| 3754 | + table.delete(LessThan("x", math.inf)) |
| 3755 | + |
| 3756 | + assert table.scan().to_arrow()["id"].to_pylist() == [2, 4, 5] |
| 3757 | + |
| 3758 | + |
3731 | 3759 | def test_scan_filters_at_the_end_of_the_date_range(catalog: InMemoryCatalog) -> None: |
3732 | 3760 | schema = Schema(NestedField(id=1, name="x", field_type=DateType(), required=False)) |
3733 | 3761 | spec = PartitionSpec(PartitionField(source_id=1, field_id=1000, transform=YearTransform(), name="x_year")) |
|
0 commit comments