Skip to content

Commit

Permalink
fix(hogql): do not traverse the entire table when looking at one field (
Browse files Browse the repository at this point in the history
  • Loading branch information
mariusandra authored Feb 5, 2024
1 parent e634a5c commit 02bf353
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions posthog/hogql/database/schema/event_sessions.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ def __init__(self, expr: ast.Expr):
def visit_lazy_join_type(self, node: ast.LazyJoinType):
self.contains_lazy_join = True

def visit_field_type(self, node: ast.FieldType):
self.visit(node.table_type)


class WhereClauseExtractor:
compare_operators: List[ast.Expr]
Expand Down
2 changes: 1 addition & 1 deletion posthog/hogql/visitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def visit_field_alias_type(self, node: ast.FieldAliasType):
self.visit(node.type)

def visit_field_type(self, node: ast.FieldType):
self.visit(node.table_type)
pass

def visit_select_query_type(self, node: ast.SelectQueryType):
for expr in node.tables.values():
Expand Down

0 comments on commit 02bf353

Please sign in to comment.