Skip to content

ORC-2213: [C++] Add option to read timestamps with writer timezone#2699

Closed
wgtmac wants to merge 1 commit into
apache:mainfrom
wgtmac:ORC-2213
Closed

ORC-2213: [C++] Add option to read timestamps with writer timezone#2699
wgtmac wants to merge 1 commit into
apache:mainfrom
wgtmac:ORC-2213

Conversation

@wgtmac

@wgtmac wgtmac commented Jul 20, 2026

Copy link
Copy Markdown
Member

What changes were proposed in this pull request?

Add a RowReaderOptions flag that lets timestamp readers use the writer timezone recorded in each stripe footer instead of the configured reader timezone. This preserves the stored timestamp value for callers that need to avoid ORC timestamp timezone conversion.

Why are the changes needed?

In old days, ORC only supports orc::TIMESTAMP type. The semantics of orc::TIMESTAMP is equivalent to TIMESTAMP_NTZ but with a complex writer and reader timezone adjustment. So it is difficult to support both TIMESTAMP_NTZ and TIMESTAMP_LTZ types using a single orc::TIMESTAMP. In later versions, orc::TIMESTAMP_INSTANT has been added to support TIMESTAMP_LTZ type. However, users may not know the difference under the hood and still use legacy systems to write both TIMESTAMP_LTZ and TIMESTAMP_NTZ semantics to the old orc::TIMESTAMP type. When users use orc::TIMESTAMP as TIMESTAMP_LTZ values, we should set reader timezone to the writer timezone to avoid value conversion. However, users may not know the writer timezone in advance and ORC files may have different writer timezone (considering files are produced by teams in different time zones.) We need an approach to enforce reader to use writer timezone via explicit configuration.

How was this patch tested?

Added a new test case.

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

Generated-by: Codex GPT-5.6 Sol

Add a RowReaderOptions flag that lets timestamp readers use the writer
timezone recorded in each stripe footer instead of the configured reader
timezone. This preserves the stored timestamp value for callers that need
to avoid ORC timestamp timezone conversion.

@ffacs ffacs left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM.

@dongjoon-hyun dongjoon-hyun left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

+1, LGTM.

@dongjoon-hyun dongjoon-hyun added this to the 3.0.0 milestone Jul 21, 2026
@wgtmac wgtmac closed this in 3738b82 Jul 22, 2026
wgtmac added a commit that referenced this pull request Jul 22, 2026
### What changes were proposed in this pull request?

Add a RowReaderOptions flag that lets timestamp readers use the writer timezone recorded in each stripe footer instead of the configured reader timezone. This preserves the stored timestamp value for callers that need to avoid ORC timestamp timezone conversion.

### Why are the changes needed?

In old days, ORC only supports orc::TIMESTAMP type. The semantics of orc::TIMESTAMP is equivalent to TIMESTAMP_NTZ but with a complex writer and reader timezone adjustment.  So it is difficult to support both TIMESTAMP_NTZ and TIMESTAMP_LTZ types using a single orc::TIMESTAMP. In later versions, orc::TIMESTAMP_INSTANT has been added to support TIMESTAMP_LTZ type. However, users may not know the difference under the hood and still use legacy systems to write both TIMESTAMP_LTZ and TIMESTAMP_NTZ semantics to the old orc::TIMESTAMP type. When users use orc::TIMESTAMP as TIMESTAMP_LTZ values, we should set reader timezone to the writer timezone to avoid value conversion. However, users may not know the writer timezone in advance and ORC files may have different writer timezone (considering files are produced by teams in different time zones.) We need an approach to enforce reader to use writer timezone via explicit configuration.

### How was this patch tested?

Added a new test case.

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

Generated-by: Codex GPT-5.6 Sol

Closes #2699 from wgtmac/ORC-2213.

Authored-by: Gang Wu <ustcwg@gmail.com>
Signed-off-by: Gang Wu <ustcwg@gmail.com>
(cherry picked from commit 3738b82)
Signed-off-by: Gang Wu <ustcwg@gmail.com>
@wgtmac

wgtmac commented Jul 22, 2026

Copy link
Copy Markdown
Member Author

Thank you, @ffacs and @dongjoon-hyun!

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