Skip to content

[CALCITE-7416] Add fireRuleCache for HepPlanner#4795

Open
zhuwenzhuang wants to merge 1 commit intoapache:mainfrom
zhuwenzhuang:CALCITE-6907-rule-cache
Open

[CALCITE-7416] Add fireRuleCache for HepPlanner#4795
zhuwenzhuang wants to merge 1 commit intoapache:mainfrom
zhuwenzhuang:CALCITE-6907-rule-cache

Conversation

@zhuwenzhuang
Copy link
Contributor

@zhuwenzhuang zhuwenzhuang commented Feb 14, 2026

Fire rule cache prevents fire same Rule on same RelNode list to reduce HepPlanner's latency.
If this cache enabled, every match order can benefit from less fire rules.

Test result:

 @Test void testRuleApplyCount() {
   // disable fireRuleCache
    long applyTimes = checkRuleApplyCount(HepMatchOrder.ARBITRARY, false); 
    assertThat(applyTimes, is(316L));

    applyTimes = checkRuleApplyCount(HepMatchOrder.DEPTH_FIRST, false);
    assertThat(applyTimes, is(87L));

    applyTimes = checkRuleApplyCount(HepMatchOrder.TOP_DOWN, false);
    assertThat(applyTimes, is(295L));

    applyTimes = checkRuleApplyCount(HepMatchOrder.BOTTOM_UP, false);
    assertThat(applyTimes, is(296L));

    // enable fireRuleCache
    applyTimes = checkRuleApplyCount(HepMatchOrder.ARBITRARY, true); 
    assertThat(applyTimes, is(65L));

    applyTimes = checkRuleApplyCount(HepMatchOrder.DEPTH_FIRST, true);
    assertThat(applyTimes, is(65L));

    applyTimes = checkRuleApplyCount(HepMatchOrder.TOP_DOWN, true);
    assertThat(applyTimes, is(65L));

    applyTimes = checkRuleApplyCount(HepMatchOrder.BOTTOM_UP, true);
    assertThat(applyTimes, is(65L));
  }

@zhuwenzhuang zhuwenzhuang marked this pull request as draft February 14, 2026 03:24
@zhuwenzhuang zhuwenzhuang force-pushed the CALCITE-6907-rule-cache branch from 990a595 to f2fc722 Compare February 14, 2026 03:28
@sonarqubecloud
Copy link

@zhuwenzhuang zhuwenzhuang marked this pull request as ready for review February 14, 2026 06:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant