Fix aggregation-query dimension functions regarding to spaces in columns

This commit is contained in:
Jesús Arroyo Torrens 2018-08-16 15:34:06 +02:00
parent 31263b7b22
commit e0f49ca8f5

View File

@ -117,17 +117,19 @@ const dimensionNames = (ctx, table) => {
let dimensions = aggregateDimensions(ctx); let dimensions = aggregateDimensions(ctx);
if (table) { if (table) {
return sep(Object.keys(dimensions).map( return sep(Object.keys(dimensions).map(
dimension_name => `${table}.${dimension_name}` dimension_name => `${table}."${dimension_name}"`
)); ));
} }
return sep(Object.keys(dimensions)); return sep(Object.keys(dimensions).map(dimension_name => {
return `"${dimension_name}"`;
}));
}; };
const dimensionDefs = ctx => { const dimensionDefs = ctx => {
let dimensions = aggregateDimensions(ctx); let dimensions = aggregateDimensions(ctx);
return sep(Object.keys(dimensions).map(dimension_name => { return sep(Object.keys(dimensions).map(dimension_name => {
const expression = dimensions[dimension_name]; const expression = dimensions[dimension_name];
return `${expression} AS ${dimension_name}`; return `"${expression}" AS "${dimension_name}"`;
})); }));
}; };