You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2022/05/15 05:53:01 UTC

[GitHub] [incubator-doris] SaintBacchus opened a new pull request, #9574: [Bug] Fix timestamp_diff issue when timeunit is year and month

SaintBacchus opened a new pull request, #9574:
URL: https://github.com/apache/incubator-doris/pull/9574

   # Proposed changes
   
   Issue Number: close #9296
   
   ## Problem Summary:
   `DateTimeValue.to_int64()` will get different value when type is different but the `datetime_diff` treat it as datetime.
   
   
   ## Checklist(Required)
   
   1. Does it affect the original behavior: (No)
   2. Has unit tests been added: (Yes)
   3. Has document been added or modified: (No)
   4. Does it need to update dependencies: (No)
   5. Are there any changes that cannot be rolled back: (No)
   
   ## Further comments
   
   If this is a relatively large or complex change, kick off the discussion at [dev@doris.apache.org](mailto:dev@doris.apache.org) by explaining why you chose the solution you did and what alternatives you considered, etc...
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [incubator-doris] cambyzju commented on pull request #9574: [Bug] Fix timestamp_diff issue when timeunit is year and month

Posted by GitBox <gi...@apache.org>.
cambyzju commented on PR #9574:
URL: https://github.com/apache/incubator-doris/pull/9574#issuecomment-1127153295

   It seems there are the same problem in vectorized engine (file: vdatatime_value.h), could you fix it together?
   
   How to open vectorized engine:
   `set enable_vectorized_engine=true;`


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [incubator-doris] yiguolei commented on a diff in pull request #9574: [Bug] Fix timestamp_diff issue when timeunit is year and month

Posted by GitBox <gi...@apache.org>.
yiguolei commented on code in PR #9574:
URL: https://github.com/apache/incubator-doris/pull/9574#discussion_r877049071


##########
be/src/vec/runtime/vdatetime_value.h:
##########
@@ -288,21 +288,23 @@ class VecDateTimeValue { // Now this type is a temp solution with little changes
         case YEAR: {
             int year = (ts_value2.year() - ts_value1.year());
             if (year > 0) {
-                year -= (ts_value2.to_int64() % 10000000000 - ts_value1.to_int64() % 10000000000) <
-                        0;
+                year -= (ts_value2.to_datetime_int64() % 10000000000 -

Review Comment:
   Sorry for late reply. I will merge it. Thanks for your contribution.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [incubator-doris] yiguolei merged pull request #9574: [Bug] Fix timestamp_diff issue when timeunit is year and month

Posted by GitBox <gi...@apache.org>.
yiguolei merged PR #9574:
URL: https://github.com/apache/incubator-doris/pull/9574


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [incubator-doris] cambyzju commented on pull request #9574: [Bug] Fix timestamp_diff issue when timeunit is year and month

Posted by GitBox <gi...@apache.org>.
cambyzju commented on PR #9574:
URL: https://github.com/apache/incubator-doris/pull/9574#issuecomment-1127302953

   LGTM


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [incubator-doris] SaintBacchus commented on a diff in pull request #9574: [Bug] Fix timestamp_diff issue when timeunit is year and month

Posted by GitBox <gi...@apache.org>.
SaintBacchus commented on code in PR #9574:
URL: https://github.com/apache/incubator-doris/pull/9574#discussion_r876526640


##########
be/src/vec/runtime/vdatetime_value.h:
##########
@@ -288,21 +288,23 @@ class VecDateTimeValue { // Now this type is a temp solution with little changes
         case YEAR: {
             int year = (ts_value2.year() - ts_value1.year());
             if (year > 0) {
-                year -= (ts_value2.to_int64() % 10000000000 - ts_value1.to_int64() % 10000000000) <
-                        0;
+                year -= (ts_value2.to_datetime_int64() % 10000000000 -

Review Comment:
   @yiguolei Is this fix OK to merge?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [incubator-doris] yiguolei commented on a diff in pull request #9574: [Bug] Fix timestamp_diff issue when timeunit is year and month

Posted by GitBox <gi...@apache.org>.
yiguolei commented on code in PR #9574:
URL: https://github.com/apache/incubator-doris/pull/9574#discussion_r874275574


##########
be/src/vec/runtime/vdatetime_value.h:
##########
@@ -288,21 +288,23 @@ class VecDateTimeValue { // Now this type is a temp solution with little changes
         case YEAR: {
             int year = (ts_value2.year() - ts_value1.year());
             if (year > 0) {
-                year -= (ts_value2.to_int64() % 10000000000 - ts_value1.to_int64() % 10000000000) <
-                        0;
+                year -= (ts_value2.to_datetime_int64() % 10000000000 -

Review Comment:
   Why not use to_int64 here? I find it will check the type of datetimevalue. 
   int64_t VecDateTimeValue::to_int64() const {
       switch (_type) {
       case TIME_TIME:
           return to_time_int64();
       case TIME_DATE:
           return to_date_int64();
       case TIME_DATETIME:
           return to_datetime_int64();
       default:
           return 0;
       }
   }
   Are you sure, that the value here is always with TIME_DATETIME type?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [incubator-doris] SaintBacchus commented on a diff in pull request #9574: [Bug] Fix timestamp_diff issue when timeunit is year and month

Posted by GitBox <gi...@apache.org>.
SaintBacchus commented on code in PR #9574:
URL: https://github.com/apache/incubator-doris/pull/9574#discussion_r874299512


##########
be/src/vec/runtime/vdatetime_value.h:
##########
@@ -288,21 +288,23 @@ class VecDateTimeValue { // Now this type is a temp solution with little changes
         case YEAR: {
             int year = (ts_value2.year() - ts_value1.year());
             if (year > 0) {
-                year -= (ts_value2.to_int64() % 10000000000 - ts_value1.to_int64() % 10000000000) <
-                        0;
+                year -= (ts_value2.to_datetime_int64() % 10000000000 -

Review Comment:
   Because the logic of `% 10000000000` is depend on `datetime` type.
   If the type is `date`, this logic should be like this `(ts_value2.to_int64() % 10000 - ts_value1.to_int64() % 10000) < 0`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org