Skip to content

Add explain ITs with Calcite without pushdown - #3786

Merged
LantaoJin merged 8 commits into
opensearch-project:mainfrom
yuancu:explain-no-pushdown
Jul 11, 2025
Merged

LantaoJin merged 8 commits into
opensearch-project:mainfrom
yuancu:explain-no-pushdown

Conversation

@yuancu

@yuancu yuancu commented Jun 17, 2025

Copy link
Copy Markdown
Collaborator

Description

Add Integration tests for explain command with pushdown disabled in Calcite

Related Issues

Resolves #3785

Check List

  • New functionality includes testing.
  • New functionality has been documented.
  • New functionality has javadoc added.
  • New functionality has a user manual doc added.
  • API changes companion pull request created.
  • Commits are signed per the DCO using --signoff.
  • Public documentation issue/PR created.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

private String loadExpectedPlan(String fileName) throws IOException {
String prefix;
if (isCalciteEnabled()) {
if (isPushdownEnabled()) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the future, just wonder in which case we may disable pushdown? Is this only for testing purpose?

@LantaoJin LantaoJin Jun 18, 2025 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For testing purpose, we need to confirm all operations running in Calcite could meet our expects. We wouldn't disable pushdown config. But all operators should work as expected without pushdown. For example, filter operator can be pushdown in normal. But it cannot be pushdown after join operator.

@LantaoJin LantaoJin added testing Related to improving software testing calcite calcite migration releated labels Jun 18, 2025
LantaoJin
LantaoJin previously approved these changes Jun 18, 2025
qianheng-aws
qianheng-aws previously approved these changes Jul 1, 2025
@qianheng-aws

Copy link
Copy Markdown
Collaborator

@yuancu conflict

@yuancu
yuancu dismissed stale reviews from qianheng-aws and LantaoJin via 0a2ced5 July 1, 2025 08:51
@yuancu
yuancu marked this pull request as draft July 1, 2025 10:06
@yuancu

yuancu commented Jul 1, 2025

Copy link
Copy Markdown
Collaborator Author

Will re-work on this after merging #3835

@yuancu
yuancu marked this pull request as ready for review July 2, 2025 08:41
@yuancu

yuancu commented Jul 2, 2025 •

Copy link
Copy Markdown
Collaborator Author

The failed test case can be reproduced with the following command in the main branch:

./gradlew ':integ-test:yamlRestTest' --tests "org.opensearch.sql.rest.RestHandlerClientYamlTestSuiteIT.test {yaml=issues/3102/Prevent push down limit if the offset reach max_result_window}" -Dtests.seed=37CD9BA42072D18E

Note that it can only be reproduced with the given seed.

I haven't figured out what went wrong.

Relevant issue: #3102

details
  • test
"Prevent push down limit if the offset reach max_result_window":
  - do:
      headers:
        Content-Type: 'application/json'
      ppl:
        body:
          query: 'source=test | head 1 from 1 '
  - match: {"total": 1}
  - match: {"schema": [{"name": "id", "type": "bigint"}]}
  - match: {"datarows": [[2]]}

  - do:
      headers:
        Content-Type: 'application/json'
      ppl:
        body:
          query: 'source=test | head 2 | head 1 from 1 '
  - match: { "total": 1 }
  - match: { "schema": [ { "name": "id", "type": "bigint" } ] }
  - match: { "datarows": [ [ 2 ] ] }
  • stacktrace
 java.lang.AssertionError: Failure at [issues/3102:25]: got unexpected warning header [
        299 OpenSearch-3.1.0-SNAPSHOT-aed1264b0b385a9735ce1f5156ddd56506f109c3 "Loading the fielddata on the _id field is deprecated and will be removed in future versions. If you require sorting or aggregating on this field you should also include the id in the body of your documents, and map this field as a keyword field that has [doc_values] enabled"
    ]
        at __randomizedtesting.SeedInfo.seed([37CD9BA42072D18E:BF99A47E8E8EBC76]:0)
        at org.opensearch.test.rest.yaml.OpenSearchClientYamlSuiteTestCase.executeSection(OpenSearchClientYamlSuiteTestCase.java:460)
        at org.opensearch.test.rest.yaml.OpenSearchClientYamlSuiteTestCase.test(OpenSearchClientYamlSuiteTestCase.java:433)
        at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
        at java.base/java.lang.reflect.Method.invoke(Method.java:580)
        at com.carrotsearch.randomizedtesting.RandomizedRunner.invoke(RandomizedRunner.java:1750)
        at com.carrotsearch.randomizedtesting.RandomizedRunner$8.evaluate(RandomizedRunner.java:938)
        at com.carrotsearch.randomizedtesting.RandomizedRunner$9.evaluate(RandomizedRunner.java:974)
        at com.carrotsearch.randomizedtesting.RandomizedRunner$10.evaluate(RandomizedRunner.java:988)
        at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)
        at org.junit.rules.RunRules.evaluate(RunRules.java:20)
        at org.apache.lucene.tests.util.TestRuleSetupTeardownChained$1.evaluate(TestRuleSetupTeardownChained.java:48)
        at org.apache.lucene.tests.util.AbstractBeforeAfterRule$1.evaluate(AbstractBeforeAfterRule.java:43)
        at org.apache.lucene.tests.util.TestRuleThreadAndTestName$1.evaluate(TestRuleThreadAndTestName.java:45)
        at org.apache.lucene.tests.util.TestRuleIgnoreAfterMaxFailures$1.evaluate(TestRuleIgnoreAfterMaxFailures.java:60)
        at org.apache.lucene.tests.util.TestRuleMarkFailure$1.evaluate(TestRuleMarkFailure.java:44)
        at org.junit.rules.RunRules.evaluate(RunRules.java:20)
        at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)
        at com.carrotsearch.randomizedtesting.ThreadLeakControl$StatementRunner.run(ThreadLeakControl.java:368)
        at com.carrotsearch.randomizedtesting.ThreadLeakControl.forkTimeoutingTask(ThreadLeakControl.java:817)
        at com.carrotsearch.randomizedtesting.ThreadLeakControl$3.evaluate(ThreadLeakControl.java:468)
        at com.carrotsearch.randomizedtesting.RandomizedRunner.runSingleTest(RandomizedRunner.java:947)
        at com.carrotsearch.randomizedtesting.RandomizedRunner$5.evaluate(RandomizedRunner.java:832)
        at com.carrotsearch.randomizedtesting.RandomizedRunner$6.evaluate(RandomizedRunner.java:883)
        at com.carrotsearch.randomizedtesting.RandomizedRunner$7.evaluate(RandomizedRunner.java:894)
        at org.apache.lucene.tests.util.AbstractBeforeAfterRule$1.evaluate(AbstractBeforeAfterRule.java:43)
        at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)
        at org.apache.lucene.tests.util.TestRuleStoreClassName$1.evaluate(TestRuleStoreClassName.java:38)
        at com.carrotsearch.randomizedtesting.rules.NoShadowingOrOverridesOnMethodsRule$1.evaluate(NoShadowingOrOverridesOnMethodsRule.java:40)
        at com.carrotsearch.randomizedtesting.rules.NoShadowingOrOverridesOnMethodsRule$1.evaluate(NoShadowingOrOverridesOnMethodsRule.java:40)
        at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)
        at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)
        at org.apache.lucene.tests.util.TestRuleAssertionsRequired$1.evaluate(TestRuleAssertionsRequired.java:53)
        at org.apache.lucene.tests.util.AbstractBeforeAfterRule$1.evaluate(AbstractBeforeAfterRule.java:43)
        at org.apache.lucene.tests.util.TestRuleMarkFailure$1.evaluate(TestRuleMarkFailure.java:44)
        at org.apache.lucene.tests.util.TestRuleIgnoreAfterMaxFailures$1.evaluate(TestRuleIgnoreAfterMaxFailures.java:60)
        at org.apache.lucene.tests.util.TestRuleIgnoreTestSuites$1.evaluate(TestRuleIgnoreTestSuites.java:47)
        at org.junit.rules.RunRules.evaluate(RunRules.java:20)
        at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)
        at com.carrotsearch.randomizedtesting.ThreadLeakControl$StatementRunner.run(ThreadLeakControl.java:368)
        at java.base/java.lang.Thread.run(Thread.java:1575)

        Caused by:
        java.lang.AssertionError: got unexpected warning header [
                299 OpenSearch-3.1.0-SNAPSHOT-aed1264b0b385a9735ce1f5156ddd56506f109c3 "Loading the fielddata on the _id field is deprecated and will be removed in future versions. If you require sorting or aggregating on this field you should also include the id in the body of your documents, and map this field as a keyword field that has [doc_values] enabled"
        ]
            at org.junit.Assert.fail(Assert.java:89)
            at org.opensearch.test.rest.yaml.section.DoSection.checkWarningHeaders(DoSection.java:395)
            at org.opensearch.test.rest.yaml.section.DoSection.execute(DoSection.java:323)
            at org.opensearch.test.rest.yaml.OpenSearchClientYamlSuiteTestCase.executeSection(OpenSearchClientYamlSuiteTestCase.java:449)
            ... 39 more
Details

@qianheng-aws qianheng-aws added the maintenance Improves code quality, but not the product label Jul 2, 2025
@yuancu
yuancu force-pushed the explain-no-pushdown branch from 6f7a2f3 to bce9661 Compare July 10, 2025 07:58
@LantaoJin LantaoJin changed the title Add explain ITs with Calcite wihtout pushdown Add explain ITs with Calcite without pushdown Jul 11, 2025
@LantaoJin
LantaoJin merged commit 9aaff7a into opensearch-project:main Jul 11, 2025
opensearch-trigger-bot Bot pushed a commit that referenced this pull request Jul 11, 2025
* Add explain ITs with Calcite wihtout pushdown

Signed-off-by: Yuanchun Shen <[email protected]>

* Test explain sort with Calcite without push-down

Signed-off-by: Yuanchun Shen <[email protected]>

* Complete explain tests for no-pushdown cases

Signed-off-by: Yuanchun Shen <[email protected]>

* Test explain search without pushdown

Signed-off-by: Yuanchun Shen <[email protected]>

---------

Signed-off-by: Yuanchun Shen <[email protected]>
(cherry picked from commit 9aaff7a)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
qianheng-aws pushed a commit that referenced this pull request Jul 11, 2025
* Add explain ITs with Calcite wihtout pushdown



* Test explain sort with Calcite without push-down



* Complete explain tests for no-pushdown cases



* Test explain search without pushdown



---------


(cherry picked from commit 9aaff7a)

Signed-off-by: Yuanchun Shen <[email protected]>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport 2.19-dev calcite calcite migration releated maintenance Improves code quality, but not the product testing Related to improving software testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] Add Integration tests for explain with pushdown disabled in Calcite

4 participants