Skip to content

[WIP] Support table command in PPL (Calcite Engine) #3885

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

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

aalva500-prog
Copy link

@aalva500-prog aalva500-prog commented Jul 15, 2025

Description

Implements a table command for OpenSearch PPL that provides field selection and projection functionality. The command allows users to explicitly specify which fields should be included in the query results, similar to the SELECT clause in SQL.

Features Added

  • Core table command: table <field1>, <field2>, ... [, <fieldN>]
  • Wildcard support: Handles patterns like log.* to select multiple fields
  • Field expressions: Supports field expressions and functions in projections
  • Calcite integration: Full support in Calcite engine with proper field projection
  • Pipeline integration: Works seamlessly with other PPL commands like where and stats

Implementation Details

Grammar & Parsing

  • Extended PPL parser with table command grammar
  • Implemented AST node (Table.java) with visitor pattern support
  • Added tableCommand rule to handle field projections

Calcite Engine Integration

  • Added visitTable() method in CalciteRelNodeVisitor
  • Implemented wildcard expansion for field patterns
  • Proper field projection and renaming
  • Maintains field order as specified in the command

Usage Examples

-- Basic table with specific fields
source=accounts | table account_number, firstname, lastname

-- Wildcard field selection
source=logs | table time, host*, error_*

-- Mixed field specification
source=data | table timestamp, value*, status, response_time

Related Issues

Resolves #[3877]

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.

@aalva500-prog aalva500-prog changed the title Support table command in PPL (Calcite Engine) [WIP] Support table command in PPL (Calcite Engine) Jul 15, 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

Successfully merging this pull request may close these issues.

2 participants