Skip to content

Commit

Permalink
(fixes #17) by formatting stats better on bq/snowflake
Browse files Browse the repository at this point in the history
  • Loading branch information
drewbanin committed May 9, 2019
1 parent ec5c9a4 commit 6e21609
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/app/components/table_details/table_details.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ angular
}
if (isNaN(parseFloat(bytes)) || !isFinite(bytes)) return '-';
if (typeof precision === 'undefined') precision = 0;
var units = ['bytes', 'kB', 'MB', 'GB', 'TB', 'PB'],
var units = ['bytes', 'KB', 'MB', 'GB', 'TB', 'PB'],
number = Math.floor(Math.log(bytes) / Math.log(1024));
return (bytes / Math.pow(1024, Math.floor(number))).toFixed(precision) + ' ' + units[number];
}
Expand Down Expand Up @@ -95,11 +95,16 @@ angular
}

function getExtendedStats(stats) {
// TODO : This logic should be pushed into dbt's catalog generation
var format = {
rows: asNumber,
rows: asNumber, // Redshift
row_count: asNumber, // Snowflake
num_rows: asNumber, // BigQuery
max_varchar: asNumber,
pct_used: asPercent,
size: asBytes,
size: asBytes, // Redshift
bytes: asBytes, // Snowflake
num_bytes: asBytes, // BigQuery
}

var sorted_stats = _.sortBy(_.values(stats), 'label');
Expand Down

0 comments on commit 6e21609

Please sign in to comment.