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

bq query audit [VS-1396] #8847

Merged
merged 9 commits into from
May 30, 2024
Merged

bq query audit [VS-1396] #8847

merged 9 commits into from
May 30, 2024

Conversation

mcovarr
Copy link
Collaborator

@mcovarr mcovarr commented May 23, 2024

No description provided.

@mcovarr mcovarr marked this pull request as ready for review May 28, 2024 16:13
@gbggrant
Copy link
Collaborator

Have you run an integration test?

Copy link
Collaborator

@gbggrant gbggrant left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, but could use an integration test?

NUMANRESULTS=$(awk 'END{print NR}' bq_an_output.csv)
NUMACRESULTS=$(awk 'END{print NR}' bq_ac_output.csv)


echo "false" > ~{pf_file}
# if the results of the queries have any rows, that means there are sites with mis-matched gvs_all_an or gvs_all_ac
if [[ $NUMANRESULTS != "0" ]]; then
echo "The VAT table ~{fq_vat_table} has mis-matched calculations for AC, and AC of subpopulations" > ~{results_file}
echo "The VAT table ~{fq_vat_table} has mis-matched calculations for AC, and AC of subpopulations, 100 rows max shown in results." 1>&2
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure this is the very best way to handle the error message (suggestions please!), but the existing code was wrong: we wrote an error message to ~{results_file} and then immediately clobbered it with the CSV output from bq query. There's another pattern for this used above that I like even less so I'm reluctant to switch to that...

cp bq_an_output.csv ~{results_file}
elif [[ $NUMACRESULTS != "0" ]]; then
echo "The VAT table ~{fq_vat_table} has mis-matched calculations for AN, and AN of subpopulations" > ~{results_file}
echo "The VAT table ~{fq_vat_table} has mis-matched calculations for AN, and AN of subpopulations, 100 rows max shown in results." 1>&2
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same situation as above

@@ -395,7 +397,7 @@ task SpotCheckForExpectedTranscripts {
echo "The VAT table ~{fq_vat_table} only has the expected transcripts at the tested location ('IGFLR1' and 'AD000671.2' in chromosome 19, between positions 35,740,407 - 35,740,469)." > ~{results_file}
echo "true" > ~{pf_file}
else
echo "The VAT table ~{fq_vat_table} had unexpected transcripts at the tested location: [csv output follows] " > ~{results_file}
echo "The VAT table ~{fq_vat_table} had unexpected transcripts at the tested location: [csv output with 100 results max follows] " > ~{results_file}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incidental finding: this is a bit strange, the result is a CSV with an extra line of error message at the top

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

small lol that there are these issues with the VAT validation

@@ -479,7 +482,7 @@ task SchemaNoNullRequiredFields {
echo "The VAT table ~{fq_vat_table} has no null values in required fields" > ~{results_file}
echo "true" > ~{pf_file}
else
echo "The VAT table ~{fq_vat_table} had null values in required fields: [csv output follows] " > ~{results_file}
echo "The VAT table ~{fq_vat_table} had null values in required fields: [csv output with 100 results max follows] " > ~{results_file}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

@@ -597,7 +602,7 @@ task SchemaPrimaryKey {
echo "The VAT table ~{fq_vat_table} has all unique key combinations (vid+transcript)" > ~{results_file}
echo "true" > ~{pf_file}
else
echo "The VAT table ~{fq_vat_table} had repeating key combinations (vid+transcript): [csv output follows] " > ~{results_file}
echo "The VAT table ~{fq_vat_table} had repeating key combinations (vid+transcript): [csv output with 100 results max follows] " > ~{results_file}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

again

@mcovarr mcovarr requested review from rsasch and RoriCremer May 29, 2024 15:13
@@ -117,7 +117,8 @@ task CoreStorageModelSizes {
local table_pattern="$1"
local output_file_name="$2"

bq --apilog=false query --project_id='~{project_id}' --format=csv --use_legacy_sql=false \
# bq query --max_rows check: explicitly set massive max rows as we expect there to be as many rows as there are superpartitions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't this going to always return one line because it's a sum()?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops yes

@@ -117,7 +117,8 @@ task CoreStorageModelSizes {
local table_pattern="$1"
local output_file_name="$2"

bq --apilog=false query --project_id='~{project_id}' --format=csv --use_legacy_sql=false \
# bq query --max_rows check: ok one row
bq --apilog=false query --max_rows 10000000 --project_id='~{project_id}' --format=csv --use_legacy_sql=false \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we eventually want the max_rows to be a param somewhere?

@mcovarr
Copy link
Collaborator Author

mcovarr commented May 30, 2024

Integration run here

@mcovarr mcovarr merged commit 1d17d17 into ah_var_store May 30, 2024
21 checks passed
@mcovarr mcovarr deleted the vs_1396_bq_query_audit branch May 30, 2024 21:14
mcovarr added a commit that referenced this pull request May 31, 2024
mcovarr added a commit that referenced this pull request Jun 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants