Skip to content

Commit

Permalink
feat(hogql): enable cpp parser by default (#18595)
Browse files Browse the repository at this point in the history
  • Loading branch information
mariusandra authored Nov 14, 2023
1 parent 51a2edc commit 745a335
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions posthog/hogql/parser.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import random
from typing import Dict, List, Literal, Optional, cast, Callable

from antlr4 import CommonTokenStream, InputStream, ParseTreeVisitor, ParserRuleContext
from antlr4.error.ErrorListener import ErrorListener
from django.conf import settings
from prometheus_client import Histogram

from posthog.hogql import ast
Expand Down Expand Up @@ -57,8 +55,7 @@ def parse_expr(
backend: Optional[Literal["python", "cpp"]] = None,
) -> ast.Expr:
if not backend:
backend = "cpp" if settings.TEST else random.choice(("cpp", "python"))
assert backend is not None
backend = "cpp"
if timings is None:
timings = HogQLTimings()
with timings.measure(f"parse_expr_{backend}"):
Expand All @@ -78,8 +75,7 @@ def parse_order_expr(
backend: Optional[Literal["python", "cpp"]] = None,
) -> ast.Expr:
if not backend:
backend = "cpp" if settings.TEST else random.choice(("cpp", "python"))
assert backend is not None
backend = "cpp"
if timings is None:
timings = HogQLTimings()
with timings.measure(f"parse_order_expr_{backend}"):
Expand All @@ -99,8 +95,7 @@ def parse_select(
backend: Optional[Literal["python", "cpp"]] = None,
) -> ast.SelectQuery | ast.SelectUnionQuery:
if not backend:
backend = "cpp" if settings.TEST else random.choice(("cpp", "python"))
assert backend is not None
backend = "cpp"
if timings is None:
timings = HogQLTimings()
with timings.measure(f"parse_select_{backend}"):
Expand Down

0 comments on commit 745a335

Please sign in to comment.