Commit d9bdf8e
authored
fix: Serialize AlwaysTrue/AlwaysFalse as boolean literals (#2780)
related to #2775
# Rationale for this change
This PR aligns the `AlwaysTrue` and `AlwaysFalse` expression
serialization to use the boolean primitives `true`/`false` instead of
string representation, matching the Iceberg
[ExpressionParser](https://github.com/apache/iceberg/blob/main/core/src/main/java/org/apache/iceberg/expressions/ExpressionParser.java#L101-L108).
I know the spec defines the true/false expressions as string but today
we can't hit the scan planning client endpoint following these models.
I know the spec defines the true/false expressions as a string
representation, but currently we can't successfully use the scan
planning client endpoint with those models. Java's actual implementation
serializes these as boolean literals.
For instance, with what we have today we would throw an illegal argument
exception:
```
{
"snapshot-id": 2540284336700708540,
"filter": "true",
"case-sensitive": true
}
```
Throws: `java.lang.IllegalArgumentException: argument
"content" is null`
But, this works just fine (notice no quotes):
```
{
"snapshot-id": 2540284336700708540,
"filter": true,
"case-sensitive": true
}
```
## Are these changes tested?
Yes
## Are there any user-facing changes?
No, this only affects the JSON serialization format to match Java Cores
behavior.1 parent 59dc8d1 commit d9bdf8e
File tree
2 files changed
+6
-6
lines changed- pyiceberg/expressions
- tests/expressions
2 files changed
+6
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
370 | 370 | | |
371 | 371 | | |
372 | 372 | | |
373 | | - | |
| 373 | + | |
374 | 374 | | |
375 | 375 | | |
376 | | - | |
| 376 | + | |
377 | 377 | | |
378 | 378 | | |
379 | 379 | | |
| |||
388 | 388 | | |
389 | 389 | | |
390 | 390 | | |
391 | | - | |
| 391 | + | |
392 | 392 | | |
393 | 393 | | |
394 | | - | |
| 394 | + | |
395 | 395 | | |
396 | 396 | | |
397 | 397 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
770 | 770 | | |
771 | 771 | | |
772 | 772 | | |
773 | | - | |
| 773 | + | |
774 | 774 | | |
775 | 775 | | |
776 | 776 | | |
| |||
779 | 779 | | |
780 | 780 | | |
781 | 781 | | |
782 | | - | |
| 782 | + | |
783 | 783 | | |
784 | 784 | | |
785 | 785 | | |
| |||
0 commit comments