You know, when people ask ‘Does Calcite support lineage?’, I’m never quite 
sure. People mean different things by lineage, and it takes a bit of effort to 
set up the required APIs.

I think the way to solve this question is with unit tests. 

Can write a unit test that fails, or point to an existing test that almost does 
what you need? For example, is there a test to get the lineage of a view column?

Julian


> On Sep 5, 2022, at 2:52 AM, Jiajun Xie <jiajunbernou...@gmail.com> wrote:
> 
> Hi, all:
> I want to know which virtual column is in use. For example,
> ```
> CREATE TABLE peoples(age int, virtual_age int as (age + 1) virtual);
> SELECT virtual_age from peoples;
> ```
> After converting, the virtual column is expanded to expression.
> ```
> LogicalProject(virtual_age=[+($0, 1)])
>  LogicalTableScan(table=[[default_ns, default, peoples]])
> ```
> So `RelMetadataQuery#getColumnOrigins` return RelColumnOrigin that is
> age(not is virtual_age).
> 
> I try to rewrite code in the implementation class of
> `InitializerExpressionFactory`, but I can't know which column is in use.
> When I confirm which column is in use, I can't know if the expression is
> from a virtual column.
> 
> Does anyone have relevant experience?  Thanks~

Reply via email to