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

Queries on JSONB #433

Open
ghost opened this issue Aug 12, 2018 · 1 comment
Open

Queries on JSONB #433

ghost opened this issue Aug 12, 2018 · 1 comment
Labels
kind/enhancement This is an enhancement of an existing feature

Comments

@ghost
Copy link

ghost commented Aug 12, 2018

this works:

cqlsh> SELECT * FROM store.books where details->'yo'->'shi'->0->>'type' = 'a';

 id | details
----+----------------------------------------------------------------------
 44 | {"yo":{"shi":[{"type":"a","value":"aa"},{"type":"b","value":"bb"}]}}

it would be great if I could target type:b without knowing its index which is 1:

cqlsh> SELECT * FROM store.books where details->'yo'->'shi'->*->>'type' = 'b';

 id | details
----+----------------------------------------------------------------------
 44 | {"yo":{"shi":[{"type":"a","value":"aa"},{"type":"b","value":"bb"}]}}

it could be even better if I could target directly anything embedded without knowing its path:

cqlsh> SELECT * FROM store.books where details->*->>'value' = 'bb';

 id | details
----+----------------------------------------------------------------------
 44 | {"yo":{"shi":[{"type":"a","value":"aa"},{"type":"b","value":"bb"}]}}
@kmuthukk kmuthukk added the kind/enhancement This is an enhancement of an existing feature label Aug 13, 2018
@kmuthukk
Copy link
Collaborator

kmuthukk commented Aug 13, 2018

hi @pouledodue

Yes, seems reasonable that at some point we extend the search/match capability within the JSON document to support some wildcard expressions.

One note: currently the queries as specified will pretty much result in a full-table scan because currently we don't yet allow creating secondary indexes on JSON attributes.

JSON support and "secondary indexes for primitive type columns" are both features currently in Beta that we expect to GA in the 1.1 release of YugaByte.

In the next phase (i.e. post 1.1), we hope to also allow the ability to create secondary indexes on JSON attributes.

regards,
Kannan

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement This is an enhancement of an existing feature
Projects
Status: No status
Development

No branches or pull requests

1 participant