Skip to content

Commit

Permalink
[BugFix](Es Catalog) fix bug that es catalog will return error when q…
Browse files Browse the repository at this point in the history
…uery partial columns (apache#22423)

Bug:
When the value of some ES column is empty, querying these value in doc_values mode will receive an error.

Reson:
In doc values mode, these values are empty, We need to determine if the array is empty
  • Loading branch information
BePPPower authored and qidaye committed Aug 7, 2023
1 parent dab998d commit d2821e9
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions be/src/exec/es/es_scroll_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -489,8 +489,10 @@ Status ScrollParser::fill_columns(const TupleDescriptor* tuple_desc,
// because of reading value from _source, we can not process all json type and then just transfer the value to original string representation
// this may be a tricky, but we can work around this issue
std::string val;
if (pure_doc_value && !col.Empty()) {
if (!col[0].IsString()) {
if (pure_doc_value) {
if (col.Empty()) {
break;
} else if (!col[0].IsString()) {
val = json_value_to_string(col[0]);
} else {
val = col[0].GetString();
Expand Down Expand Up @@ -588,8 +590,10 @@ Status ScrollParser::fill_columns(const TupleDescriptor* tuple_desc,
data.assign_from_double(col.GetDouble());
} else {
std::string val;
if (pure_doc_value && !col.Empty()) {
if (!col[0].IsString()) {
if (pure_doc_value) {
if (col.Empty()) {
break;
} else if (!col[0].IsString()) {
val = json_value_to_string(col[0]);
} else {
val = col[0].GetString();
Expand Down

0 comments on commit d2821e9

Please sign in to comment.