Metadata fixes

This commit is contained in:
Javier Goizueta
2018-05-08 20:07:20 +02:00
parent 9c9cfd015d
commit 741bcd1a80
2 changed files with 97 additions and 39 deletions
+7 -7
View File
@@ -21,10 +21,15 @@ module.exports.extractTableNames = function extractTableNames(query) {
].join('');
};
module.exports.getQueryActualRowCount = function (query) {
return `select COUNT(*) AS rows FROM (${query}) AS __cdb_query`;
};
function getQueryRowEstimation(query) {
return 'select CDB_EstimateRowCount($windshaft$' + query + '$windshaft$) as rows';
}
module.exports.getQueryRowCount = getQueryRowEstimation;
module.exports.getQueryRowEstimation = getQueryRowEstimation;
module.exports.getAggregationMetadata = ctx => `
WITH
@@ -83,11 +88,6 @@ module.exports.getQueryTopCategories = function(query, column, topN, includeNull
`;
};
module.exports.getQueryActualRowCount = function (query) {
return `select COUNT(*) AS rows FROM (${query}) AS __cdb_query`;
};
module.exports.getQuerySample = function(query, sampleProb, randomSeed = 0.5) {
const table = simpleQueryTable(query);
if (table) {
@@ -99,7 +99,7 @@ module.exports.getQuerySample = function(query, sampleProb, randomSeed = 0.5) {
)
SELECT *
FROM (${query}) AS __cdb_query
WHERE random() < $
WHERE random() < ${sampleProb}
`;
};