[fix](orc) Round timestamp nanos to micros#64807
Open
xylaaaaa wants to merge 2 commits into
Open
Conversation
Issue Number: close #xxx Related PR: apache#60915 Problem Summary: Move iceberg_rest_on_hdfs out of the P0 external suite because it requires the dedicated iceberg-rest Docker environment, which is not started by the default community external pipeline. None - Test: Manual test - Verified the suite is declared only under external_table_p2 with group p2,external - Ran git diff --check - Regression test not run because the case requires the dedicated iceberg-rest Docker environment - Behavior changed: No - Does this need documentation: No
Contributor
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposed changes
Fix ORC timestamp decoding to round nanoseconds to Doris microseconds instead of truncating them. This keeps
CAST(timestamp AS VARCHAR)aligned with Hive/Trino prefix expectations for values like2020-01-02 03:04:05.321.The same decode path is used by nested timestamps in array/map/struct columns, so this also covers complex type projections.
Problem summary
ORC stores timestamp fractional seconds as nanoseconds, while Doris
DATETIMEV2(6)keeps microseconds. The previous conversion truncated nanos with/ 1000, so an ORC value such as320999999nsbecame.320999instead of.321000. Prefix predicates like:could therefore miss rows created by Hive/Trino ORC writers.
Solution
999999500nsand above into the next second.TIMESTAMPandTIMESTAMP_INSTANTdecode paths.Test plan
ninja -j 8 doris_be_test./be/ut_build_RELEASE/test/doris_be_test --gtest_filter='OrcReaderFillDataTest.TestTimestampNanosecondsRoundToMicroseconds'./be/ut_build_RELEASE/test/doris_be_test --gtest_filter='OrcReaderFillDataTest.*'git diff --check