Add metadata parameter for NULL categories

This commit is contained in:
Javier Goizueta 2018-05-22 13:00:18 +02:00
parent 55bf6e86f7
commit 97b4e19777

View File

@ -201,12 +201,17 @@ function _columnStats(ctx, columns) {
);
if (columns[name].type === 'string') {
const topN = ctx.metaOptions.columnStats.topCategories || 1024;
let includeNulls = true;
if (ctx.metaOptions.columnStats.hasOwnProperty('includeNulls')) {
includeNulls = ctx.metaOptions.columnStats.includeNulls;
}
// TODO: ctx.metaOptions.columnStats.maxCategories
// => use PG stats to dismiss columns with more distinct values
queries.push(
queryPromise(
ctx.dbConnection,
_getSQL(ctx, sql => queryUtils.getQueryTopCategories(sql, name, topN)),
_getSQL(ctx, sql => queryUtils.getQueryTopCategories(sql, name, topN, includeNulls)),
res => ({ [name]: { categories: res.rows } })
)
);