This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch branch-1.2-lts
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-1.2-lts by this push:
new 8f2b829b50d [fix](export)fix core when export jsonb field (#29365)
8f2b829b50d is described below
commit 8f2b829b50dfd1b4814d71ff86c73817f6129d2a
Author: ryanzryu <[email protected]>
AuthorDate: Wed Jan 3 12:17:41 2024 +0800
[fix](export)fix core when export jsonb field (#29365)
Co-authored-by: ryanzryu <[email protected]>
---
be/src/exec/olap_scanner.cpp | 3 ++-
be/src/olap/field.h | 2 +-
be/src/olap/row_cursor.cpp | 6 +++---
be/src/olap/tablet_schema.h | 3 ++-
be/src/runtime/export_sink.cpp | 2 ++
5 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/be/src/exec/olap_scanner.cpp b/be/src/exec/olap_scanner.cpp
index 1ab514194c8..2f024cf366a 100644
--- a/be/src/exec/olap_scanner.cpp
+++ b/be/src/exec/olap_scanner.cpp
@@ -518,7 +518,8 @@ void OlapScanner::_convert_row_to_tuple(Tuple* tuple) {
case TYPE_OBJECT:
case TYPE_QUANTILE_STATE:
case TYPE_HLL:
- case TYPE_STRING: {
+ case TYPE_STRING:
+ case TYPE_JSONB: {
Slice* slice = reinterpret_cast<Slice*>(ptr);
StringValue* slot =
tuple->get_string_slot(slot_desc->tuple_offset());
slot->ptr = slice->data;
diff --git a/be/src/olap/field.h b/be/src/olap/field.h
index 391f7f45be6..526c679a6a8 100644
--- a/be/src/olap/field.h
+++ b/be/src/olap/field.h
@@ -184,7 +184,7 @@ public:
if (is_null) {
return;
}
- if (type() == OLAP_FIELD_TYPE_STRING) {
+ if (type() == OLAP_FIELD_TYPE_STRING || type() ==
OLAP_FIELD_TYPE_JSONB) {
auto dst_slice = reinterpret_cast<Slice*>(dst->mutable_cell_ptr());
auto src_slice = reinterpret_cast<const Slice*>(src.cell_ptr());
if (dst_slice->size < src_slice->size) {
diff --git a/be/src/olap/row_cursor.cpp b/be/src/olap/row_cursor.cpp
index e9fe2e93963..33f5b0a0c79 100644
--- a/be/src/olap/row_cursor.cpp
+++ b/be/src/olap/row_cursor.cpp
@@ -51,7 +51,7 @@ Status RowCursor::_init(const std::vector<uint32_t>& columns)
{
return Status::Error<INIT_FAILED>();
}
_variable_len += column_schema(cid)->get_variable_len();
- if (_schema->column(cid)->type() == OLAP_FIELD_TYPE_STRING) {
+ if (_schema->column(cid)->type() == OLAP_FIELD_TYPE_STRING ||
_schema->column(cid)->type() == OLAP_FIELD_TYPE_JSONB) {
++_string_field_count;
}
}
@@ -91,7 +91,7 @@ Status RowCursor::_init_scan_key(TabletSchemaSPtr schema,
_variable_len += scan_keys[cid].length();
} else if (type == OLAP_FIELD_TYPE_CHAR || type ==
OLAP_FIELD_TYPE_ARRAY) {
_variable_len += std::max(scan_keys[cid].length(),
column.length());
- } else if (type == OLAP_FIELD_TYPE_STRING) {
+ } else if (type == OLAP_FIELD_TYPE_STRING || type ==
OLAP_FIELD_TYPE_JSONB) {
++_string_field_count;
}
}
@@ -221,7 +221,7 @@ Status
RowCursor::allocate_memory_for_string_type(TabletSchemaSPtr schema) {
char** long_text_ptr = _long_text_buf;
for (auto cid : _schema->column_ids()) {
fixed_ptr = _fixed_buf + _schema->column_offset(cid);
- if (_schema->column(cid)->type() == OLAP_FIELD_TYPE_STRING) {
+ if (_schema->column(cid)->type() == OLAP_FIELD_TYPE_STRING ||
_schema->column(cid)->type() == OLAP_FIELD_TYPE_JSONB) {
Slice* slice = reinterpret_cast<Slice*>(fixed_ptr + 1);
_schema->mutable_column(cid)->set_long_text_buf(long_text_ptr);
slice->data = *(long_text_ptr);
diff --git a/be/src/olap/tablet_schema.h b/be/src/olap/tablet_schema.h
index 2528aecbe19..6fa42ee05b2 100644
--- a/be/src/olap/tablet_schema.h
+++ b/be/src/olap/tablet_schema.h
@@ -58,7 +58,8 @@ public:
bool is_length_variable_type() const {
return _type == OLAP_FIELD_TYPE_CHAR || _type ==
OLAP_FIELD_TYPE_VARCHAR ||
_type == OLAP_FIELD_TYPE_STRING || _type == OLAP_FIELD_TYPE_HLL
||
- _type == OLAP_FIELD_TYPE_OBJECT || _type ==
OLAP_FIELD_TYPE_QUANTILE_STATE;
+ _type == OLAP_FIELD_TYPE_OBJECT || _type ==
OLAP_FIELD_TYPE_QUANTILE_STATE ||
+ _type == OLAP_FIELD_TYPE_JSONB;
}
bool has_default_value() const { return _has_default_value; }
std::string default_value() const { return _default_value; }
diff --git a/be/src/runtime/export_sink.cpp b/be/src/runtime/export_sink.cpp
index f709c182ec9..61e3f4e4c44 100644
--- a/be/src/runtime/export_sink.cpp
+++ b/be/src/runtime/export_sink.cpp
@@ -35,6 +35,8 @@
#include "util/types.h"
#include "util/uid_util.h"
+
+
namespace doris {
ExportSink::ExportSink(ObjectPool* pool, const RowDescriptor& row_desc,
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]