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

[BUG] _id is not available in where condition #639

Closed
Shams-yang opened this issue Jun 12, 2022 · 6 comments
Closed

[BUG] _id is not available in where condition #639

Shams-yang opened this issue Jun 12, 2022 · 6 comments
Assignees
Labels
enhancement New feature or request v2.7.0

Comments

@Shams-yang
Copy link

Shams-yang commented Jun 12, 2022

What is the bug?

reproduce:

POST _plugins/_sql
{
"query": "SELECT * FROM my-index1 where _id = 1"
}

SemanticCheckException was encountered

@Shams-yang Shams-yang added bug Something isn't working untriaged labels Jun 12, 2022
@penghuo penghuo added the enhancement New feature or request label Jun 13, 2022
@penghuo
Copy link
Collaborator

penghuo commented Jun 13, 2022

similar one. #339.

@penghuo penghuo removed bug Something isn't working untriaged labels Jun 13, 2022
@acarbonetto
Copy link
Collaborator

related issue: #432

@dai-chen
Copy link
Collaborator

Since we're adding more Storage implementation for external data source, such as S3, Prometheus. Probably another way to look at this is: every storage may have some special/meta fields. For example, OpenSearch has _id, _score, S3 may have _partition, _file like these in Trino https://trino.io/docs/current/connector/hive.html#special-columns.

@acarbonetto
Copy link
Collaborator

We can include metadata fields in the parser language as part of this ticket and hardcode the field types in the expression analyzer. This will also work to fix the double underscore fields.

@dai-chen unfortunately, this doesn't work for other storage devices - which means all _id fields will be treated equally. We would need to think of a way around this when defining our user-defined-languages and maybe just check the table storage type is part of a hardcoded list (for that storage type) or is defined in the user-defined-language.

Works for these examples:

SELECT calcs.key, str0, _id, _score, _maxscore FROM calcs WHERE _id="5"
>> returns calcs.key, calcs.str0, calcs._id, calcs._score, calcs._maxscore

SELECT *, _id FROM bigint WHERE _id="2"
>> returns all of the fields defined in bigint plus _id

SELECT __myCoolField FROM myindex WHERE __myCoolField="cool";
>>returns myindex.__myCoolField

PR prototype: Bit-Quill#142

@dai-chen dai-chen added the v2.5.0 'Issues and PRs related to version v2.5.0' label Dec 15, 2022
@dai-chen dai-chen removed the v2.5.0 'Issues and PRs related to version v2.5.0' label Jan 6, 2023
@dai-chen
Copy link
Collaborator

dai-chen commented Feb 7, 2023

@acarbonetto Any progress on this? I'm thinking can we label all these related issues 2.6.0?

acarbonetto added a commit to Bit-Quill/opensearch-project-sql that referenced this issue Feb 14, 2023
…lifiedName

Signed-off-by: Andrew Carbonetto <andrewc@bitquilltech.com>
acarbonetto added a commit to Bit-Quill/opensearch-project-sql that referenced this issue Mar 21, 2023
…nction (#228)

* Rebase from main

Signed-off-by: Andrew Carbonetto <andrewc@bitquilltech.com>

* Update to define and include metadata when visiting the expr node

Signed-off-by: Andrew Carbonetto <andrewc@bitquilltech.com>

* Add specific metadata identifiers

Signed-off-by: Andrew Carbonetto <andrewc@bitquilltech.com>

* Add IT tests and add parser changes

Signed-off-by: Andrew Carbonetto <andrewc@bitquilltech.com>

* Rebase from main

Signed-off-by: Andrew Carbonetto <andrewc@bitquilltech.com>

* Update score function expression analyzer to return boosted relevance function

Signed-off-by: Andrew Carbonetto <andrewc@bitquilltech.com>

* Update builder to track scores

Signed-off-by: Andrew Carbonetto <andrewc@bitquilltech.com>

* Remove ScoreExpression.java and cleanup checkstyle

Signed-off-by: Andrew Carbonetto <andrewc@bitquilltech.com>

* cleanup checkstyle

Signed-off-by: Andrew Carbonetto <andrewc@bitquilltech.com>

* Cleanup and add alternative score function syntax

Signed-off-by: Andrew Carbonetto <andrewc@bitquilltech.com>

* Cleanup and add alternative score function syntax

Signed-off-by: Andrew Carbonetto <andrewc@bitquilltech.com>

* Fix some bugs and add Expression tests

Signed-off-by: Andrew Carbonetto <andrewc@bitquilltech.com>

* Add expresssion and analyzer tests

Signed-off-by: Andrew Carbonetto <andrewc@bitquilltech.com>

* Add score doctests

Signed-off-by: Andrew Carbonetto <andrewc@bitquilltech.com>

* Add score function doctests

Signed-off-by: Andrew Carbonetto <andrewc@bitquilltech.com>

* Add metafield tests

Signed-off-by: Andrew Carbonetto <andrewc@bitquilltech.com>

* Move legacy test and mark old as ignore

Signed-off-by: Andrew Carbonetto <andrewc@bitquilltech.com>

* fix checkstyle violations

Signed-off-by: Andrew Carbonetto <andrewc@bitquilltech.com>

* fix checkstyle violations

Signed-off-by: Andrew Carbonetto <andrewc@bitquilltech.com>

* Update tests and identifier to accept metafields

Signed-off-by: Andrew Carbonetto <andrewc@bitquilltech.com>

* Checkstyle fixes

Signed-off-by: Andrew Carbonetto <andrewc@bitquilltech.com>

* Rebase from main

Signed-off-by: Andrew Carbonetto <andrewc@bitquilltech.com>

* Rebase from main

Signed-off-by: Andrew Carbonetto <andrewc@bitquilltech.com>

* Rebase from main

Signed-off-by: Andrew Carbonetto <andrewc@bitquilltech.com>

* fix checkstyle violations

Signed-off-by: Andrew Carbonetto <andrewc@bitquilltech.com>

* Revert bad conflict resolution

Signed-off-by: Andrew Carbonetto <andrewc@bitquilltech.com>

* Fix for review comments

Signed-off-by: Andrew Carbonetto <andrewc@bitquilltech.com>

* Update IT tests and legacy tests for comments

Signed-off-by: Andrew Carbonetto <andrewc@bitquilltech.com>

* Minor comment

Signed-off-by: Andrew Carbonetto <andrewc@bitquilltech.com>

* Updates for whitespace

Signed-off-by: Andrew Carbonetto <andrewc@bitquilltech.com>

* Update basics.rst to show OS result

Signed-off-by: Andrew Carbonetto <andrewc@bitquilltech.com>

* Update basics.rst to show OS result

Signed-off-by: Andrew Carbonetto <andrewc@bitquilltech.com>

* Update basics.rst description

Signed-off-by: Andrew Carbonetto <andrewc@bitquilltech.com>

* Change Score function to accept a double/integer not an unresolved

Signed-off-by: Andrew Carbonetto <andrewc@bitquilltech.com>

* Update functions.rst

Signed-off-by: Andrew Carbonetto <andrewc@bitquilltech.com>

* Checkstyle update

Signed-off-by: Andrew Carbonetto <andrewc@bitquilltech.com>

* Move reserved world symbol table to OpenSearchTable

Signed-off-by: Andrew Carbonetto <andrewc@bitquilltech.com>

* Update functions.rst for review comments

Signed-off-by: Andrew Carbonetto <andrewc@bitquilltech.com>

* Removed parser meta tokens; Changes ImmutableMap to Map

Signed-off-by: Andrew Carbonetto <andrewc@bitquilltech.com>

* Removed parser meta tokens; Changes ImmutableMap to Map

Signed-off-by: Andrew Carbonetto <andrewc@bitquilltech.com>

---------

Signed-off-by: Andrew Carbonetto <andrewc@bitquilltech.com>
MaxKsyunz pushed a commit that referenced this issue Apr 10, 2023
…ction (#228) (#1456)

Allow metadata fields and score OpenSearch function.

Signed-off-by: Andrew Carbonetto <andrewc@bitquilltech.com>
opensearch-trigger-bot bot pushed a commit that referenced this issue Apr 10, 2023
…ction (#228) (#1456)

Allow metadata fields and score OpenSearch function.

Signed-off-by: Andrew Carbonetto <andrewc@bitquilltech.com>
(cherry picked from commit e805151)
opensearch-trigger-bot bot pushed a commit that referenced this issue Apr 10, 2023
…ction (#228) (#1456)

Allow metadata fields and score OpenSearch function.

Signed-off-by: Andrew Carbonetto <andrewc@bitquilltech.com>
(cherry picked from commit e805151)
penghuo pushed a commit that referenced this issue Apr 12, 2023
…ion (#228) (#1509)

* #639: Support OpenSearch metadata fields and the score OpenSearch function (#228) (#1456)

Signed-off-by: Andrew Carbonetto <andrewc@bitquilltech.com>
Co-authored-by: Andrew Carbonetto <andrewc@bitquilltech.com>
penghuo pushed a commit that referenced this issue Apr 12, 2023
…ion (#228) (#1508)

* #639: Support OpenSearch metadata fields and the score OpenSearch function (#228) (#1456)

Signed-off-by: Andrew Carbonetto <andrewc@bitquilltech.com>
Co-authored-by: Andrew Carbonetto <andrewc@bitquilltech.com>
@acarbonetto
Copy link
Collaborator

@dai-chen this issue can be closed as part of #1456

acarbonetto added a commit to Bit-Quill/opensearch-project-sql that referenced this issue Apr 18, 2023
…elds and the score OpenSearch function (#228) (opensearch-project#1456)

Allow metadata fields and score OpenSearch function.

Signed-off-by: Andrew Carbonetto <andrewc@bitquilltech.com>
andy-k-improving pushed a commit to Bit-Quill/opensearch-project-sql that referenced this issue Nov 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request v2.7.0
Projects
None yet
Development

No branches or pull requests

5 participants