Rename method
This commit is contained in:
parent
b2adb8f058
commit
16035131bc
@ -137,7 +137,7 @@ function _sample(ctx) {
|
||||
const limit = Math.ceil(requestedRows * 1.5);
|
||||
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)
|
||||
.then(maxMinRes => {
|
||||
const { min_id: min, id_span: span } = maxMinRes.rows[0];
|
||||
|
@ -150,13 +150,13 @@ function simpleQueryTable(sql) {
|
||||
return false;
|
||||
}
|
||||
|
||||
module.exports.getMaxMinColumnQuery = function (query, column = 'cartodb_id') {
|
||||
module.exports.getMaxMinSpanColumnQuery = function (query, column = 'cartodb_id') {
|
||||
return `
|
||||
SELECT
|
||||
min(${column}) AS min_id,
|
||||
max(${column}) AS max_id,
|
||||
(max(${column}) - min(${column})) AS id_span
|
||||
FROM (${substituteDummyTokens(query)}) _cdb_metadata_max_min;
|
||||
FROM (${substituteDummyTokens(query)}) _cdb_metadata_max_min_span;
|
||||
`;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user