geruh opened a new pull request, #14677: URL: https://github.com/apache/iceberg/pull/14677
## Summary This PR updates the REST spec so the `AlwaysTrue()` and `AlwaysFalse()` expressions match how [`ExpressionParser`](https://github.com/apache/iceberg/blob/main/core/src/main/java/org/apache/iceberg/expressions/ExpressionParser.java#L101-L108) actually serializes them. While testing scan planning, I ran into an exception when sending filters that followed the current models, since the spec shows these expressions represented as strings (i.e. "true"). But looks like the parser expects literal boolean values instead and I see success with that. While testing scan planning, I ran into an exception when sending filters that followed the current spec models, since the spec shows these expressions represented as objects with a `type` field (e.g., `{"type": "true"}`). However, the Java `ExpressionParser` actually expects literal boolean primitives `true`/`false` and successfully parses them. Alternatively, we could modify the expression parser to follow the REST spec as it stands today. However, the `ExpressionParser` has been in the client for quite some time. Serializing expressions in a few places such as the metrics API with the scan report, and in Flink. ## Testing **Serialize a true expression to json type bool:** ``` > ExpressionParser.toJson(Expressions.alwaysTrue(), true) true ``` **Deserialize from what the models expect fails:** ``` > ExpressionParser.fromJson("\"true\"") java.lang.IllegalArgumentException: Cannot parse expression from non-object: "true" ``` **Pass in json boolean type pass:** ``` ExpressionParser.fromJson("true") true ``` Curious to hear what others think about this! -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
