I have seen both patterns in current code base. In most places, for example 
SubQueryRemoveRule, AggregateUnionTrasposeRule SortJoinTransposeRule, etc., 
RelOptCluster.getMetadataQuery() is used. And there are a few other places 
where new RelMetadataQuery instance is created, which Haisheng attempts to fix.

Currently RelOptCluster.invalidateMetadataQuery() is called at the end of 
RelOptRuleCall.transformTo(). So the lifespan of RelMetadataQuery is guaranteed 
to be within a RelOptCall. I think Haisheng’s fix is safe.


> On Oct 16, 2019, at 1:53 AM, Danny Chan <yuzhao....@gmail.com> wrote:
> 
> This is the reason I was struggling for the discussion.
> 
> Best,
> Danny Chan
> 在 2019年10月16日 +0800 AM11:23,dev@calcite.apache.org,写道:
>> 
>> RelMetadataQuery

Reply via email to