A better solution to the start-end problem
This commit is contained in:
parent
d937ce4982
commit
a1807fd0c3
@ -99,6 +99,7 @@ module.exports = class NumericHistogram extends BaseHistogram {
|
||||
var extra_tables = ``;
|
||||
var extra_queries = ``;
|
||||
var extra_groupby = ``;
|
||||
var extra_filter = ``;
|
||||
|
||||
if (ctx.start >= ctx.end) {
|
||||
ctx.end = `__cdb_basics.__cdb_max_val`;
|
||||
@ -106,6 +107,8 @@ module.exports = class NumericHistogram extends BaseHistogram {
|
||||
extra_groupby = `, __cdb_basics.__cdb_max_val, __cdb_basics.__cdb_min_val`;
|
||||
extra_tables = `, __cdb_basics`;
|
||||
extra_queries = `WITH ${irqQueryTpl(ctx)}`;
|
||||
} else {
|
||||
extra_filter = `WHERE ${ctx.column} >= ${ctx.start} AND ${ctx.column} <= ${ctx.end}`;
|
||||
}
|
||||
|
||||
if (ctx.bins <= 0) {
|
||||
@ -135,7 +138,7 @@ SELECT
|
||||
END AS bin
|
||||
FROM
|
||||
(
|
||||
SELECT * FROM (${ctx.query}) __ctx_query WHERE ${ctx.column} >= ${ctx.start} AND ${ctx.column} <= ${ctx.end}
|
||||
SELECT * FROM (${ctx.query}) __ctx_query${extra_tables} ${extra_filter}
|
||||
) __cdb_filtered_source_query${extra_tables}
|
||||
GROUP BY 10${extra_groupby}
|
||||
ORDER BY 10;`;
|
||||
|
Loading…
Reference in New Issue
Block a user