Skip to content

Add inputlookup as another form of search sources#5081

Open
Swiddis wants to merge 2 commits intoopensearch-project:mainfrom
Swiddis:feature/inputlookup-alias
Open

Add inputlookup as another form of search sources#5081
Swiddis wants to merge 2 commits intoopensearch-project:mainfrom
Swiddis:feature/inputlookup-alias

Conversation

@Swiddis
Copy link
Collaborator

@Swiddis Swiddis commented Jan 27, 2026

Description

Allows queries like inputlookup big5 | head 1.

Will rip this out again later once #5074 is actually in progress and replace it with a real inputlookup command, this is just some temp noise since we want to call plain indices lookups in the current version.

Related Issues

N/A

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.

Signed-off-by: Simeon Widdis <sawiddis@amazon.com>
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 27, 2026

📝 Walkthrough

Summary by CodeRabbit

  • New Features
    • Added INPUTLOOKUP as a new data-source option for queries. It can be referenced as a table, invoked as a table function, or used as a dynamic source in FROM clauses, giving more flexible lookup-table access and retrieval.

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

Walkthrough

Added an INPUTLOOKUP lexer token and updated the fromClause grammar to allow INPUTLOOKUP as a source via new parser alternatives (INPUTLOOKUP tableOrSubqueryClause, INPUTLOOKUP tableFunction).

Changes

Cohort / File(s) Summary
ANTLR Grammar Lexer Token
ppl/src/main/antlr/OpenSearchPPLLexer.g4
Added INPUTLOOKUP: 'INPUTLOOKUP'; under dataset types to recognize the INPUTLOOKUP keyword.
ANTLR Grammar Parser Rules
ppl/src/main/antlr/OpenSearchPPLParser.g4
Extended fromClause with INPUTLOOKUP alternatives: INPUTLOOKUP tableOrSubqueryClause and INPUTLOOKUP tableFunction, enabling INPUTLOOKUP as a data source option.

Sequence Diagram(s)

(omitted — change is a small grammar addition that doesn't introduce multi-component control flow)

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested reviewers

  • penghuo
  • ps48
  • kavithacm
  • derek-ho
  • joshuali925
  • dai-chen
  • LantaoJin
  • anirudha
  • ykmr1224
  • qianheng-aws
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: adding inputlookup as a search source option in the grammar files.
Description check ✅ Passed The description is directly related to the changeset, explaining the purpose of the inputlookup addition and its temporary nature pending issue #5074.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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


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

@RyanL1997 RyanL1997 added enhancement New feature or request PPL Piped processing language v3.5.0 labels Jan 27, 2026
RyanL1997
RyanL1997 previously approved these changes Jan 27, 2026
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

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 `@ppl/src/main/antlr/OpenSearchPPLParser.g4`:
- Around line 623-632: The parser allows INPUTLOOKUP in the fromClause with the
dynamicSourceClause alternative, but visitDynamicSourceClause currently throws
UnsupportedOperationException causing a runtime crash for INPUTLOOKUP
dynamicSourceClause; implement visitDynamicSourceClause (or the corresponding
visitor method) to properly handle dynamicSourceClause when its parent is
INPUTLOOKUP by wiring the same dispatch/processing done for
tableOrSubqueryClause/tableFunction (or return a clear
UnsupportedOperationException only for truly unsupported subvariants), ensuring
the visitor inspects the parse node shape and delegates to the correct
downstream handler; refer to visitDynamicSourceClause, fromClause, INPUTLOOKUP,
and dynamicSourceClause to locate and fix the logic.

Signed-off-by: Simeon Widdis <sawiddis@amazon.com>
Copy link
Collaborator

@dai-chen dai-chen left a comment

Choose a reason for hiding this comment

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

Could you link an issue to provide more context about the plan?

Comment on lines +626 to +629
| INPUTLOOKUP tableOrSubqueryClause
| SOURCE EQUAL tableFunction
| INDEX EQUAL tableFunction
| INPUTLOOKUP tableFunction
Copy link
Collaborator

@dai-chen dai-chen Jan 28, 2026

Choose a reason for hiding this comment

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

Any syntax or AST test to add? No other code changes required?

@ykmr1224
Copy link
Collaborator

I am not sure if this change is actually needed.
I think inputlookup is needed if we cannot directly query lookup tables with source=xxxx syntax.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request PPL Piped processing language v3.5.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants