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

Support SELECT * and FROM clause in new SQL parser #573

Merged

Conversation

dai-chen
Copy link
Member

@dai-chen dai-chen commented Jul 13, 2020

Issue #, if available: #575, #504, #322

Description of changes: Change SQL grammar to integrate with new engine and support SELECT * and FROM clause.

  1. Change SQL grammar: split identifier rule to an individual file so it can be overridden in fuzzy testing.
  2. Build Relation node and QualifiedName expression in AST builder.

Testing: Add new UT and IT for different types of identifier (index name). Because of problem with date, text and keyword in JDBC driver, select * is not added to comparison test.

Note a major change on integration test: A new integTestWithNewEngine task is added to run PPL and new, legacy, comparison SQL ITs with new engine enabled. The integTest depends on it and only runs legacy SQL ITs with new engine disabled. Because more and more SQL queries will start being handled by new engine after FROM clause added, this makes sure that our legacy ITs can work with/without new engine enabled.

Documentation: Checked out MySQL, SQLServer and ANSI SQL and organize our doc in this way: https://github.com/dai-chen/sql/blob/support-select-all-from/docs/user/general/identifiers.rst

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 added the SQL label Jul 13, 2020
@dai-chen dai-chen self-assigned this Jul 13, 2020
@dai-chen dai-chen changed the title Support select all from Support SELECT * and FROM clause Jul 13, 2020
@dai-chen dai-chen changed the title Support SELECT * and FROM clause Support SELECT * and FROM clause in new engine Jul 14, 2020
@dai-chen dai-chen changed the title Support SELECT * and FROM clause in new engine Support SELECT * and FROM clause in new SQL parser Jul 14, 2020
@dai-chen dai-chen marked this pull request as ready for review July 16, 2020 14:46
@dai-chen dai-chen requested review from penghuo and chloe-zh July 16, 2020 14:46
Copy link
Member

@chloe-zh chloe-zh left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

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.

Thanks for the change.

@dai-chen dai-chen merged commit 0a878ab into opendistro-for-elasticsearch:develop Jul 21, 2020
@dai-chen dai-chen deleted the support-select-all-from branch July 21, 2020 17:58
@kedargn
Copy link

kedargn commented Sep 2, 2020

@dai-chen I am facing the same issue. I tried to enable 'opendistro.sql.engine.new.enabled' setting in open distro ES version 1.8.0. I got an error

{
  "error": {
    "root_cause": [
      {
        "type": "illegal_argument_exception",
        "reason": "transient setting [opendistro.sql.engine.new.enabled], not recognized"
      }
    ],
    "type": "illegal_argument_exception",
    "reason": "transient setting [opendistro.sql.engine.new.enabled], not recognized"
  },
  "status": 400
}

Do I have to update to version 1.9.0 to enable new SQL engine?

@dai-chen
Copy link
Member Author

dai-chen commented Sep 2, 2020

@dai-chen I am facing the same issue. I tried to enable 'opendistro.sql.engine.new.enabled' setting in open distro ES version 1.8.0. I got an error

{
  "error": {
    "root_cause": [
      {
        "type": "illegal_argument_exception",
        "reason": "transient setting [opendistro.sql.engine.new.enabled], not recognized"
      }
    ],
    "type": "illegal_argument_exception",
    "reason": "transient setting [opendistro.sql.engine.new.enabled], not recognized"
  },
  "status": 400
}

Do I have to update to version 1.9.0 to enable new SQL engine?

Thanks for reaching out! This setting and new query engine is available in 1.9.0.1+: https://github.com/opendistro-for-elasticsearch/sql/blob/opendistro-1.9.0.1/docs/user/admin/settings.rst#opendistro-sql-engine-new-enabled. Please try to upgrade to 1.9.0.1 or latest 1.10. Thanks!

@kedargn
Copy link

kedargn commented Sep 2, 2020

@dai-chen I am facing the same issue. I tried to enable 'opendistro.sql.engine.new.enabled' setting in open distro ES version 1.8.0. I got an error

{
  "error": {
    "root_cause": [
      {
        "type": "illegal_argument_exception",
        "reason": "transient setting [opendistro.sql.engine.new.enabled], not recognized"
      }
    ],
    "type": "illegal_argument_exception",
    "reason": "transient setting [opendistro.sql.engine.new.enabled], not recognized"
  },
  "status": 400
}

Do I have to update to version 1.9.0 to enable new SQL engine?

Thanks for reaching out! This setting and new query engine is available in 1.9.0.1+: https://github.com/opendistro-for-elasticsearch/sql/blob/opendistro-1.9.0.1/docs/user/admin/settings.rst#opendistro-sql-engine-new-enabled. Please try to upgrade to 1.9.0.1 or latest 1.10. Thanks!

@dai-chen Thank you for your reply! Latest docker image for open distro ES I can find is 1.9.0. I am not able to find 1.10. Am I missing something here? https://hub.docker.com/r/amazon/opendistro-for-elasticsearch/tags

@dai-chen
Copy link
Member Author

dai-chen commented Sep 2, 2020

@dai-chen I am facing the same issue. I tried to enable 'opendistro.sql.engine.new.enabled' setting in open distro ES version 1.8.0. I got an error

{
  "error": {
    "root_cause": [
      {
        "type": "illegal_argument_exception",
        "reason": "transient setting [opendistro.sql.engine.new.enabled], not recognized"
      }
    ],
    "type": "illegal_argument_exception",
    "reason": "transient setting [opendistro.sql.engine.new.enabled], not recognized"
  },
  "status": 400
}

Do I have to update to version 1.9.0 to enable new SQL engine?

Thanks for reaching out! This setting and new query engine is available in 1.9.0.1+: https://github.com/opendistro-for-elasticsearch/sql/blob/opendistro-1.9.0.1/docs/user/admin/settings.rst#opendistro-sql-engine-new-enabled. Please try to upgrade to 1.9.0.1 or latest 1.10. Thanks!

@dai-chen Thank you for your reply! Latest docker image for open distro ES I can find is 1.9.0. I am not able to find 1.10. Am I missing something here? https://hub.docker.com/r/amazon/opendistro-for-elasticsearch/tags

I can see other artifacts updated to 1.9.0.1 already. Could you try to check out 1.9.0.1 docker image?

@kedargn
Copy link

kedargn commented Sep 2, 2020

@dai-chen I am facing the same issue. I tried to enable 'opendistro.sql.engine.new.enabled' setting in open distro ES version 1.8.0. I got an error

{
  "error": {
    "root_cause": [
      {
        "type": "illegal_argument_exception",
        "reason": "transient setting [opendistro.sql.engine.new.enabled], not recognized"
      }
    ],
    "type": "illegal_argument_exception",
    "reason": "transient setting [opendistro.sql.engine.new.enabled], not recognized"
  },
  "status": 400
}

Do I have to update to version 1.9.0 to enable new SQL engine?

Thanks for reaching out! This setting and new query engine is available in 1.9.0.1+: https://github.com/opendistro-for-elasticsearch/sql/blob/opendistro-1.9.0.1/docs/user/admin/settings.rst#opendistro-sql-engine-new-enabled. Please try to upgrade to 1.9.0.1 or latest 1.10. Thanks!

@dai-chen Thank you for your reply! Latest docker image for open distro ES I can find is 1.9.0. I am not able to find 1.10. Am I missing something here? https://hub.docker.com/r/amazon/opendistro-for-elasticsearch/tags

I can see other artifacts updated to 1.9.0.1 already. Could you try to check out 1.9.0.1 docker image?

When I try to pull 1.9.0.1 it says not found.

docker image pull "amazon/opendistro-for-elasticsearch:1.9.0.1"
Error response from daemon: manifest for amazon/opendistro-for-elasticsearch:1.9.0.1 not found

However, I can see 1.9.0

1.9.0: Pulling from amazon/opendistro-for-elasticsearch
Digest: sha256:878e6947b3a50487f5a57453a7ba8c1e7da6488f997c6fc257c657ad04874d29
Status: Image is up to date for amazon/opendistro-for-elasticsearch:1.9.0

Also, I don't see version 1.9.0.1 here https://hub.docker.com/r/amazon/opendistro-for-elasticsearch/tags. Am I doing something wrong?

@dai-chen
Copy link
Member Author

dai-chen commented Sep 2, 2020

@dai-chen I am facing the same issue. I tried to enable 'opendistro.sql.engine.new.enabled' setting in open distro ES version 1.8.0. I got an error

{
  "error": {
    "root_cause": [
      {
        "type": "illegal_argument_exception",
        "reason": "transient setting [opendistro.sql.engine.new.enabled], not recognized"
      }
    ],
    "type": "illegal_argument_exception",
    "reason": "transient setting [opendistro.sql.engine.new.enabled], not recognized"
  },
  "status": 400
}

Do I have to update to version 1.9.0 to enable new SQL engine?

Thanks for reaching out! This setting and new query engine is available in 1.9.0.1+: https://github.com/opendistro-for-elasticsearch/sql/blob/opendistro-1.9.0.1/docs/user/admin/settings.rst#opendistro-sql-engine-new-enabled. Please try to upgrade to 1.9.0.1 or latest 1.10. Thanks!

@dai-chen Thank you for your reply! Latest docker image for open distro ES I can find is 1.9.0. I am not able to find 1.10. Am I missing something here? https://hub.docker.com/r/amazon/opendistro-for-elasticsearch/tags

I can see other artifacts updated to 1.9.0.1 already. Could you try to check out 1.9.0.1 docker image?

When I try to pull 1.9.0.1 it says not found.

docker image pull "amazon/opendistro-for-elasticsearch:1.9.0.1"
Error response from daemon: manifest for amazon/opendistro-for-elasticsearch:1.9.0.1 not found

However, I can see 1.9.0

1.9.0: Pulling from amazon/opendistro-for-elasticsearch
Digest: sha256:878e6947b3a50487f5a57453a7ba8c1e7da6488f997c6fc257c657ad04874d29
Status: Image is up to date for amazon/opendistro-for-elasticsearch:1.9.0

Also, I don't see version 1.9.0.1 here https://hub.docker.com/r/amazon/opendistro-for-elasticsearch/tags. Am I doing something wrong?

I see. Although other artifacts are available, it seems we haven't announced the 1.9.0.1 yet: https://opendistro.github.io/for-elasticsearch/blog/. Sorry for the confusion and please stay tune for the upcoming release. You should be able to enable and play with new query engine soon.

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.

4 participants