Skip to content
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
7 changes: 7 additions & 0 deletions be/src/exec/es/es_scroll_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
#include "runtime/decimalv2_value.h"
#include "runtime/define_primitive_type.h"
#include "runtime/descriptors.h"
#include "runtime/jsonb_value.h"
#include "runtime/primitive_type.h"
#include "runtime/types.h"
#include "util/binary_cast.hpp"
Expand Down Expand Up @@ -800,6 +801,12 @@ Status ScrollParser::fill_columns(const TupleDescriptor* tuple_desc,
col_ptr->insert(array);
break;
}
case TYPE_JSONB: {
JsonBinaryValue binary_val(json_value_to_string(col));
vectorized::JsonbField json(binary_val.value(), binary_val.size());
col_ptr->insert(json);
break;
}
default: {
LOG(ERROR) << "Unsupported data type: " << type_to_string(type);
DCHECK(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,9 @@
{"name": "Tim", "age": 28}
],
"my_wildcard": "This string can be quite lengthy",
"level": "debug"
"level": "debug",
"c_user": [
{"first": "John", "last": "Smith"},
{"first": "Alice", "last": "White"}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,9 @@
"c_person": [
{"name": "Andy", "age": 18},
{"name": "Tim", "age": 28}
],
"c_user": [
{"first": "John", "last": "Smith"},
{"first": "Alice", "last": "White"}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,9 @@
{"name": "Andy", "age": 18},
{"name": "Tim", "age": 28}
],
"message": ""
"message": "",
"c_user": [
{"first": "John", "last": "Smith"},
{"first": "Alice", "last": "White"}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,9 @@
{"name": "Andy", "age": 18},
{"name": "Tim", "age": 28}
],
"message": ""
"message": "",
"c_user": [
{"first": "John", "last": "Smith"},
{"first": "Alice", "last": "White"}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,9 @@
{"name": "Andy", "age": 18},
{"name": "Tim", "age": 28}
],
"message": "I'm not null or empty"
"message": "I'm not null or empty",
"c_user": [
{"first": "John", "last": "Smith"},
{"first": "Alice", "last": "White"}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,9 @@
{"name": "Andy", "age": 18},
{"name": "Tim", "age": 28}
],
"message": "I'm not null or empty"
"message": "I'm not null or empty",
"c_user": [
{"first": "John", "last": "Smith"},
{"first": "Alice", "last": "White"}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,9 @@
{"name": "Andy", "age": 18},
{"name": "Tim", "age": 28}
],
"message": "I'm not null or empty"
"message": "I'm not null or empty",
"c_user": [
{"first": "John", "last": "Smith"},
{"first": "Alice", "last": "White"}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,9 @@
"c_person": [
{"name": "Andy", "age": 18},
{"name": "Tim", "age": 28}
],
"c_user": [
{"first": "John", "last": "Smith"},
{"first": "Alice", "last": "White"}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@
"c_datetime",
"c_keyword",
"c_text",
"c_ip",
"c_person"
"c_ip"
]
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@
"type": "integer"
}
}
},
"c_user": {
"type": "nested"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@
"ignore_above": 256
}
}
},
"c_user": {
"type": "nested"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@
"type": "integer"
}
}
},
"c_user": {
"type": "nested"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@
"type": "integer"
}
}
},
"c_user": {
"type": "nested"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@
"level": {
"type": "constant_keyword",
"value": "debug"
},
"c_user": {
"type": "nested"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@
"type": "integer"
}
}
},
"c_user": {
"type": "nested"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ public void analyze(boolean isOlap) throws AnalysisException {

if (type.getPrimitiveType() == PrimitiveType.JSONB
|| type.getPrimitiveType() == PrimitiveType.VARIANT) {
if (isKey()) {
if (isOlap && isKey()) {
throw new AnalysisException("JSONB or VARIANT type should not be used in key column[" + getName()
+ "].");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -293,17 +293,19 @@ private static Column parseEsField(String fieldName, ObjectNode fieldValue, List
case "keyword":
case "text":
case "ip":
case "nested":
case "object":
case "wildcard":
case "constant_keyword":
type = ScalarType.createStringType();
break;
case "nested":
case "object":
type = Type.JSONB;
break;
default:
type = Type.UNSUPPORTED;
}
} else {
type = Type.STRING;
type = Type.JSONB;
column.setComment("Elasticsearch no type");
}
if (arrayFields.contains(fieldName)) {
Expand Down
Loading