Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(trends): more hogql features #21176

Merged
merged 13 commits into from
Mar 27, 2024
2 changes: 1 addition & 1 deletion posthog/hogql_queries/hogql_query_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def to_actors_query(self) -> ast.SelectQuery:
def calculate(self) -> HogQLQueryResponse:
query = self.to_query()
paginator = None
if not query.limit:
if isinstance(query, ast.SelectQuery) and not query.limit:
paginator = HogQLHasMorePaginator.from_limit_context(limit_context=self.limit_context)
func = cast(
Callable[..., HogQLQueryResponse],
Expand Down
1 change: 1 addition & 0 deletions posthog/hogql_queries/insights/trends/display.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,5 @@ def _get_cumulative_query(self, inner_query: ast.SelectQuery, breakdown_enabled:
),
],
select_from=ast.JoinExpr(table=inner_query),
order_by=[ast.OrderExpr(expr=ast.Field(chain=["day_start"]), order="ASC")],
)
Original file line number Diff line number Diff line change
Expand Up @@ -3589,7 +3589,8 @@
breakdown_value)
GROUP BY day_start,
breakdown_value
ORDER BY day_start ASC, breakdown_value ASC))
ORDER BY day_start ASC, breakdown_value ASC)
ORDER BY day_start ASC)
GROUP BY breakdown_value
ORDER BY sum(count) DESC, breakdown_value ASC
LIMIT 10000 SETTINGS readonly=2,
Expand Down Expand Up @@ -3653,7 +3654,8 @@
breakdown_value)
GROUP BY day_start,
breakdown_value
ORDER BY day_start ASC, breakdown_value ASC))
ORDER BY day_start ASC, breakdown_value ASC)
ORDER BY day_start ASC)
GROUP BY breakdown_value
ORDER BY sum(count) DESC, breakdown_value ASC
LIMIT 10000 SETTINGS readonly=2,
Expand Down Expand Up @@ -4036,7 +4038,8 @@
WHERE and(equals(e.team_id, 2), greaterOrEquals(toTimeZone(e.timestamp, 'UTC'), toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2019-12-30 00:00:00', 6, 'UTC')))), lessOrEquals(toTimeZone(e.timestamp, 'UTC'), assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-06 23:59:59', 6, 'UTC'))), equals(e.event, 'viewed video'), ifNull(notEquals(nullIf(nullIf(e.`$group_0`, ''), 'null'), ''), 1), notEquals(e.`$group_0`, ''))
GROUP BY e.`$group_0`)
GROUP BY day_start
ORDER BY day_start ASC))
ORDER BY day_start ASC)
ORDER BY day_start ASC)
ORDER BY sum(count) DESC
LIMIT 10000 SETTINGS readonly=2,
max_execution_time=60,
Expand Down Expand Up @@ -4066,7 +4069,8 @@
WHERE and(equals(e.team_id, 2), greaterOrEquals(toTimeZone(e.timestamp, 'UTC'), toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2019-12-28 00:00:00', 6, 'UTC')))), lessOrEquals(toTimeZone(e.timestamp, 'UTC'), assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-04 23:59:59', 6, 'UTC'))), equals(e.event, 'sign up'))
GROUP BY day_start)
GROUP BY day_start
ORDER BY day_start ASC))
ORDER BY day_start ASC)
ORDER BY day_start ASC)
ORDER BY sum(count) DESC
LIMIT 10000 SETTINGS readonly=2,
max_execution_time=60,
Expand Down Expand Up @@ -4103,7 +4107,8 @@
WHERE and(equals(e.team_id, 2), greaterOrEquals(toTimeZone(e.timestamp, 'UTC'), toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2019-12-28 00:00:00', 6, 'UTC')))), lessOrEquals(toTimeZone(e.timestamp, 'UTC'), assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-04 23:59:59', 6, 'UTC'))), equals(e.event, 'sign up'))
GROUP BY e__pdi.person_id)
GROUP BY day_start
ORDER BY day_start ASC))
ORDER BY day_start ASC)
ORDER BY day_start ASC)
ORDER BY sum(count) DESC
LIMIT 10000 SETTINGS readonly=2,
max_execution_time=60,
Expand Down
Loading