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

Better formatting of table stats on bq and snowflake #28

Merged
merged 1 commit into from
May 9, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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