Skip to content

[FLINK-39492][starrocks] Fix microsecond precision loss for TIMESTAMP types in StarRocks sink#4404

Open
ThorneANN wants to merge 1 commit into
apache:masterfrom
ThorneANN:fix/starrocks-timestamp-precision
Open

[FLINK-39492][starrocks] Fix microsecond precision loss for TIMESTAMP types in StarRocks sink#4404
ThorneANN wants to merge 1 commit into
apache:masterfrom
ThorneANN:fix/starrocks-timestamp-precision

Conversation

@ThorneANN
Copy link
Copy Markdown
Contributor

TIMESTAMP_WITHOUT_TIME_ZONE and TIMESTAMP_WITH_LOCAL_TIME_ZONE fields were
serialized using a hardcoded "yyyy-MM-dd HH:mm:ss" formatter, silently
dropping sub-second precision regardless of the declared column precision.

Add datetimeFormatter(int precision), mirroring the existing timeFormatter,
which appends fractional seconds only when precision > 0. The formatter
instances are cached per precision to avoid repeated allocation.

For StarRocks < 3.1, the fractional part is truncated by the server on
ingestion — no behavioral regression. For StarRocks >= 3.1 (which supports
microsecond DATETIME storage), full precision is now preserved end-to-end.

@ThorneANN ThorneANN changed the title FLINK-39492[starrocks] Fix microsecond precision loss for TIMESTAMP types in StarRocks sink [FLINK-39492][starrocks] Fix microsecond precision loss for TIMESTAMP types in StarRocks sink May 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant