raminqaf opened a new pull request, #29277:
URL: https://github.com/apache/flink/pull/29277
## What is the purpose of the change
`Variant.toJson()` prints the zero offset of `TIMESTAMP_LTZ` and
`TIMESTAMP_LTZ_NS` values as `+00:00`. This PR changes it to `Z`.
`Z` is the canonical UTC marker in RFC 3339 and ISO 8601. It is also what
`Instant.toString()`, `DateTimeFormatter.ISO_OFFSET_DATE_TIME` and most JSON
libraries emit. Flink itself already uses `Z` for `JSON_STRING` on a plain
`TIMESTAMP_LTZ` column, so `VARIANT` output now matches it.
| Value | Before
| After |
|--------------------------------------|-----------------------------------------|------------------------------------|
| `TIMESTAMP_LTZ` at epoch | `"1970-01-01T00:00:00+00:00"`
| `"1970-01-01T00:00:00Z"` |
| `TIMESTAMP_LTZ_NS` at epoch + 123 ns |
`"1970-01-01T00:00:00.123456789+00:00"` | `"1970-01-01T00:00:00.123456789Z"` |
`VARIANT` is new in Flink 2.x. Aligning the format now is cheaper than
changing it once users depend on it.
## Brief change log
- `BinaryVariantUtil.TIMESTAMP_LTZ_FORMATTER` uses `Z` as the no-offset text.
- `BinaryVariantTest` expectations updated.
## Verifying this change
This change is already covered by existing tests.
`BinaryVariantTest#testToJsonScalar` asserts the exact output for both types.
It fails before the test update and passes after.
The downstream `VARIANT` tests also pass unchanged: `VariantSemanticTest`,
`CastFunctionITCase`, `CastRulesTest`, `JsonFunctionsITCase`,
`ProcessTableFunctionSemanticTests`, `CalcRestoreTest`, `RawFormat*Test`,
`JsonRowDataSerDeSchemaTest`, `AvroToVariantDataConvertersTest`.
## Does this pull request potentially affect one of the following parts:
- Dependencies (does it add or upgrade a dependency): no
- The public API, i.e., is any changed class annotated with
`@Public(Evolving)`: no. The signature is unchanged, but the string output of
`@PublicEvolving` `Variant.toJson()` changes.
- The serializers: no
- The runtime per-record code paths (performance sensitive): no
- Anything that affects deployment or recovery: JobManager (and its
components), Checkpointing, Kubernetes/Yarn, ZooKeeper: no
- The S3 file system connector: no
## Documentation
- Does this pull request introduce a new feature? no
- If yes, how is the feature documented? not applicable
---
##### Was generative AI tooling used to
- [X] Yes (please specify the tool belo
Generated-by: Claude Opus 5.5
--
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]