osdir.com

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Delete and Update projecting unnecessary columns


Hi,

Just bumping this question.

We have worked around this issue in downstream code to remove the extra projection columns, but I am still wondering if there is some easier way to get the same effect in calcite.

I am assuming calcite projects all the columns to be used as a 'natural key' for the delete or update, but in our case we really don't need them all.

Any thoughts?

regards.


On 2018-05-02 09:07 PM, Homer wrote:

Hi,

Before I start just want to say thanks again for Calcite,  such a useful piece of software.

We are getting RA from calcite for a query engine.  We are using the Planner interface.

When we generate UPDATE or DELETE queries we get a lot of unnecessary columns included, it basically project every column in the table.

example

|CREATE TABLE CUSTOMER ( i1 INTEGER, i2 INTEGER) |

with delete

|delete from CUSTOMER |
result remainded the same with extra projection
|{ "rels": [ { "id": "0", "relOp": "EnumerableTableScan", "fieldNames": [ "i1", "i2", "rowid" ], "table": [ "db1", "CUSTOMER" ], "inputs": [] }, { "id": "1", "relOp": "LogicalProject", "fields": [ "i1", "i2", "rowid" ], "exprs": [ { "input": 0 }, { "input": 1 }, { "input": 2 } ] }, { "id": "2", "relOp": "LogicalTableModify", "table": [ "db1", "CUSTOMER" ], "operation": "DELETE", "flattened": true } ] } |


Note: We tried adding

|.withTrimUnusedFields(true) |

in the Planner but it did not seem to make any difference.

Is there some easy way to remove these extra project columns with calcite or do we have to do it after we get the relational algebra.

Regards