You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2026/09/17 20:54:00 UTC
[jira] [Updated] (CALCITE-7794) Reduce the work HepPlanner does per rule application attempt
[ https://issues.apache.org/jira/browse/CALCITE-7794?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
ASF GitHub Bot updated CALCITE-7794:
------------------------------------
Labels: pull-request-available (was: )
> Reduce the work HepPlanner does per rule application attempt
> ------------------------------------------------------------
>
> Key: CALCITE-7794
> URL: https://issues.apache.org/jira/browse/CALCITE-7794
> Project: Calcite
> Issue Type: Improvement
> Reporter: Michael Braun
> Priority: Minor
> Labels: pull-request-available
>
> HepPlanner tries every rule in a collection against every vertex, so missed attempts
> can greatly outnumber matches.
> On every attempt, {{applyRule}} tests {{graph.vertexSet().contains(vertex)}}. Both
> call sites try every rule against the same vertex in a loop that only exits early on
> a match, so membership cannot change within it: 100 rules means 100 set lookups
> where one would do.
> On attempts that cannot match -- the large majority -- {{applyRule}} also allocates
> {{bindings}} and {{nodeChildren}} before calling {{matchOperands}}, which rejects on
> its first statement, and runs the {{ConverterRule}} and {{CommonRelSubExprRule}}
> branches, traversing a vertex's parents, before the operand is tested.
> Proposed: move the membership test to the two callers, which need it once per vertex;
> return early for an empty rule collection; and test the operand first in
> {{applyRule}}, splitting {{matchOperands}} into a thin entry point making that test
> and a body assuming it.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)