freesinger commented on code in PR #10322:
URL: https://github.com/apache/doris/pull/10322#discussion_r975637134
##########
be/src/olap/types.h:
##########
@@ -1559,6 +1566,65 @@ struct FieldTypeTraits<OLAP_FIELD_TYPE_STRING> : public
FieldTypeTraits<OLAP_FIE
}
};
+template <>
+struct FieldTypeTraits<OLAP_FIELD_TYPE_JSONB> : public
FieldTypeTraits<OLAP_FIELD_TYPE_VARCHAR> {
+ static int cmp(const void* left, const void* right) {
+ LOG(WARNING) << "can not compare JSONB values";
+ return -1; // always update ?
+ }
+
+ static Status from_string(void* buf, const std::string& scan_key, const
int precision,
+ const int scale) {
+ JsonBinaryValue binary_val(scan_key.c_str(), scan_key.size());
+ auto jdoc = JsonbDocument::createDocument(binary_val.value(),
binary_val.size());
+ size_t value_len = jdoc->numPackedBytes();
+ if (value_len > config::jsonb_type_length_soft_limit_bytes) {
+ LOG(WARNING) << "the len of value json is too long, len=" <<
value_len
+ << ", max_len=" <<
config::jsonb_type_length_soft_limit_bytes;
+ return Status::OLAPInternalError(OLAP_ERR_INPUT_PARAMETER_ERROR);
+ }
+
+ auto slice = reinterpret_cast<Slice*>(buf);
+ memory_copy(slice->data, reinterpret_cast<const
char*>(jdoc->getValue()), value_len);
Review Comment:
jdoc has header
--
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]