Skip to content
This repository was archived by the owner on Aug 2, 2022. It is now read-only.

Conversation

@dai-chen
Copy link
Member

@dai-chen dai-chen commented Aug 18, 2020

Issue #, if available:

  1. SELECT <index>.<column> AS alias is not supported #242: alias.`field` parsing issue

Description of changes: This PR is to support table alias in FROM clause, FROM index idx.

  1. Relation: An optional alias field is added. It's always null for PPL which doesn't support table alias
  2. Analyzer: When analyzing relation, its name (or alias if present) will be pushed to a new INDEX namespace on type environment.
  3. ExpressionAnalyzer and SelectExpressionAnalyzer: A new abstraction QualifierAnalyzer is added to resolve qualifier in index namespace. Un-qualify the qualified name by removing the qualifier if found. Or throw exception if qualifier doesn't exist or not an index.

table_alias (1)

Documentation:

  1. Specification and more details about identifier qualifiers: https://github.com/dai-chen/sql/blob/support-table-alias-in-new-engine/docs/user/general/identifiers.rst#identifier-qualifiers
  2. Limitation: https://github.com/dai-chen/sql/blob/support-table-alias-in-new-engine/docs/user/limitations/limitations.rst#limitations-on-identifiers

Testing: new UT, IT (comparison test) and IT for the #242 bug fix.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@dai-chen dai-chen self-assigned this Aug 19, 2020
@dai-chen dai-chen added the SQL label Aug 19, 2020
@dai-chen dai-chen requested review from chloe-zh and penghuo August 20, 2020 16:22
@dai-chen dai-chen marked this pull request as ready for review August 20, 2020 16:23
Copy link
Contributor

@penghuo penghuo left a comment

Choose a reason for hiding this comment

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

LGTM

@dai-chen dai-chen merged commit 89ffd1a into opendistro-for-elasticsearch:develop Aug 24, 2020
@dai-chen dai-chen deleted the support-table-alias-in-new-engine branch August 24, 2020 17:48
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants