You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by "amorynan (via GitHub)" <gi...@apache.org> on 2023/06/27 04:02:48 UTC

[GitHub] [doris] amorynan commented on a diff in pull request #21109: [Improve](serde)update serialize and deserialize text for data type

amorynan commented on code in PR #21109:
URL: https://github.com/apache/doris/pull/21109#discussion_r1243114148


##########
be/src/vec/data_types/serde/data_type_number_serde.cpp:
##########
@@ -92,6 +95,63 @@ void DataTypeNumberSerDe<T>::write_column_to_arrow(const IColumn& column, const
     }
 }
 
+template <typename T>
+Status DataTypeNumberSerDe<T>::deserialize_one_cell_from_text(IColumn& column, ReadBuffer& rb,
+                                                              const FormatOptions& options) const {
+    auto& column_data = reinterpret_cast<ColumnType&>(column);
+    if constexpr (std::is_same<T, UInt128>::value) {
+        // TODO: support for Uint128
+        return Status::InvalidArgument("uint128 is not support");
+    } else if constexpr (std::is_same_v<T, float> || std::is_same_v<T, double>) {
+        T val = 0;
+        if (!read_float_text_fast_impl(val, rb)) {
+            return Status::InvalidArgument("parse number fail, string: '{}'",
+                                           std::string(rb.position(), rb.count()).c_str());
+        }
+        column_data.insert_value(val);
+    } else if constexpr (std::is_same_v<T, uint8_t>) {
+        // Note: here we should handle the bool type
+        T val = 0;
+        if (!try_read_bool_text(val, rb)) {

Review Comment:
   inner try_read_bool_text() we just make judge rb == 0 || rb == 1 , and return true or false , so will not result error, but here now we think uint_8 equals bool , just keep same with data_type_number_base.cpp from_string behavior, but I do not sure when I get a false ,like '123' , can we just insert into vector<uint8> column? is that much ambiguity for uint8 and bool ?



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