github-actions[bot] commented on code in PR #26827:
URL: https://github.com/apache/doris/pull/26827#discussion_r1390349704


##########
be/src/vec/functions/function_timestamp.cpp:
##########
@@ -17,24 +17,29 @@
 
 #include <glog/logging.h>

Review Comment:
   warning: 'glog/logging.h' file not found [clang-diagnostic-error]
   ```cpp
   #include <glog/logging.h>
            ^
   ```
   



##########
be/src/vec/functions/function_timestamp.cpp:
##########
@@ -570,6 +576,99 @@
 struct UnixTimeStampDateImpl {
     static DataTypes get_variadic_argument_types() { return 
{std::make_shared<DateType>()}; }
 
+    static DataTypePtr get_return_type_impl(const ColumnsWithTypeAndName& 
arguments) {
+        if constexpr (std::is_same_v<DateType, DataTypeDateTimeV2>) {
+            if (arguments[0].type->is_nullable()) {
+                UInt32 scale = static_cast<const 
DataTypeNullable*>(arguments[0].type.get())
+                                       ->get_nested_type()
+                                       ->get_scale();
+                return make_nullable(
+                        std::make_shared<DataTypeDecimal<Decimal64>>(10 + 
scale, scale));

Review Comment:
   warning: 10 is a magic number; consider replacing it with a named constant 
[readability-magic-numbers]
   ```cpp
                           std::make_shared<DataTypeDecimal<Decimal64>>(10 + 
scale, scale));
                                                                        ^
   ```
   



##########
be/src/vec/functions/function_timestamp.cpp:
##########
@@ -570,6 +576,99 @@
 struct UnixTimeStampDateImpl {
     static DataTypes get_variadic_argument_types() { return 
{std::make_shared<DateType>()}; }
 
+    static DataTypePtr get_return_type_impl(const ColumnsWithTypeAndName& 
arguments) {
+        if constexpr (std::is_same_v<DateType, DataTypeDateTimeV2>) {
+            if (arguments[0].type->is_nullable()) {
+                UInt32 scale = static_cast<const 
DataTypeNullable*>(arguments[0].type.get())
+                                       ->get_nested_type()
+                                       ->get_scale();
+                return make_nullable(
+                        std::make_shared<DataTypeDecimal<Decimal64>>(10 + 
scale, scale));
+            }
+            UInt32 scale = arguments[0].type->get_scale();
+            return std::make_shared<DataTypeDecimal<Decimal64>>(10 + scale, 
scale);

Review Comment:
   warning: 10 is a magic number; consider replacing it with a named constant 
[readability-magic-numbers]
   ```cpp
               return std::make_shared<DataTypeDecimal<Decimal64>>(10 + scale, 
scale);
                                                                   ^
   ```
   



##########
be/src/vec/functions/function_timestamp.cpp:
##########
@@ -773,6 +925,13 @@
         return Impl::get_variadic_argument_types();
     }
 
+    bool use_default_implementation_for_nulls() const override {
+        if constexpr (std::is_same_v<Impl, UnixTimeStampStrImpl>){
+            return false;

Review Comment:
   warning: redundant boolean literal in conditional return statement 
[readability-simplify-boolean-expr]
   
   be/src/vec/functions/function_timestamp.cpp:928:
   ```diff
   -         if constexpr (std::is_same_v<Impl, UnixTimeStampStrImpl>){
   -             return false;
   -         }
   -         return true;
   +         return !std::is_same_v<Impl, UnixTimeStampStrImpl>;
   ```
   



-- 
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-unsubscr...@doris.apache.org

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


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

Reply via email to