Skip to content

Commit

Permalink
Use cpp parser
Browse files Browse the repository at this point in the history
  • Loading branch information
robbie-c committed Oct 16, 2023
1 parent d1bc162 commit 2e3aa89
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
7 changes: 4 additions & 3 deletions posthog/hogql_queries/web_analytics/overview_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ class WebOverviewStatsQueryRunner(WebAnalyticsQueryRunner):
def to_query(self) -> ast.SelectQuery | ast.SelectUnionQuery:
with self.timings.measure("date_expr"):
# TODO use the date range, with a previous period, trends query does this so look at that for insp
start = parse_expr("today() - 14")
mid = parse_expr("today() - 7")
end = parse_expr("today()")
start = parse_expr("today() - 14", backend="cpp")
mid = parse_expr("today() - 7", backend="cpp")
end = parse_expr("today()", backend="cpp")
with self.timings.measure("overview_stats_query"):
overview_stats_query = parse_select(
"""
Expand All @@ -42,6 +42,7 @@ def to_query(self) -> ast.SelectQuery | ast.SelectUnionQuery:
""",
timings=self.timings,
placeholders={"start": start, "mid": mid, "end": end, "event_properties": self.event_properties()},
backend="cpp",
)
return overview_stats_query

Expand Down
3 changes: 3 additions & 0 deletions posthog/hogql_queries/web_analytics/stats_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def to_query(self) -> ast.SelectQuery | ast.SelectUnionQuery:
"session_having": self.session_having(),
"breakdown_by": self.bounce_breakdown(),
},
backend="cpp",
)
with self.timings.measure("counts_query"):
counts_query = parse_select(
Expand All @@ -36,6 +37,7 @@ def to_query(self) -> ast.SelectQuery | ast.SelectUnionQuery:
"counts_where": self.events_where(),
"breakdown_by": self.counts_breakdown(),
},
backend="cpp",
)
with self.timings.measure("top_pages_query"):
top_sources_query = parse_select(
Expand All @@ -60,6 +62,7 @@ def to_query(self) -> ast.SelectQuery | ast.SelectUnionQuery:
"counts_query": counts_query,
"bounce_rate_query": bounce_rate_query,
},
backend="cpp",
)
return top_sources_query

Expand Down

0 comments on commit 2e3aa89

Please sign in to comment.