Skip to content

Commit f8cee43

Browse files
authored
[feature](ES Catalog) map nested/object type in ES to JSON type in Doris (#37101) (#37182)
backport #37101
1 parent 256221a commit f8cee43

File tree

21 files changed

+241
-141
lines changed

21 files changed

+241
-141
lines changed

be/src/exec/es/es_scroll_parser.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#include "runtime/decimalv2_value.h"
4141
#include "runtime/define_primitive_type.h"
4242
#include "runtime/descriptors.h"
43+
#include "runtime/jsonb_value.h"
4344
#include "runtime/primitive_type.h"
4445
#include "runtime/types.h"
4546
#include "util/binary_cast.hpp"
@@ -799,6 +800,12 @@ Status ScrollParser::fill_columns(const TupleDescriptor* tuple_desc,
799800
col_ptr->insert(array);
800801
break;
801802
}
803+
case TYPE_JSONB: {
804+
JsonBinaryValue binary_val(json_value_to_string(col));
805+
vectorized::JsonbField json(binary_val.value(), binary_val.size());
806+
col_ptr->insert(json);
807+
break;
808+
}
802809
default: {
803810
LOG(ERROR) << "Unsupported data type: " << type_to_string(type);
804811
DCHECK(false);

docker/thirdparties/docker-compose/elasticsearch/scripts/data/data1.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,9 @@
2929
{"name": "Tim", "age": 28}
3030
],
3131
"my_wildcard": "This string can be quite lengthy",
32-
"level": "debug"
32+
"level": "debug",
33+
"c_user": [
34+
{"first": "John", "last": "Smith"},
35+
{"first": "Alice", "last": "White"}
36+
]
3337
}

docker/thirdparties/docker-compose/elasticsearch/scripts/data/data1_es6.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,9 @@
2323
"c_person": [
2424
{"name": "Andy", "age": 18},
2525
{"name": "Tim", "age": 28}
26+
],
27+
"c_user": [
28+
{"first": "John", "last": "Smith"},
29+
{"first": "Alice", "last": "White"}
2630
]
2731
}

docker/thirdparties/docker-compose/elasticsearch/scripts/data/data2.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,9 @@
2828
{"name": "Andy", "age": 18},
2929
{"name": "Tim", "age": 28}
3030
],
31-
"message": ""
31+
"message": "",
32+
"c_user": [
33+
{"first": "John", "last": "Smith"},
34+
{"first": "Alice", "last": "White"}
35+
]
3236
}

docker/thirdparties/docker-compose/elasticsearch/scripts/data/data2_es6.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,9 @@
2424
{"name": "Andy", "age": 18},
2525
{"name": "Tim", "age": 28}
2626
],
27-
"message": ""
27+
"message": "",
28+
"c_user": [
29+
{"first": "John", "last": "Smith"},
30+
{"first": "Alice", "last": "White"}
31+
]
2832
}

docker/thirdparties/docker-compose/elasticsearch/scripts/data/data3.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,9 @@
2828
{"name": "Andy", "age": 18},
2929
{"name": "Tim", "age": 28}
3030
],
31-
"message": "I'm not null or empty"
31+
"message": "I'm not null or empty",
32+
"c_user": [
33+
{"first": "John", "last": "Smith"},
34+
{"first": "Alice", "last": "White"}
35+
]
3236
}

docker/thirdparties/docker-compose/elasticsearch/scripts/data/data3_es5.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,9 @@
2424
{"name": "Andy", "age": 18},
2525
{"name": "Tim", "age": 28}
2626
],
27-
"message": "I'm not null or empty"
27+
"message": "I'm not null or empty",
28+
"c_user": [
29+
{"first": "John", "last": "Smith"},
30+
{"first": "Alice", "last": "White"}
31+
]
2832
}

docker/thirdparties/docker-compose/elasticsearch/scripts/data/data3_es6.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,9 @@
2424
{"name": "Andy", "age": 18},
2525
{"name": "Tim", "age": 28}
2626
],
27-
"message": "I'm not null or empty"
27+
"message": "I'm not null or empty",
28+
"c_user": [
29+
{"first": "John", "last": "Smith"},
30+
{"first": "Alice", "last": "White"}
31+
]
2832
}

docker/thirdparties/docker-compose/elasticsearch/scripts/data/data4.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,9 @@
2727
"c_person": [
2828
{"name": "Andy", "age": 18},
2929
{"name": "Tim", "age": 28}
30+
],
31+
"c_user": [
32+
{"first": "John", "last": "Smith"},
33+
{"first": "Alice", "last": "White"}
3034
]
3135
}

docker/thirdparties/docker-compose/elasticsearch/scripts/index/array_meta.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,8 @@
1616
"c_datetime",
1717
"c_keyword",
1818
"c_text",
19-
"c_ip",
20-
"c_person"
19+
"c_ip"
2120
]
2221
}
2322
}
24-
}
23+
}

0 commit comments

Comments
 (0)