Could you translate it to SQL, I am not familiar with expression queries like that.
On Tue, Feb 8, 2022 at 1:46 PM Gavin Ray <[email protected]> wrote: > I am trying to work out the RelBuilder calls to make to generate > expressions for nested queries > > Given some query like this: > > query { > user(where: { id: { _gt: 5 } }) { > name > todos { > text > } > } > } > > I need to return a single row, which is an array of JSON objects, like: > [{ name: "Person1", todos: [{ text: "P1 Todo 1"}, { text: "P1 Todo 2" }] }] > > Hasura uses COALESCE(json_agg("alias"), '[]') and row_to_json() functions > FWIW: > https://pastebin.com/zb77zK5S > > I see that Calcite has JSON_OBJECT/JSON_ARRAY functions > Are these what I want to use? > > Maybe it would be easier to make individual parallel queries and generate > the object in-memory? > Would that be slower? (I would guess so) > > Any advice greatly appreciated. Hurting my head trying to sort out the > RelBuilder calls here, ha. >
