Hi Han, I guess what you are looking for is RelFieldTrimmer [1] and it is not implemented as a transformation rule but as a separate optimization phase in this case.
Best, Stamatis [1] https://github.com/apache/calcite/blob/master/core/src/main/java/org/apache/calcite/sql2rel/RelFieldTrimmer.java On Thu, Sep 12, 2019 at 10:15 AM Han Mingcong <hanmingcong...@hotmail.com> wrote: > Hi all, > I’m learning query optimization recently. As known, Calcite uses a volcano > optimizer which is different from other optimizers such as SparkSQL’s > Catalyst. But I’m curious how does volcano optimizer implement rules like > `ColumnPruning` in Catalyst? Or which transformation rule does Calcite use > to achieve it? > For example, we have such a SQL: > > select a from t where b > 10; > > If the schema of t is `a int, b int, c int, …`, we only need two columns > ‘a’ and ‘b’ when scan table ‘t’. > > > Mingcong Han > 2019.9.12 >