Skip to content

Set max=1 in join as default when plugins.ppl.syntax.legacy.preferred=false#5057

Merged
qianheng-aws merged 2 commits into
opensearch-project:mainfrom
LantaoJin:pr/issues/5056
Jan 22, 2026
Merged

Set max=1 in join as default when plugins.ppl.syntax.legacy.preferred=false#5057
qianheng-aws merged 2 commits into
opensearch-project:mainfrom
LantaoJin:pr/issues/5056

Conversation

@LantaoJin

@LantaoJin LantaoJin commented Jan 20, 2026

Copy link
Copy Markdown
Member

Description

For performance purpose, set max=1 in join as default when plugins.ppl.syntax.legacy.preferred=false

Related Issues

#5056

Check List

  • New functionality includes testing.
  • New functionality has been documented.
  • New functionality has javadoc added.
  • New functionality has a user manual doc added.
  • New PPL command checklist all confirmed.
  • API changes companion pull request created.
  • Commits are signed per the DCO using --signoff or -s.
  • 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.

…=false

Signed-off-by: Lantao Jin <ltjin@amazon.com>
@coderabbitai

coderabbitai Bot commented Jan 20, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Summary by CodeRabbit

  • Documentation

    • Updated join command and admin settings documentation regarding max parameter defaults.
  • Features

    • Join command max parameter now has a conditional default value based on syntax preference configuration.

✏️ Tip: You can customize this high-level summary in your review settings.

Walkthrough

The changes introduce conditional default value behavior for the join command's max parameter based on a new plugins.ppl.syntax.legacy.preferred setting. When legacy mode is disabled, the parser injects a default max value of 1. Documentation is updated accordingly, and comprehensive tests validate both legacy and non-legacy execution paths.

Changes

Cohort / File(s) Summary
Documentation
docs/user/ppl/admin/settings.md, docs/user/ppl/cmd/join.md
Added note about default value for max in join command; clarified that default is 0 (unlimited) in legacy mode and 1 in non-legacy mode.
Core Logic
ppl/src/main/java/org/opensearch/sql/ppl/parser/AstBuilder.java
Conditionally injects default max argument with value 1 in visitJoinCommand when legacy mode is not preferred and no explicit max argument exists.
Unit Tests
ppl/src/test/java/org/opensearch/sql/ppl/calcite/CalcitePPLJoinTest.java
Added testJoinWhenLegacyNotPreferred() to validate join query execution and output when legacy syntax is disabled.
Integration Tests
integ-test/src/test/java/org/opensearch/sql/calcite/remote/CalciteExplainIT.java, CalcitePPLJoinIT.java
Added integration tests testJoinWhenLegacyNotPreferred() in both classes to validate join behavior, explain plans, and schema when legacy mode is disabled.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Suggested labels

testing

Suggested reviewers

  • ps48
  • kavithacm
  • penghuo
  • ykmr1224
  • joshuali925
  • anirudha
  • yuancu
  • derek-ho
  • Swiddis
🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: setting a default max=1 for join commands when legacy syntax is not preferred.
Description check ✅ Passed The description is related to the changeset, explaining the performance rationale for setting max=1 as default in join when legacy mode is disabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Comment @coderabbitai help to get the list of available commands and usage tips.

@LantaoJin LantaoJin added the enhancement New feature or request label Jan 20, 2026
@LantaoJin LantaoJin changed the title Set max=1 in join as default when plugins.ppl.syntax.legacy.preferred=false Set max=1 in join as default when plugins.ppl.syntax.legacy.preferred=false Jan 20, 2026
@LantaoJin LantaoJin added the performance Make it fast! label Jan 20, 2026
Signed-off-by: Lantao Jin <ltjin@amazon.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In
`@integ-test/src/test/java/org/opensearch/sql/calcite/remote/CalcitePPLJoinIT.java`:
- Around line 882-928: The first query in testJoinWhenLegacyNotPreferred (the
executeQuery that sets actual) only verifies schema but not that the join
defaulted to max=1; add a data assertion after verifySchema that calls
verifyDataRows against actual to assert the returned rows reflect max=1 behavior
(use the same expected single-row-per-key results as in the second query, but
include all columns checked in schema: name, age, state, country, year, month,
occupation, salary). Locate the test method testJoinWhenLegacyNotPreferred and
the executeQuery/verifySchema calls to insert the verifyDataRows(actual, ...)
call immediately after verifySchema to validate the new default max logic.

@yuancu yuancu left a comment

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.

LGTM

@qianheng-aws qianheng-aws merged commit d31769d into opensearch-project:main Jan 22, 2026
41 of 42 checks passed
@opensearch-trigger-bot

Copy link
Copy Markdown
Contributor

The backport to 2.19-dev 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-2.19-dev 2.19-dev
# Navigate to the new working tree
pushd ../.worktrees/sql/backport-2.19-dev
# Create a new branch
git switch --create backport/backport-5057-to-2.19-dev
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 d31769dd37b44f8c61ee10f71fd016b8ce4d2401
# Push it to GitHub
git push --set-upstream origin backport/backport-5057-to-2.19-dev
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/sql/backport-2.19-dev

Then, create a pull request where the base branch is 2.19-dev and the compare/head branch is backport/backport-5057-to-2.19-dev.

LantaoJin added a commit to LantaoJin/search-plugins-sql that referenced this pull request Jan 22, 2026
…red=false` (opensearch-project#5057)

* Set max=1 in join as default when plugins.ppl.syntax.legacy.preferred=false

Signed-off-by: Lantao Jin <ltjin@amazon.com>

* update doc

Signed-off-by: Lantao Jin <ltjin@amazon.com>

---------

Signed-off-by: Lantao Jin <ltjin@amazon.com>
(cherry picked from commit d31769d)
@LantaoJin LantaoJin added the backport-manually Filed a PR to backport manually. label Jan 22, 2026
penghuo pushed a commit that referenced this pull request Jan 22, 2026
…red=false` (#5057) (#5063)

* Set max=1 in join as default when plugins.ppl.syntax.legacy.preferred=false



* update doc



---------


(cherry picked from commit d31769d)

Signed-off-by: Lantao Jin <ltjin@amazon.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport 2.19-dev backport-failed backport-manually Filed a PR to backport manually. enhancement New feature or request performance Make it fast!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants