Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
aspicer committed Jun 20, 2024
1 parent 14c0caf commit 35e2cb2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions posthog/hogql_queries/actors_query_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ def to_query(self) -> ast.SelectQuery:
order_by = []

with self.timings.measure("select"):
ctes = {}
if not self.query.source:
join_expr = ast.JoinExpr(table=ast.Field(chain=[self.strategy.origin]))
else:
Expand Down Expand Up @@ -264,9 +265,8 @@ def to_query(self) -> ast.SelectQuery:
),
)

ctes = {
source_alias: ast.CTE(name=source_alias, expr=source_query, cte_type="subquery"),
}
ctes[source_alias] = ast.CTE(name=source_alias, expr=source_query, cte_type="subquery")

# For now, only use this CTE optimization in Trends, until we test it with other queries
if isinstance(self.strategy, PersonStrategy) and any(
isinstance(x, C) for x in [getattr(self.query.source, "source", None)] for C in (TrendsQuery,)
Expand Down

0 comments on commit 35e2cb2

Please sign in to comment.