MCPcopy Create free account
hub / github.com/apache/cloudberry / populate_array_element_end

Function populate_array_element_end

src/backend/utils/adt/jsonfuncs.c:2671–2707  ·  view source on GitHub ↗

json array element end handler for populate_array_json() */

Source from the content-addressed store, hash-verified

2669
2670/* json array element end handler for populate_array_json() */
2671static void
2672populate_array_element_end(void *_state, bool isnull)
2673{
2674 PopulateArrayState *state = (PopulateArrayState *) _state;
2675 PopulateArrayContext *ctx = state->ctx;
2676 int ndim = state->lex->lex_level;
2677
2678 Assert(ctx->ndims > 0);
2679
2680 if (ndim == ctx->ndims)
2681 {
2682 JsValue jsv;
2683
2684 jsv.is_json = true;
2685 jsv.val.json.type = state->element_type;
2686
2687 if (isnull)
2688 {
2689 Assert(jsv.val.json.type == JSON_TOKEN_NULL);
2690 jsv.val.json.str = NULL;
2691 jsv.val.json.len = 0;
2692 }
2693 else if (state->element_scalar)
2694 {
2695 jsv.val.json.str = state->element_scalar;
2696 jsv.val.json.len = -1; /* null-terminated */
2697 }
2698 else
2699 {
2700 jsv.val.json.str = state->element_start;
2701 jsv.val.json.len = (state->lex->prev_token_terminator -
2702 state->element_start) * sizeof(char);
2703 }
2704
2705 populate_array_element(ctx, ndim, &jsv);
2706 }
2707}
2708
2709/* json scalar handler for populate_array_json() */
2710static void

Callers

nothing calls this directly

Calls 1

populate_array_elementFunction · 0.85

Tested by

no test coverage detected