Skip to content

[Fix] Adapt Arrow timestamp conversion for DATETIME and TIMESTAMPTZ - #676

Merged
JNSimba merged 2 commits into
apache:masterfrom
JNSimba:timestamp-vector-conversion
Jul 22, 2026
Merged

JNSimba merged 2 commits into
apache:masterfrom
JNSimba:timestamp-vector-conversion

Conversation

@JNSimba

@JNSimba JNSimba commented Jul 21, 2026 •

Copy link
Copy Markdown
Member

Proposed changes

Background:

PR apache/doris#38215 added timezone support to datetime. Versions prior to this PR hardcoded the use of TimeStampMicroVector, whereas subsequent versions return TimeStampTZVector. Consequently, to ensure compatibility, the connector inferred the time unit based on the timestamp itself.

Changes:

Since datetime is inherently timezone-agnostic, PR apache/doris#65823 removed the timezone from datetime, causing it to return a native timestamp; timestamptz continues to return TimeStampTZVector.

Connector Adaptation:

No conversion is performed if there is no timezone; the existing default conversion logic is applied if a timezone is present.

Impact:

Reading datetime data may result in errors on versions prior to PR apache/doris#38215.

Checklist(Required)

  1. Does it affect the original behavior: Yes
  2. Has unit tests been added: Yes
  3. Has document been added or modified: No Need
  4. Does it need to update dependencies: No
  5. Are there any changes that cannot be rolled back: No

Further comments

None.

@JNSimba JNSimba changed the title [Fix] Handle Arrow timestamp timezone metadata [Fix] Adapt Arrow timestamp conversion for DATETIME and TIMESTAMPTZ Jul 21, 2026
@JNSimba
JNSimba requested a review from Copilot July 22, 2026 02:06

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adapts the Flink Doris connector’s Arrow timestamp-to-LocalDateTime conversion to distinguish between timezone-aware (TIMESTAMPTZ) and timezone-less (DATETIME/DATETIMEV2) Arrow Timestamp vectors, aligning behavior with upstream Doris changes around datetime timezone handling.

Changes:

  • Update timestamp conversion to use Arrow Timestamp metadata (unit + presence/absence of timezone) rather than inferring precision from the numeric value.
  • Add TIMESTAMPTZ handling alongside DATETIMEV2 in RowBatch conversion logic.
  • Extend/adjust unit tests to cover both non-TZ timestamp vectors and TZ timestamp vectors across second/milli/micro units.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
flink-doris-connector/flink-doris-connector-base/src/main/java/org/apache/doris/flink/serialization/RowBatch.java Updates conversion logic for Arrow timestamps (unit-aware) and adds TIMESTAMPTZ support with “no conversion when timezone is absent” behavior.
flink-doris-connector/flink-doris-connector-base/src/test/java/org/apache/doris/flink/serialization/TestRowBatch.java Updates datetime-related tests and adds coverage for timestamp vectors with and without timezone across multiple time units.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@JNSimba
JNSimba merged commit 825b7bb into apache:master Jul 22, 2026
8 checks passed
@JNSimba JNSimba mentioned this pull request Aug 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants