Skip to content
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

Add describe and show covering index SQL support #36

Conversation

dai-chen
Copy link
Collaborator

@dai-chen dai-chen commented Sep 18, 2023

Description

  1. Add DESC INDEX statement support
  2. Add SHOW INDEX index statement support based on a new getAllIndexMetadata() API in Flint client

Example

spark-sql> SHOW INDEX ON stream.lineitem_tiny;

spark-sql> CREATE INDEX orderkey_and_quantity
         > ON stream.lineitem_tiny (l_orderkey, l_quantity)
         > WITH (auto_refresh = true);

spark-sql> SHOW INDEX ON stream.lineitem_tiny;
index_name
orderkey_and_quantity

spark-sql> CREATE INDEX discount_and_quantity
         > ON stream.lineitem_tiny (l_discount, l_quantity)
         > WITH (auto_refresh = true);

spark-sql> SHOW INDEX ON stream.lineitem_tiny;
index_name
discount_and_quantity
orderkey_and_quantity

spark-sql> DESC INDEX discount_and_quantity ON stream.lineitem_tiny;
indexed_col_name	data_type	index_type
l_discount	         float	            indexed
l_quantity	         float	            indexed

Issues Resolved

#23

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.

@dai-chen dai-chen added the enhancement New feature or request label Sep 18, 2023
@dai-chen dai-chen self-assigned this Sep 18, 2023
Signed-off-by: Chen Dai <daichen@amazon.com>
Signed-off-by: Chen Dai <daichen@amazon.com>
Signed-off-by: Chen Dai <daichen@amazon.com>
Signed-off-by: Chen Dai <daichen@amazon.com>
@dai-chen dai-chen force-pushed the add-covering-index-show-desc-sql-support branch from bd3f053 to 3c77a98 Compare September 20, 2023 17:42
@dai-chen dai-chen marked this pull request as ready for review September 21, 2023 20:25
* @param indexNamePattern index name pattern
* @return all matched index metadata
*/
List<FlintMetadata> getAllIndexMetadata(String indexNamePattern);
Copy link
Member

@YANG-DB YANG-DB Sep 25, 2023

Choose a reason for hiding this comment

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

why is the 'All' needed ? the parameter nane and return value already indicate this is a pattern and may return a list of indices

Copy link
Collaborator Author

@dai-chen dai-chen Sep 25, 2023

Choose a reason for hiding this comment

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

Because there is another API FlintMetadata getIndexMetadata(String indexName) below with same name and argument list. I'm thinking get[All]IndexMetadata maybe better than getIndexMetadata[s]?

I was also thinking of providing single getIndexMetadata API for both purpose. But it seems confusing when we pass index name and expect single metadata returned.

Copy link
Member

Choose a reason for hiding this comment

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

maybe getIndicesMetadata - anyhow the return signature also helps distinguish between them IMO ...

Copy link
Collaborator Author

@dai-chen dai-chen Sep 25, 2023

Choose a reason for hiding this comment

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

I can rename it to getIndexMetadata[s] if you have strong opinion? Or any better name? (getIndexMetadataWithPattern?)
IMO, it's intuitive to have different method name and also required by compiler... Thanks.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Will merge this for now and rename if we come up with better name. Thanks!

@dai-chen dai-chen merged commit eadb614 into opensearch-project:main Sep 25, 2023
4 checks passed
@dai-chen dai-chen deleted the add-covering-index-show-desc-sql-support branch September 25, 2023 18:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants