-
Notifications
You must be signed in to change notification settings - Fork 30
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
Fix calc_dataset_view join with label values #2202
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4665,4 +4665,27 @@ | |
<dropColumn tableName="schema" columnName="token" /> | ||
<dropTable tableName="test_token" /> | ||
</changeSet> | ||
<changeSet id="125" author="lampajr"> | ||
<validCheckSum>ANY</validCheckSum> | ||
<sql> | ||
-- still need db procedure until https://hibernate.atlassian.net/browse/HHH-17314 is fixed in quarkus | ||
CREATE OR REPLACE PROCEDURE calc_dataset_view(datasetId bigint) AS $$ | ||
BEGIN | ||
WITH view_agg AS ( | ||
SELECT | ||
vc.view_id, vc.id as vcid, array_agg(DISTINCT label.id) as label_ids, jsonb_object_agg(label.name, lv.value) as value FROM dataset_schemas ds | ||
JOIN label ON label.schema_id = ds.schema_id | ||
JOIN viewcomponent vc ON vc.labels ? label.name | ||
JOIN label_values lv ON lv.label_id = label.id AND lv.dataset_id = ds.dataset_id | ||
WHERE ds.dataset_id = datasetId | ||
AND vc.view_id IN (SELECT view.id FROM view JOIN dataset ON view.test_id = dataset.testid WHERE dataset.id = datasetId) | ||
GROUP BY vc.view_id, vcid | ||
) | ||
Comment on lines
+4674
to
+4683
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The changes are:
|
||
INSERT INTO dataset_view (dataset_id, view_id, label_ids, value) | ||
SELECT datasetId, view_id, array_agg(DISTINCT label_id), jsonb_object_agg(vcid, value) FROM view_agg, unnest(label_ids) as label_id | ||
GROUP BY view_id; | ||
END | ||
$$ LANGUAGE plpgsql; | ||
</sql> | ||
</changeSet> | ||
</databaseChangeLog> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@johnaohara I also had to remove this because the run transformation is executed async making use of
mediator.executeBlocking(..
therefore thisrecalculations.remove
was getting called immediately before returning this method but much before the recalculation was completed which is wrong.. and it does not prevent multiple recalculation on the same test to happen concurrentlyThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should be fairly safe even without that check as we are wrapping the
mediator.transform
with try-finally that should ensure the finally clause to get called even if transaction-level exceptions are thrown: