Skip to content

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

Closed

Description

@Shams-yang

What is the bug?

reproduce:

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

SemanticCheckException was encountered

Activity

  1. added
    bug
    on Jun 12, 2022
  2. added
    enhancement
    on Jun 13, 2022
  3. penghuo commented on Jun 13, 2022

    @penghuo
    Collaborator

    similar one. #339.

  4. removed
    bug
    on Jun 13, 2022
  5. acarbonetto commented on Jun 30, 2022

    @acarbonetto
    Collaborator

    related issue: #432

  6. dai-chen commented on Jun 30, 2022

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

  7. added a commit that references this issue on Oct 25, 2022
  8. acarbonetto commented on Nov 14, 2022

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

  9. added
    v2.5.0
    on Dec 15, 2022
  10. removed
    v2.5.0
    on Jan 6, 2023
  11. dai-chen commented on Feb 7, 2023

    @dai-chen
    Collaborator

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

  12. added a commit that references this issue on Feb 14, 2023
  13. added a commit that references this issue on Mar 21, 2023
  14. added a commit that references this issue on Apr 10, 2023
  15. added 2 commits that reference this issue on Apr 10, 2023
  16. added 2 commits that reference this issue on Apr 12, 2023
  17. acarbonetto commented on Apr 17, 2023

    @acarbonetto
    Collaborator

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

  18. added a commit that references this issue on Apr 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementv2.7.0

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions