Shengkai Fang created CALCITE-7106: -------------------------------------- Summary: Can not generate correlated Polymorphic Table Function Key: CALCITE-7106 URL: https://issues.apache.org/jira/browse/CALCITE-7106 Project: Calcite Issue Type: Improvement Components: core Affects Versions: 1.40.0 Reporter: Shengkai Fang
Recently, I am using Flink to support a VECTOR_SEARCH function. An example is ``` SELECT * FROM orders, LATERAL TABLE(VECTOR_SEARCH( TABLE Shipments, orders.productid)) ``` But after sql2rel phase, the output tree is ``` LogicalProject(ROWTIME=[$0], PRODUCTID=[$1], ORDERID=[$2], ORDERID0=[$3], ROWTIME0=[$4], RANK_NUMBER=[$5]) LogicalJoin(condition=[true], joinType=[inner]) LogicalTableScan(table=[[CATALOG, SALES, ORDERS]]) LogicalTableFunctionScan(invocation=[VECTOR_SEARCH($1, $1)], rowType=[RecordType(INTEGER ORDERID, TIMESTAMP(0) ROWTIME, BIGINT RANK_NUMBER)]) LogicalProject(ORDERID=[$0], ROWTIME=[$1]) LogicalTableScan(table=[[CATALOG, SALES, SHIPMENTS]]) ``` At my first glance, it should use Correlate rather than Join here. After debug, I find the Blackboard#lookupExp tries to use `inputs` to build expression if inputs is not null. However, in this case, inputs are not members of the current scope. -- This message was sent by Atlassian Jira (v8.20.10#820010)