Please ignore my previous mail. I was able to get expected results.

I got the project list properly expanded
using visitRoot(relNode).asStatement(). Earlier I was
using visitInput(relNode, 0).asQueryOrValues() which was generating wild
card based projection list.

Regards,
Karthick

On Sat, Mar 9, 2024 at 10:06 AM Karthick S <karthick.n...@gmail.com> wrote:

> Hi All,
>
> I am trying to use calcite as a sql rewrite layer to attach some default
> filter conditions on the incoming SQL queries for execution. I have been
> able to successfully add FilterRule and modified the logicalplan to include
> the filter. But when the convert the query back from RelNode to SqlNode,
> the final query keeps * in the projection list instead of actual column
> references.
>
> Even without using any filter additions, I am unable to produce the
> correct query back.
>
> SELECT `F`.`FACID`, `F`.`NAME`, `F`.`MONTHLYMAINTENANCE`
> FROM `FACILITIES` AS `F`
>
> Post Validation :
> SELECT `F`.`FACID`, `F`.`NAME`, `F`.`MONTHLYMAINTENANCE`
> FROM `FACILITIES` AS `F`
>
> Logical Plan
> LogicalProject(FACID=[$0], NAME=[$1], MONTHLYMAINTENANCE=[$5])
>   LogicalTableScan(table=[[facilities]])
>
>
> Logical Plan to SQL query:
> SELECT *
> FROM "facilities"
>
> Someone please guide me what am I missing here ? LogicalProject has all
> the fields that i originally had in the input query, however when the query
> produced out of RelToSqlConverter is having generic wild card *
>
> Regards,
> Karthick
>

Reply via email to