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

Function populate_array_json

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

parse a json array and populate array */

Source from the content-addressed store, hash-verified

2730
2731/* parse a json array and populate array */
2732static void
2733populate_array_json(PopulateArrayContext *ctx, char *json, int len)
2734{
2735 PopulateArrayState state;
2736 JsonSemAction sem;
2737
2738 state.lex = makeJsonLexContextCstringLen(json, len, GetDatabaseEncoding(), true);
2739 state.ctx = ctx;
2740
2741 memset(&sem, 0, sizeof(sem));
2742 sem.semstate = (void *) &state;
2743 sem.object_start = populate_array_object_start;
2744 sem.array_end = populate_array_array_end;
2745 sem.array_element_start = populate_array_element_start;
2746 sem.array_element_end = populate_array_element_end;
2747 sem.scalar = populate_array_scalar;
2748
2749 pg_parse_json_or_ereport(state.lex, &sem);
2750
2751 /* number of dimensions should be already known */
2752 Assert(ctx->ndims > 0 && ctx->dims);
2753
2754 pfree(state.lex);
2755}
2756
2757/*
2758 * populate_array_dim_jsonb() -- Iterate recursively through jsonb sub-array

Callers 1

populate_arrayFunction · 0.85

Calls 4

GetDatabaseEncodingFunction · 0.85
pg_parse_json_or_ereportFunction · 0.85
pfreeFunction · 0.50

Tested by

no test coverage detected