This is an automated email from the ASF dual-hosted git repository.

yiguolei pushed a commit to branch branch-3.0.6
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-3.0.6 by this push:
     new bcb86163950 branch-3.0.6: [fix](type) Fix TYPE_DATETIMEV2 upgrade and 
downgrade compatibility (#52531)
bcb86163950 is described below

commit bcb86163950d6451df42371b3a83748dd88d5020
Author: Xinyi Zou <[email protected]>
AuthorDate: Tue Jul 1 08:08:01 2025 +0800

    branch-3.0.6: [fix](type) Fix TYPE_DATETIMEV2 upgrade and downgrade 
compatibility (#52531)
    
    Introduced from https://github.com/apache/doris/pull/49643
    
    ### Check List (For Author)
    
    - Test <!-- At least one of them must be included. -->
        - [ ] Regression test
        - [ ] Unit Test
        - [ ] Manual test (add detailed scripts or steps below)
        - [ ] No need to test or manual test. Explain why:
    - [ ] This is a refactor/code format and no logic has been changed.
            - [ ] Previous test can cover this change.
            - [ ] No code files have been changed.
            - [ ] Other reason <!-- Add your reason?  -->
    
    - Behavior changed:
        - [ ] No.
        - [ ] Yes. <!-- Explain the behavior change -->
    
    - Does this need documentation?
        - [ ] No.
    - [ ] Yes. <!-- Add document PR link here. eg:
    https://github.com/apache/doris-website/pull/1214 -->
    
    ### Check List (For Reviewer who merge this PR)
    
    - [ ] Confirm the release note
    - [ ] Confirm test cases
    - [ ] Confirm document
    - [ ] Add branch pick label <!-- Add branch pick label that this PR
    should merge into -->
---
 be/src/runtime/types.cpp | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/be/src/runtime/types.cpp b/be/src/runtime/types.cpp
index f0112ebd2bc..b64fd139eac 100644
--- a/be/src/runtime/types.cpp
+++ b/be/src/runtime/types.cpp
@@ -167,6 +167,8 @@ void TypeDescriptor::to_thrift(TTypeDesc* thrift_type) 
const {
             scalar_type.__set_scale(scale);
         } else if (type == TYPE_DATETIMEV2) {
             DCHECK_NE(scale, -1);
+            scalar_type.__set_precision(
+                    precision); // -1, adapting upgrade and downgrade 
compatibility.
             scalar_type.__set_scale(scale);
         }
     }
@@ -187,6 +189,7 @@ void TypeDescriptor::to_protobuf(PTypeDesc* ptype) const {
         scalar_type->set_scale(scale);
     } else if (type == TYPE_DATETIMEV2) {
         DCHECK_NE(scale, -1);
+        scalar_type->set_precision(precision); // -1, adapting upgrade and 
downgrade compatibility.
         scalar_type->set_scale(scale);
     } else if (type == TYPE_ARRAY) {
         node->set_type(TTypeNodeType::ARRAY);


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to