Hi, Ham and Stamatis.
In our use case, we use transformation rules like ProjectXXXTransposeRule
to do column pruning.
For example, if we have a sql:
select a from t where b > 10;
the logical plan is
LogcaiProject(a)
LogicalFilter(b>10)
LogcicalTableScan(a,b,c)
then we can get LogcicalTableScan(a,b) after applying
ProjectFilterTransposeRule and ProjectTableScanTransposeRule.
I hope it helps.
Best,
Chunwei
On Thu, Sep 12, 2019 at 8:15 PM Stamatis Zampetakis <[email protected]>
wrote:
> 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 <[email protected]>
> 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
> >
>