MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / jsonb_each_stringify

Function jsonb_each_stringify

src/expr/src/relation/func.rs:2908–2924  ·  view source on GitHub ↗
(
    a: Datum<'a>,
    temp_storage: &'a RowArena,
)

Source from the content-addressed store, hash-verified

2906}
2907
2908fn jsonb_each_stringify<'a>(
2909 a: Datum<'a>,
2910 temp_storage: &'a RowArena,
2911) -> impl Iterator<Item = (Row, Diff)> + 'a {
2912 // First produce a map, so that a common iterator can be returned.
2913 let map = match a {
2914 Datum::Map(dict) => dict,
2915 _ => mz_repr::DatumMap::empty(),
2916 };
2917
2918 map.iter().map(move |(k, mut v)| {
2919 v = jsonb_stringify(v, temp_storage)
2920 .map(Datum::String)
2921 .unwrap_or(Datum::Null);
2922 (Row::pack_slice(&[Datum::String(k), v]), Diff::ONE)
2923 })
2924}
2925
2926fn jsonb_object_keys<'a>(a: Datum<'a>) -> impl Iterator<Item = (Row, Diff)> + 'a {
2927 let map = match a {

Callers 1

evalMethod · 0.85

Calls 4

jsonb_stringifyFunction · 0.85
StringClass · 0.85
mapMethod · 0.45
iterMethod · 0.45

Tested by

no test coverage detected