Rename method

This commit is contained in:
Daniel García Aubert 2019-08-23 17:25:37 +02:00
parent b2adb8f058
commit 16035131bc
2 changed files with 3 additions and 3 deletions

View File

@ -137,7 +137,7 @@ function _sample(ctx) {
const limit = Math.ceil(requestedRows * 1.5); const limit = Math.ceil(requestedRows * 1.5);
const columns = ctx.metaOptions.sample.include_columns; const columns = ctx.metaOptions.sample.include_columns;
const sqlMaxMin = _getSQL(ctx, sql => queryUtils.getMaxMinColumnQuery(sql)); const sqlMaxMin = _getSQL(ctx, sql => queryUtils.getMaxMinSpanColumnQuery(sql));
return queryUtils.queryPromise(ctx.dbConnection, sqlMaxMin) return queryUtils.queryPromise(ctx.dbConnection, sqlMaxMin)
.then(maxMinRes => { .then(maxMinRes => {
const { min_id: min, id_span: span } = maxMinRes.rows[0]; const { min_id: min, id_span: span } = maxMinRes.rows[0];

View File

@ -150,13 +150,13 @@ function simpleQueryTable(sql) {
return false; return false;
} }
module.exports.getMaxMinColumnQuery = function (query, column = 'cartodb_id') { module.exports.getMaxMinSpanColumnQuery = function (query, column = 'cartodb_id') {
return ` return `
SELECT SELECT
min(${column}) AS min_id, min(${column}) AS min_id,
max(${column}) AS max_id, max(${column}) AS max_id,
(max(${column}) - min(${column})) AS id_span (max(${column}) - min(${column})) AS id_span
FROM (${substituteDummyTokens(query)}) _cdb_metadata_max_min; FROM (${substituteDummyTokens(query)}) _cdb_metadata_max_min_span;
`; `;
}; };