Fix bugs & typos

This commit is contained in:
Javier Goizueta
2018-05-08 11:07:47 +02:00
parent 7561635b24
commit ebab879aca

View File

@@ -81,10 +81,10 @@ module.exports.getQueryTopCategories = function(query, column, topN, includeNull
GROUP BY ${column} ORDER BY 2 DESC
LIMIT ${topN}
`;
}
};
module.exports.getQueryActualRowCount = function (query) {
return 'select COUNT(*) AS rows FROM (${query}) AS __cdb_query';
return `select COUNT(*) AS rows FROM (${query}) AS __cdb_query`;
};
@@ -101,11 +101,9 @@ module.exports.getQuerySample = function(query, sampleProb, randomSeed = 0.5) {
FROM (${query}) AS __cdb_query
WHERE random() < $
`;
q = `WITH _rndseed as (SELECT setseed(0.5))
SELECT * FROM (${this._source._query}) as _cdb_query_wrapper WHERE random() < ${sampleProb};`;
};
module.exports.getTableSample = function(table, sampleProb, randomSeed) {
function getTableSample(table, sampleProb, randomSeed) {
sampleProb *= 100;
randomSeed *= Math.pow(2, 31) -1;
return `
@@ -129,8 +127,8 @@ function simpleQueryTable(sql) {
match = sql.match(wrappedQuery);
}
if (match) {
schema = match[2];
table = match[3];
const schema = match[2];
const table = match[3];
return schema ? `${schema}.${table}` : table;
}
return false;