Slight refactor

This commit is contained in:
Javier Goizueta 2018-10-08 19:25:04 +02:00
parent 418e0e2aa3
commit ee63b247cd

View File

@ -142,11 +142,18 @@ function _sample(ctx, numRows) {
return Promise.resolve();
}
function _columnsMetadataRequired(options) {
// We need determine the columns of a query
// if either column stats or dimension stats are required,
// since we'll ultimately use the same query to fetch both
return options.columnStats || options.dimensions;
}
function _columnStats(ctx, columns, dimensions) {
if (!columns) {
return Promise.resolve();
}
if (ctx.metaOptions.columnStats || ctx.metaOptions.dimensions) {
if (_columnsMetadataRequired(ctx.metaOptions)) {
let queries = [];
let aggr = [];
if (ctx.metaOptions.columnStats) {