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 2021/06/28 15:52:06 UTC

[GitHub] [incubator-doris] morningman commented on a change in pull request #6051: [Bug-fix] Decimal Divide, Mod Zero Result Should be NULL.

morningman commented on a change in pull request #6051:
URL: https://github.com/apache/incubator-doris/pull/6051#discussion_r659909692



##########
File path: be/src/runtime/decimalv2_value.cpp
##########
@@ -192,7 +192,7 @@ DecimalV2Value operator/(const DecimalV2Value& v1, const DecimalV2Value& v2) {
     int128_t x = v1.value();
     int128_t y = v2.value();
 
-    //todo: return 0 for divide zero
+    DCHECK(y != 0);
     if (x == 0 || y == 0) return DecimalV2Value(0);

Review comment:
       ```suggestion
       if (x == 0) return DecimalV2Value(0);
   ```

##########
File path: be/src/runtime/decimalv2_value.cpp
##########
@@ -207,7 +207,7 @@ DecimalV2Value operator%(const DecimalV2Value& v1, const DecimalV2Value& v2) {
     int128_t x = v1.value();
     int128_t y = v2.value();
 
-    //todo: return 0 for divide zero
+    DCHECK(y != 0);
     if (x == 0 || y == 0) return DecimalV2Value(0);

Review comment:
       ```suggestion
       if (x == 0) return DecimalV2Value(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