|
30 | 30 | #include "exprs/table_function/vexplode.h" |
31 | 31 | #include "exprs/table_function/vexplode_numbers.h" |
32 | 32 | #include "exprs/table_function/vexplode_v2.h" |
| 33 | +#include "exprs/table_function/vjson_each.h" |
33 | 34 | #include "testutil/any_type.h" |
| 35 | +#include "util/jsonb_parser_simd.h" |
| 36 | +#include "util/jsonb_utils.h" |
| 37 | +#include "util/jsonb_writer.h" |
34 | 38 |
|
35 | 39 | namespace doris { |
36 | 40 |
|
@@ -324,9 +328,10 @@ static std::unique_ptr<Block> build_jsonb_input_block(const std::vector<std::str |
324 | 328 | str_col->insert_default(); |
325 | 329 | null_col->insert_value(1); |
326 | 330 | } 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()); |
330 | 335 | null_col->insert_value(0); |
331 | 336 | } else { |
332 | 337 | str_col->insert_default(); |
@@ -402,7 +407,8 @@ static std::vector<std::pair<std::string, std::string>> run_json_each_fn(TableFu |
402 | 407 | const JsonbDocument* doc = nullptr; |
403 | 408 | if (JsonbDocument::checkAndCreateDocument(sr.data, sr.size, &doc).ok() && doc && |
404 | 409 | doc->getValue()) { |
405 | | - val = JsonbToJson().to_json_string(doc->getValue()); |
| 410 | + JsonbToJson converter; |
| 411 | + val = converter.to_json_string(doc->getValue()); |
406 | 412 | } else { |
407 | 413 | val = "__BAD_JSONB__"; |
408 | 414 | } |
|
0 commit comments