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

Support show and describe statement #907

Merged

Conversation

penghuo
Copy link
Contributor

@penghuo penghuo commented Dec 10, 2020

Related Issue:

#404

Description of changes

  1. Add the support of SHOW and DESCRIBE.
  2. Add orderedTable in the SymbotTable to keep the eleement ordered in the array. The reasons is when executing SELECT * FROM TABEL the * should be expanded following the order defined by TABLE schema.

Breaking Change

In the legacy engine, if the index has alias, the index name will be returned instead of the alias name. e.g.

PUT demo_index/alias/demo_alias

SHOW TABLES LIKE demo_alias

The demo_index will be returned as table name instead of demo_alias. In the new engine, we change to retrun the alias name, in the example, the demo_alias will be returned.

Todo

The current implementation doesn't existly follow the semantic definition of LIKE operator. Ideally, the operand of LIKE operator shoud be string literal to represent the match pattern. But the legacy engine use identifier in this case, e.g. SHOW TABLES LIKE %. For backward compability reason, we still support it now, but it will be deprecated soon.

To Reviewer

I briefly describe the changed files in each module.

  1. core. add the orderedTable.
  2. docs. no breaking change. the fields order chagned.
  3. elasticsearch. the major change to implement show and describe.
  4. integ-test. only one breaking change in MetaDataQueriesIT which has been reimplemented in AdminIT which only run with new engine.
  5. protocol. remove the legecy type convert to type class.
  6. sql. front end change for show/describe.

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

@penghuo penghuo self-assigned this Dec 10, 2020
@penghuo penghuo added Breaking Changes Breaking Changes that will impact clients SQL labels Dec 10, 2020
@codecov
Copy link

codecov bot commented Dec 10, 2020

Codecov Report

Merging #907 (5b74a44) into develop (f16f21a) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff             @@
##             develop     #907    +/-   ##
===========================================
  Coverage      99.85%   99.86%            
- Complexity      2149     2190    +41     
===========================================
  Files            216      222     +6     
  Lines           4851     5028   +177     
  Branches         323      326     +3     
===========================================
+ Hits            4844     5021   +177     
  Misses             5        5            
  Partials           2        2            
Impacted Files Coverage Δ Complexity Δ
...orelasticsearch/sql/storage/TableScanOperator.java 100.00% <ø> (ø) 3.00 <0.00> (ø)
...forelasticsearch/sql/analysis/TypeEnvironment.java 100.00% <100.00%> (ø) 10.00 <1.00> (ø)
...elasticsearch/sql/analysis/symbol/SymbolTable.java 100.00% <100.00%> (ø) 17.00 <4.00> (+3.00)
...roforelasticsearch/sql/data/type/ExprCoreType.java 100.00% <100.00%> (ø) 10.00 <1.00> (+1.00)
...distroforelasticsearch/sql/data/type/ExprType.java 100.00% <100.00%> (ø) 7.00 <1.00> (+1.00)
...roforelasticsearch/sql/utils/SystemIndexUtils.java 100.00% <100.00%> (ø) 5.00 <5.00> (?)
.../elasticsearch/client/ElasticsearchNodeClient.java 100.00% <100.00%> (ø) 18.00 <2.00> (+2.00)
.../elasticsearch/client/ElasticsearchRestClient.java 100.00% <100.00%> (ø) 10.00 <2.00> (+2.00)
...elasticsearch/data/type/ElasticsearchDataType.java 100.00% <100.00%> (ø) 4.00 <1.00> (+1.00)
...csearch/executor/ElasticsearchExecutionEngine.java 100.00% <100.00%> (ø) 5.00 <0.00> (ø)
... and 18 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f16f21a...5b74a44. Read the comment docs.

Copy link
Member

@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.

LGTM. Thanks! Could you check if any change needed to avoid this SHOW/DESCRIBE explain issue in new engine? #404

And could you also check if these 2 can be supported now?

  1. Extend support for SHOW query to apply filter on TABLE_CAT, TABLE_SCHEM and TABLE_TYPE #324: Filter by TABLE_CAT, TABLE_SCHEM and TABLE_TYPE
  2. <catalog>.<table> syntax not supported #238: Support for <catalog>.<table>

@penghuo
Copy link
Contributor Author

penghuo commented Dec 11, 2020

LGTM. Thanks! Could you check if any change needed to avoid this SHOW/DESCRIBE explain issue in new engine? #404

And could you also check if these 2 can be supported now?

  1. Extend support for SHOW query to apply filter on TABLE_CAT, TABLE_SCHEM and TABLE_TYPE #324: Filter by TABLE_CAT, TABLE_SCHEM and TABLE_TYPE
  2. <catalog>.<table> syntax not supported #238: Support for <catalog>.<table>

@penghuo penghuo merged commit ddf4523 into opendistro-for-elasticsearch:develop Dec 11, 2020
harold-wang pushed a commit to harold-wang/sql that referenced this pull request Dec 11, 2020
* add frontend support

* update core

* add elasticsearch

* update

* add debug

* fix UT

* update

* add comments

* add explain

* update
penghuo added a commit that referenced this pull request Dec 15, 2020
* add frontend support

* update core

* add elasticsearch

* update

* add debug

* fix UT

* update

* add comments

* add explain

* update
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Breaking Changes Breaking Changes that will impact clients SQL
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants