Hello Christophe,

Once you have the RelRoot from the SqlToRelConverter, you can obtain the
corresponding RelNode via RelRoot#project.
After that, you could create a new RelBuilder, and then push that RelNode
inside using RelBuilder#push(RelNode) and from that point on continue using
the builder.

Maybe not relevant in your case, but just fyi another possibility to
"modify the request" (i.e. modify the RelNode) without using a RelBuilder
could be applying a RelShuttle to the RelNode (see e.g.
RelHomogeneousShuttle and subclasses if you want to check some examples).

Best regards,
Ruben



On Mon, Jan 2, 2023 at 2:25 PM Christophe Le Saëc <chles...@gmail.com>
wrote:

> Hello,
>
> I used RelBuilder to scan table name without any pb.
> Now, i would like to do same kind of transformation, but instead of table
> name, with a SQL query.
> Something like
> RelBuilder.scanSQL("Select x, y from ...");
>
> I try to use SqlParser / SqlToRelConcerter
>
> SqlNode sqlNode = SqlParser.create(sqlQuery).parseQuery();
> SqlToRelConverter => build RelRoot
>
> but didn't find a way to convert SqlNode nor RelRoot to RelBuilder in order
> to modify the request.
>
> Is it possible ? And if yes, how ?
>
> Best regards,
> Christophe.
>

Reply via email to