Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix](export)fix core when export jsonb field #29365

Merged
merged 1 commit into from
Jan 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion be/src/exec/olap_scanner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion be/src/olap/field.h
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ class Field {
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) {
Expand Down
6 changes: 3 additions & 3 deletions be/src/olap/row_cursor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down Expand Up @@ -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;
}
}
Expand Down Expand Up @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion be/src/olap/tablet_schema.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ class TabletColumn {
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; }
Expand Down
2 changes: 2 additions & 0 deletions be/src/runtime/export_sink.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
#include "util/types.h"
#include "util/uid_util.h"



namespace doris {

ExportSink::ExportSink(ObjectPool* pool, const RowDescriptor& row_desc,
Expand Down
Loading