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 option to select SQL engine with each query. #160

Draft
wants to merge 4 commits into
base: integ-add-engine-selector
Choose a base branch
from

Conversation

Yury-Fridlyand
Copy link

@Yury-Fridlyand Yury-Fridlyand commented Nov 10, 2022

Signed-off-by: Yury-Fridlyand [email protected]

Description

This adds a new URL parameter engine, which controls SQL engine selection.
Acceptable values (case insensitive):

  • v1 or legacy
  • v2

If it is not given or has another value, the default strategy is used - V2 with fallback to V1.
Could be used for _explain request as well.
These changes include also support of this parameter by SQL CLI and JDBC driver too.

Examples

Rest API

Add new parameter to URL (in any order):

...?engine=v2
...?format=jdbc&engine=legacy

Examples:

Query not supported by V2 sent to V2:

curl -XPOST "http://localhost:9200/_plugins/_sql?engine=v2" -H 'Content-Type: application/json' -d '{"query": "select COUNT(*) from calcs, calcs"}'

Query not supported by V1 sent to V1:

curl -XPOST "http://localhost:9200/_plugins/_sql?engine=v1" -H 'Content-Type: application/json' -d '{"query": "select 1"}'

SQL CLI tool:

New command line option:

opensearchsql --engine v1

JDBC driver

Add new parameter to connection string (in any order)

...?engine=v2
...?auth=BASIC&engine=v1

Notes

  1. Please, consider that it is not a production feature and it should be removed soon. I made it as simple as possible.
  2. It is supposed to be removed/reverted before next release. If needed it could be restored back after release.

Issues Resolved

N/A

Check List

  • New functionality includes testing.
    • All tests pass, including unit test, integration test and doctest
  • New functionality has been documented.
    • New functionality has javadoc added
    • New functionality has user manual doc added
  • Commits are signed per the DCO using --signoff

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.

@codecov

This comment was marked as abuse.

Signed-off-by: Yury-Fridlyand <[email protected]>
Signed-off-by: Yury-Fridlyand <[email protected]>
@Yury-Fridlyand Yury-Fridlyand marked this pull request as ready for review November 10, 2022 21:05
@Yury-Fridlyand Yury-Fridlyand changed the title [WIP] Add option to specify SQL engine with a query. Add option to specify SQL engine with a query. Nov 10, 2022
@Yury-Fridlyand Yury-Fridlyand changed the title Add option to specify SQL engine with a query. Add option to select SQL engine with each query. Nov 11, 2022
@Yury-Fridlyand Yury-Fridlyand marked this pull request as draft November 14, 2022 17:56
andy-k-improving pushed a commit that referenced this pull request Nov 16, 2024
* Import h3 library (#154)

Made following changes to make it compatible:
1. Rename package from elasticsearch to opensearch.geospatial
2. Update License headers
3. Update build file
4. Update settings to include sub projects

* Use Transport Request (#164)

Remove usage of deprecated BaseNodeRequest

* Update http client package to resolve build failure (#168) (#171)

* Introduce H3 min resolution constant (#165)

H3 version 1 has 16 resolutions, numbered 0 through 15.
Introduced a constant to represent min value, similar
to max value.

* Add geohex aggregation (#160)

This aggregation will use uber's h3 to group coordinates into H3 cell.
Created new aggregation type geohex_grid. The precision will be between
0 and 15. This aggreation has default precision as 5,
similar to geohash and geotile.

Signed-off-by: Vijayan Balasubramanian <[email protected]>

* Add integration test (#176)

Included integration test for geohex_grid.

Signed-off-by: Vijayan Balasubramanian <[email protected]>
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.

1 participant