route to view or raw table based on filters

This commit is contained in:
Francis Cao 2025-07-15 16:26:03 -07:00
parent 2dcb9e21bd
commit 954404f8df
7 changed files with 102 additions and 26 deletions

View file

@ -142,18 +142,18 @@ async function clickhouseQuery(
`;
} else {
let groupByQuery = '';
let columnQuery = `session_id s, arrayJoin(${column})`;
let columnQuery = `arrayJoin(${column})`;
if (column === 'referrer_domain') {
excludeDomain = `and t != ''`;
}
if (type === 'entry') {
columnQuery = `session_id s, argMinMerge(entry_url)`;
columnQuery = `argMinMerge(entry_url)`;
}
if (type === 'exit') {
columnQuery = `session_id s, argMaxMerge(exit_url)`;
columnQuery = `argMaxMerge(exit_url)`;
}
if (type === 'entry' || type === 'exit') {
@ -164,7 +164,8 @@ async function clickhouseQuery(
select g.t as x,
uniq(s) as y
from (
select ${columnQuery} as t
select session_id s,
${columnQuery} as t
from website_event_stats_hourly website_event
${cohortQuery}
where website_id = {websiteId:UUID}