Skip to content

Conversation

@LantaoJin
Copy link
Member

@LantaoJin LantaoJin commented Apr 22, 2025

Description

New added commands should throw exception when calcite disabled

Related Issues

Resolves #3568 and #3567

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.

@LantaoJin LantaoJin added the calcite calcite migration releated label Apr 22, 2025
Signed-off-by: Lantao Jin <[email protected]>
@qianheng-aws
Copy link
Collaborator

qianheng-aws commented Apr 22, 2025

If customer set calcite and fallback both enabled, and submit an incorrect query with new commands, it seems will return error "xxx is supported only when plugins.calcite.enabled=true" as it will always fallback to v2.

But the expected error message should be the exception message thrown by calcite.

protected static boolean isFallbackEnabled() throws IOException {
return Boolean.parseBoolean(
getClusterSetting(Settings.Key.CALCITE_FALLBACK_ALLOWED.getKeyValue(), "persistent"));
protected static boolean isFallbackEnabled() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just curious, what's the concern of changing IOException to RuntimeException.

Copy link
Member Author

Choose a reason for hiding this comment

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

revert

@qianheng-aws
Copy link
Collaborator

If customer set calcite and fallback both enabled, and submit an incorrect query with new commands, it seems will return error "xxx is supported only when plugins.calcite.enabled=true" as it will always fallback to v2.

But the expected error message should be the exception message thrown by calcite.

Maybe we should show Calcite's error message, if fallback to v2 also ends with failure.

Signed-off-by: Lantao Jin <[email protected]>
@LantaoJin
Copy link
Member Author

If customer set calcite and fallback both enabled, and submit an incorrect query with new commands, it seems will return error "xxx is supported only when plugins.calcite.enabled=true" as it will always fallback to v2.
But the expected error message should be the exception message thrown by calcite.

Maybe we should show Calcite's error message, if fallback to v2 also ends with failure.

addressed.

@LantaoJin
Copy link
Member Author

LantaoJin commented Apr 22, 2025

The commit b9cbb9b fails due to #3445 (comment)

@LantaoJin LantaoJin mentioned this pull request Apr 23, 2025
7 tasks
penghuo
penghuo previously approved these changes Apr 23, 2025
if (shouldUseCalcite(queryType) && isCalciteFallbackAllowed()) {
// if there is a failure thrown from Calcite and execution after fallback V2
// keeps failure, we should throw the failure from Calcite.
calciteFailure.ifPresentOrElse(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we have IT for this feature?

Copy link
Member Author

Choose a reason for hiding this comment

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

done

@penghuo penghuo merged commit 69b9e82 into opensearch-project:main Apr 24, 2025
22 checks passed
@LantaoJin LantaoJin added backport 3.0 bug Something isn't working labels Apr 25, 2025
@opensearch-trigger-bot
Copy link
Contributor

The backport to 3.0 failed:

The process '/usr/bin/git' failed with exit code 128

To backport manually, run these commands in your terminal:

# Navigate to the root of your repository
cd $(git rev-parse --show-toplevel)
# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add ../.worktrees/sql/backport-3.0 3.0
# Navigate to the new working tree
pushd ../.worktrees/sql/backport-3.0
# Create a new branch
git switch --create backport/backport-3571-to-3.0
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 69b9e82b35a8d2b856ec7c6ae7dd2487a8c16a3a
# Push it to GitHub
git push --set-upstream origin backport/backport-3571-to-3.0
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/sql/backport-3.0

Then, create a pull request where the base branch is 3.0 and the compare/head branch is backport/backport-3571-to-3.0.

LantaoJin added a commit to LantaoJin/search-plugins-sql that referenced this pull request Apr 25, 2025
…search-project#3571)

* New added commands should throw exception when calcite disabled

Signed-off-by: Lantao Jin <[email protected]>

* remove useless code

Signed-off-by: Lantao Jin <[email protected]>

* address comments

Signed-off-by: Lantao Jin <[email protected]>

* fix UT

Signed-off-by: Lantao Jin <[email protected]>

* Add a new IT case

Signed-off-by: Lantao Jin <[email protected]>

---------

Signed-off-by: Lantao Jin <[email protected]>
(cherry picked from commit 69b9e82)
penghuo pushed a commit that referenced this pull request Apr 25, 2025
… (#3582)

* New added commands should throw exception when calcite disabled

Signed-off-by: Lantao Jin <[email protected]>

* remove useless code

Signed-off-by: Lantao Jin <[email protected]>

* address comments

Signed-off-by: Lantao Jin <[email protected]>

* fix UT

Signed-off-by: Lantao Jin <[email protected]>

* Add a new IT case

Signed-off-by: Lantao Jin <[email protected]>

---------

Signed-off-by: Lantao Jin <[email protected]>
(cherry picked from commit 69b9e82)
penghuo pushed a commit that referenced this pull request Jun 16, 2025
* New added commands should throw exception when calcite disabled

Signed-off-by: Lantao Jin <[email protected]>

* remove useless code

Signed-off-by: Lantao Jin <[email protected]>

* address comments

Signed-off-by: Lantao Jin <[email protected]>

* fix UT

Signed-off-by: Lantao Jin <[email protected]>

* Add a new IT case

Signed-off-by: Lantao Jin <[email protected]>

---------

Signed-off-by: Lantao Jin <[email protected]>
Signed-off-by: xinyual <[email protected]>
@LantaoJin LantaoJin added the backport-manually Filed a PR to backport manually. label Jul 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport 3.0 backport-failed backport-manually Filed a PR to backport manually. bug Something isn't working calcite calcite migration releated

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Join/Lookup/Subsearch should throw exception in Analyzer (V2) when calcite disabled.

3 participants