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] query rewriting error using JSON_EXTRACT #352

Open
datwiz opened this issue Dec 22, 2023 · 0 comments
Open

[BUG] query rewriting error using JSON_EXTRACT #352

datwiz opened this issue Dec 22, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@datwiz
Copy link
Contributor

datwiz commented Dec 22, 2023

Describe the bug
Using JSON_EXTRACT(...) with json field from a sub-query returns an error.

Example query:

select
    JSON_EXTRACT(<json_col>, '$.<json_field>') as extracted_field
from
(
    select
        <json_row>.value as <json_col>
    from <provider>.<service>.<resource> as <alias>
        , json_each(<json_array_field>) AS <json_row>
) raw

Returns

query rewriting for indirection:: cannot file col = 'JSON_EXTRACT(<json_col>, '$.<json_field>')'

To Reproduce
Example using the pagerduty resource provider.

select
    JSON_EXTRACT(contact_method, '$.html_url') as contact_method_html_url
from
(
    select
        contact_method.value as contact_method
    from pagerduty.users.users as pdu
        , json_each(contact_methods) AS contact_method
) raw

Returns

stackql exec -i sub-query-cols.iql
query rewriting for indirection: cannot find col = 'JSON_EXTRACT(contact_method, '$.html_url')'

Desktop (please complete the following information):

  • OS: macOS
  • SatckQL Version: v0.5.509 (57dbab7)
@datwiz datwiz added the bug Something isn't working label Dec 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant