Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

range index is not enabled when && is used with executable-model #6228

Open
tkobayas opened this issue Jan 23, 2025 · 0 comments
Open

range index is not enabled when && is used with executable-model #6228

tkobayas opened this issue Jan 23, 2025 · 0 comments
Assignees

Comments

@tkobayas
Copy link
Contributor

When a constraint is like age >= 0 && age < 20, executable-model doesn't split the constraint into two constraints, so it doesn't enable range index. It only affects the performance (it's enabled when more than 9 alpha nodes for the same field by default), not the rule behaviour.

age >= 0, age < 20 doesn't have this issue.

AlphaNodeRangeIndexingTest

    public void testSurroundingRange(KieBaseTestConfiguration kieBaseTestConfiguration) {
        final String drl =
                "package org.drools.compiler.test\n" +
                           "import " + Person.class.getCanonicalName() + "\n" +
                           "rule test1\n when\n" +
                           "   Person( age >= 0 && age < 20 )\n" +
                           "then\n end\n" +
                           "rule test2\n when\n" +
                           "   Person( age >= 20 && age < 40 )\n" +
                           "then\n end\n" +
                           "rule test3\n when\n" +
                           "   Person( age >= 40 && age < 60 )\n" +
                           "then\n end\n";

        final KieBase kbase = createKieBaseWithRangeIndexThresholdValue(kieBaseTestConfiguration, drl, 3);
        final KieSession ksession = kbase.newKieSession();

        assertSinks(kieBaseTestConfiguration, kbase, Person.class, 3, 3, 0, 3);

        ksession.insert(new Person("John", 18));
        int fired = ksession.fireAllRules();
        assertThat(fired).isEqualTo(1);

        ksession.insert(new Person("Paul", 60));
        fired = ksession.fireAllRules();
        assertThat(fired).isEqualTo(0);
    }
@tkobayas tkobayas self-assigned this Jan 23, 2025
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

No branches or pull requests

1 participant