|
41 | 41 | from pyiceberg.schema import Schema |
42 | 42 | from pyiceberg.transforms import DayTransform, IdentityTransform |
43 | 43 | from pyiceberg.typedef import Record |
44 | | -from pyiceberg.types import DoubleType, FloatType, IntegerType, NestedField, TimestampType |
| 44 | +from pyiceberg.types import DoubleType, FloatType, IntegerType, NestedField, StringType, TimestampType |
45 | 45 |
|
46 | 46 |
|
47 | 47 | def test_identity_transform_residual() -> None: |
@@ -249,3 +249,16 @@ def test_not_in_timestamp() -> None: |
249 | 249 | ts_day += 3 # type: ignore |
250 | 250 | residual = res_eval.residual_for(Record(ts_day)) |
251 | 251 | assert residual == AlwaysTrue() |
| 252 | + |
| 253 | + |
| 254 | +def test_not_starts_with() -> None: |
| 255 | + schema = Schema(NestedField(1, "x", StringType())) |
| 256 | + spec = PartitionSpec(PartitionField(1, 1001, IdentityTransform(), "x_part")) |
| 257 | + |
| 258 | + predicate = NotStartsWith("x", "a") |
| 259 | + res_eval = residual_evaluator_of(spec=spec, expr=predicate, case_sensitive=True, schema=schema) |
| 260 | + |
| 261 | + assert res_eval.residual_for(Record("bb")) == AlwaysTrue() |
| 262 | + assert res_eval.residual_for(Record("abc")) == AlwaysFalse() |
| 263 | + assert res_eval.residual_for(Record("a")) == AlwaysFalse() |
| 264 | + assert res_eval.residual_for(Record("zoo")) == AlwaysTrue() |
0 commit comments