Skip to content

Commit

Permalink
add logging for bytes processed (#1132)
Browse files Browse the repository at this point in the history
  • Loading branch information
freemabd authored Jan 16, 2025
1 parent 8b7c5ce commit d864f89
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ public SqlQueryResult run(SqlQueryRequest queryRequest) {
'@' + paramName,
toSql(toQueryParameterValue(queryRequest.getSqlParams().getParamValue(paramName))));
}
LOGGER.info("SQL no parameters: {}", sqlNoParams);

// Build a BQ parameter value object for each SQL query parameter.
Map<String, QueryParameterValue> bqQueryParams =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,17 @@ public TableResult runQuery(
TableResult tableResult =
job.getQueryResults(
queryJobConfig.getRight().toArray(new BigQuery.QueryResultsOption[0]));
LOGGER.info("SQL query returns {} rows across all pages", tableResult.getTotalRows());
Job completedJob = job.waitFor();
JobStatistics.QueryStatistics stats = completedJob.getStatistics();
Long totalBytesProcessed = stats.getTotalBytesProcessed();
String jobId = completedJob.getJobId().getJob();
LOGGER.info("job: {}, query: {}", jobId, sql);
LOGGER.info(
"job: {}, total rows: {}, cache hit: {}, total megabytes processed: {}MB",
jobId,
tableResult.getTotalRows(),
stats.getCacheHit(),
totalBytesProcessed / 1_048_576);
return tableResult;
},
"Error running query: " + queryJobConfig.getLeft().getQuery());
Expand Down

0 comments on commit d864f89

Please sign in to comment.