imay commented on a change in pull request #697: Optimize decimal by 
introducing decimal_v2 (#695)
URL: https://github.com/apache/incubator-doris/pull/697#discussion_r263674137
 
 

 ##########
 File path: be/src/udf/udf.h
 ##########
 @@ -687,6 +689,42 @@ struct DecimalVal : public AnyVal {
 
 };
 
+struct DecimalV2Val : public AnyVal {
+
+    __int128 val;
+
+    // Default value is zero
+    DecimalV2Val() : val(0) {}
+
+    const __int128& value() const { return val; }
+
+    DecimalV2Val(__int128 value) : val(value) {}
+
+    static DecimalV2Val null() {
+        DecimalV2Val result;
+        result.is_null = true;
+        return result;
+    }
+    
+    void set_to_zero() {
+        val = 0;
+    }
+    
+    void set_to_abs_value() {
+        if (val < 0) val = -val;
+    }
+
+    bool operator==(const DecimalV2Val& other) const {
+        return val == other.value();
 
 Review comment:
   you must check if this is null, then check val field

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

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

Reply via email to