koarz commented on code in PR #47320:
URL: https://github.com/apache/doris/pull/47320#discussion_r1944762960


##########
be/src/vec/functions/function_date_or_datetime_computation.h:
##########
@@ -995,4 +995,32 @@ class CurrentDateFunctionBuilder : public 
FunctionBuilderImpl {
     }
 };
 
+class FunctionTime : public IFunction {
+public:
+    static constexpr auto name = "time";
+    static FunctionPtr create() { return std::make_shared<FunctionTime>(); }
+    String get_name() const override { return name; }
+    size_t get_number_of_arguments() const override { return 1; }
+
+    DataTypePtr get_return_type_impl(const DataTypes& arguments) const 
override {
+        return std::make_shared<DataTypeTimeV2>();
+    }
+
+    Status execute_impl(FunctionContext* context, Block& block, const 
ColumnNumbers& arguments,
+                        uint32_t result, size_t input_rows_count) const 
override {
+        DCHECK_EQ(arguments.size(), 1);
+        ColumnPtr col = block.get_by_position(arguments[0]).column;
+        const auto* arg = assert_cast<const ColumnUInt64*>(col.get());
+        auto res = ColumnFloat64::create(input_rows_count);
+        auto& res_data = res->get_data();
+        for (int i = 0; i < arg->size(); i++) {
+            auto v = arg->get_element(i);
+            res_data[i] = TimeValue::make_time((v & 0x1f00000000) >> 32, (v & 
0xfc000000) >> 26,

Review Comment:
   If the time function is not needed to support constant folding, we can merge 
this pr first



-- 
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