Skip to content

Commit e3b9697

Browse files
committed
fix
1 parent 67912a1 commit e3b9697

2 files changed

Lines changed: 11 additions & 4 deletions

File tree

be/src/exprs/table_function/vjson_each.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ void VJsonEachTableFunction<TEXT_MODE>::process_close() {
149149
_json_column = nullptr;
150150
_kv_pairs.first = nullptr;
151151
_kv_pairs.second = nullptr;
152+
_cur_size = 0;
152153
}
153154

154155
template <bool TEXT_MODE>

be/test/exprs/function/table_function_test.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,11 @@
3030
#include "exprs/table_function/vexplode.h"
3131
#include "exprs/table_function/vexplode_numbers.h"
3232
#include "exprs/table_function/vexplode_v2.h"
33+
#include "exprs/table_function/vjson_each.h"
3334
#include "testutil/any_type.h"
35+
#include "util/jsonb_parser_simd.h"
36+
#include "util/jsonb_utils.h"
37+
#include "util/jsonb_writer.h"
3438

3539
namespace doris {
3640

@@ -324,9 +328,10 @@ static std::unique_ptr<Block> build_jsonb_input_block(const std::vector<std::str
324328
str_col->insert_default();
325329
null_col->insert_value(1);
326330
} else {
327-
JsonBinaryValue jbv;
328-
if (jbv.from_json_string(json.c_str(), json.size()).ok()) {
329-
str_col->insert_data(jbv.value(), jbv.size());
331+
JsonbWriter writer;
332+
if (JsonbParser::parse(json.c_str(), json.size(), writer).ok()) {
333+
str_col->insert_data(writer.getOutput()->getBuffer(),
334+
writer.getOutput()->getSize());
330335
null_col->insert_value(0);
331336
} else {
332337
str_col->insert_default();
@@ -402,7 +407,8 @@ static std::vector<std::pair<std::string, std::string>> run_json_each_fn(TableFu
402407
const JsonbDocument* doc = nullptr;
403408
if (JsonbDocument::checkAndCreateDocument(sr.data, sr.size, &doc).ok() && doc &&
404409
doc->getValue()) {
405-
val = JsonbToJson().to_json_string(doc->getValue());
410+
JsonbToJson converter;
411+
val = converter.to_json_string(doc->getValue());
406412
} else {
407413
val = "__BAD_JSONB__";
408414
}

0 commit comments

Comments
 (0)