-
Notifications
You must be signed in to change notification settings - Fork 21
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
[O2B-1365] Implement GAQ periods views #1808
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1808 +/- ##
==========================================
- Coverage 43.79% 43.60% -0.19%
==========================================
Files 893 893
Lines 15951 15964 +13
Branches 3002 3013 +11
==========================================
- Hits 6985 6961 -24
- Misses 8966 9003 +37 ☔ View full report in Codecov by Sentry. |
UNION | ||
( ${SELECT_RUNS_TO_TIMESTAMPS_FOR_GAQ_PERIODS} ) | ||
UNION | ||
-- Two selectes for timestamps of QC flags' effective periods |
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.
-- Two selectes for timestamps of QC flags' effective periods | |
-- Two selects for timestamps of QC flags' effective periods |
Simple typo
NTH_VALUE(timestamp, 2) OVER ( | ||
PARTITION BY data_pass_id, | ||
run_number | ||
ORDER BY ap.ordering_timestamp | ||
ROWS BETWEEN CURRENT ROW AND 1 FOLLOWING | ||
) AS \`to\`, |
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.
This kind of function are relatively rarely used (in my experience), it might be useful to put a small comment stating what you are doing here?
Also, maybe you can replace the NTH_VALUE
and ROWS BETWEEN...
by the LAG
function? You might need to reverse the order, not sure
gaq_periods.\`from\`, | ||
gaq_periods.\`to\`; | ||
SELECT * FROM gaq_periods | ||
WHERE IF(gaq_periods.\`to\` = UNIX_TIMESTAMP(NOW(3)), null, gaq_periods.\`to\`) IS NOT NULL |
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.
If I am correct, you do not need the if anymore?
1, | ||
null | ||
), | ||
SUM( | ||
COALESCE(effectivePeriods.\`to\`, UNIX_TIMESTAMP(run.time_end)) | ||
- COALESCE(effectivePeriods.\`from\`, UNIX_TIMESTAMP(run.time_start)) | ||
COALESCE(gaq_periods.\`to\`, UNIX_TIMESTAMP(run.time_end)) |
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.
I am not sure, but I think here what you should use is rct_time_start
and rct_time_end
. I created a PR here: #1816
I have a JIRA ticket
Notable changes for users:
Notable changes for developers:
Changes made to the database: