zclllyybb commented on code in PR #53654:
URL: https://github.com/apache/doris/pull/53654#discussion_r2220833677
##########
be/src/vec/functions/cast/cast_to_boolean.h:
##########
@@ -18,9 +18,104 @@
#pragma once
#include "cast_base.h"
+#include "vec/core/types.h"
+#include "vec/io/io_helper.h"
namespace doris::vectorized {
+struct CastToBool {
+ template <class SRC>
+ static inline bool from_number(const SRC& from, UInt8& to, CastParameters&
params);
+
+ template <class SRC>
+ static inline bool from_decimal(const SRC& from, UInt8& to, UInt32
precision, UInt32 scale,
+ CastParameters& params);
+
+ static inline bool from_string(const StringRef& from, UInt8& to,
CastParameters& params);
+};
+
+template <>
+inline bool CastToBool::from_number(const UInt8& from, UInt8& to,
CastParameters&) {
+ to = from;
+ return true;
+}
+
+template <>
+inline bool CastToBool::from_number(const Int8& from, UInt8& to,
CastParameters&) {
Review Comment:
这些整数类型,是不是可以用requires合并成一个啊?
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]