laskoviymishka opened a new pull request, #2783: URL: https://github.com/apache/iceberg-go/pull/2783
`encoding/json` writes the float values 0.0 and 1.0 as `0` and `1`. The spec (Appendix D) allows any JSON number for float and double, but Java's `SingleValueParser` requires a fraction or an exponent and rejects `0` and `1`. So a v3 table created by iceberg-go with a float or double default of 0.0 writes `"initial-default": 0` into metadata.json, which Java's `SchemaParser` fails to read. A REST scan-planning filter such as `d = 1.0` is sent as `"value": 1`, which a Java REST server's `ExpressionParser` rejects. `Float32Literal` and `Float64Literal` now append `.0` when the encoded number has no fraction or exponent, and `NestedField` does the same for float and double `initial-default` and `write-default`. Int defaults also decode to `float64`, so the default check is gated on the field type and int defaults are still written as ints. Reading is unchanged. Floats nested inside list, map or struct defaults built in Go are not changed here. Relaxing the Java reader is being discussed on dev@: https://lists.apache.org/thread/1dn6c2ytq0qpwgvv2tqr9wvyswdxhh2t. This change keeps iceberg-go readable by Java versions that are already deployed. New tests cover whole-number, zero, negative-zero and exponent values for literals and defaults, and check that an int default stays an int. `go test ./...` and `golangci-lint run` pass. This pull request and its description were written by Isaac. -- 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]
