-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Errors due to Models with Unfolded JSON Columns and a GROUP BY Clause #34930
Labels
.Backend
Difficulty:Medium
.Escalation
Priority:P1
Security holes w/o exploit, crashing, setup/upgrade, login, broken common features, correctness
Querying/Processor
.Team/QueryProcessor
:hammer_and_wrench:
Type:Bug
Product defects
.Wanted: MLv2
Issues that will be fixed (or easier to fix, or possible to fix) when we have MLv2
Comments
Can still reproduce on
|
I can reproduce this. The trouble seems to be that the |
This was referenced Feb 29, 2024
metabase-bot bot
added a commit
that referenced
this issue
Mar 4, 2024
…9446) (#39536) In the legacy QP the `:fields` of the outer query has the ID, `[:field 100 {}]` so the JSON unfolding is written out again. With this change, the `source-alias` is used for columns coming from previous stages. Fixes #34930. Fixes #35636. Co-authored-by: Braden Shepherdson <braden@metabase.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
.Backend
Difficulty:Medium
.Escalation
Priority:P1
Security holes w/o exploit, crashing, setup/upgrade, login, broken common features, correctness
Querying/Processor
.Team/QueryProcessor
:hammer_and_wrench:
Type:Bug
Product defects
.Wanted: MLv2
Issues that will be fixed (or easier to fix, or possible to fix) when we have MLv2
Describe the bug
Issues using the Group By clause in conjunction with aggregate functions for JSON columns that have been unfolded.
To Reproduce
Using a postgres table with JSON unfolded.
Save it as a question and Summarize with a Group By clause
This works as expected
The SQL that is generated
You are also able to write a native query against the table to get the same results as above.
Convert that same question into a model and create the same aggregation as above.
![Screenshot 2023-10-20 at 4 36 48 PM](https://private-user-images.githubusercontent.com/17398657/277059813-ea729197-986b-4ba6-863b-a87e1bc76c39.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjAxNTA3OTksIm5iZiI6MTcyMDE1MDQ5OSwicGF0aCI6Ii8xNzM5ODY1Ny8yNzcwNTk4MTMtZWE3MjkxOTctOTg2Yi00YmE2LTg2M2ItYTg3ZTFiYzc2YzM5LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MDUlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzA1VDAzMzQ1OVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWQ0ZmY3Yjg3YmJhMGZhNTVmY2M5YmFhZWQyZDUwOTViMmIyMzU2NTM3NGJiYTRhMTgzZmM4MTU5YWUzZmJmNTImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.QQ-mYnA3HhjPei5w6UliRzvM-pimdacKSX6d9f9-ahk)
The SQL that is generated
Expected behavior
The expectation is for the aggregation in the model to behavior similar to the question
Logs
No response
Information about your Metabase installation
Severity
P2 - It's a block for those bringing in JSON with the intention to build models based on that data
Additional context
No response
The text was updated successfully, but these errors were encountered: