Skip to content

PHOENIX-7856 User defined time zone doesn't work for timestamp filed …#2486

Open
mokai87 wants to merge 1 commit into
apache:masterfrom
mokai87:master
Open

PHOENIX-7856 User defined time zone doesn't work for timestamp filed …#2486
mokai87 wants to merge 1 commit into
apache:masterfrom
mokai87:master

Conversation

@mokai87
Copy link
Copy Markdown

@mokai87 mokai87 commented May 21, 2026

…in CSVBulkload

What changes were proposed in this pull request?

a) Refactor DateUtil.parseTimestamp to accept an optional DateTimeParser parameter,
enabling custom timezone-aware timestamp parsing. The nanoseconds extraction logic
was isolated into a separate private method to avoid duplication across code paths.
b) Update CsvUpsertExecutor and JsonUpsertExecutor to pass the user-defined
DateTimeParser into DateUtil.parseTimestamp, so CSV/JSON upsert operations respect
configured timezone settings for timestamp columns.
c) Add unit tests for custom timezone (GMT+8), and nanoseconds preservation.

Why are the changes needed?

The original parseTimestamp always forced UTC timezone, ignoring any user-defined timezone parser configuration. This caused incorrect timestamp values when importing data via CSV/JSON from non-UTC timezones. The refactored method now respects the DateTimeParser's timezone when provided, while maintaining backward compatibility by falling back to UTC when the parser is null.

Does this PR introduce any user-facing change?

After this change, CSV and JSON upsert operations will correctly interpret timestamp values according to the configured timezone parser instead of always treating them as UTC. Users who previously relied on the UTC-only behavior may need to adjust their input data or explicitly set the timezone configuration.

How was this patch tested?

  1. Added unit tests in DateUtilTest to test timestamp parsing with GMT+8
  2. Functional test on local

Was this patch authored or co-authored using generative AI tooling?

Generated-by: OpenCode 1.15.5 + GLM-4.7

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.

1 participant