I think Flink meets the same problem, but the solution is not so elegant:
In org.apache.flink.table.planner.plan.rules.logical.
*PushPartitionIntoTableSourceScanRule*, they create a new LogicalTableScan
but only with new RelOptTable, :

TableSourceTable newTableSourceTable =
tableSourceTable.copy(dynamicTableSource, newStatistic, new
String[]{extraDigest});LogicalTableScan newScan =
LogicalTableScan.create(scan.getCluster(), newTableSourceTable,
scan.getHints());

In their RelOptTable(TableSourceTable), they inject extra info
getQualifiedName, so the TableScan's digest is diff to the first:

  override def getQualifiedName: util.List[String] = {
    val names = super.getQualifiedName
    extraDigests.foreach(builder.add)
    builder.build()
  }


But this way, there's dirty info when we call getQualifiedName.


Regards!

Aron Tao


JiaTao Tao <[email protected]> 于2020年10月9日周五 下午3:27写道:

> Hi fellows
> Here's the problem:
> We have our own RelOptTable implementation, and we replace
> the RelOptTableImpl during a rule in HepPlanner. Something unexpected
> occurred: We only replaced the `table` in TableScan, and the digest is not
> changed after the rule, so in `HepPlanner#addRelToGraph`, directly return
> the ori TableScan.
>
> HepPlanner#addRelToGraph
> ```
>       Pair<String, List<RelDataType>> key = key(rel);
>       HepRelVertex equivVertex = mapDigestToVertex.get(key);
>       if (equivVertex != null) {
>         // Use existing vertex.
>         return equivVertex;
>       }
> ```
>
>
> Regards!
>
> Aron Tao
>

Reply via email to