Skip to content

Commit

Permalink
chore(hogql): Use the C++ parser in local dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Twixes committed Oct 19, 2023
1 parent d60f409 commit 111eeff
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion posthog/hogql/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

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

from posthog.hogql import ast
from posthog.hogql.base import AST
Expand Down Expand Up @@ -72,8 +73,11 @@ def parse_select(
placeholders: Optional[Dict[str, ast.Expr]] = None,
timings: Optional[HogQLTimings] = None,
*,
backend: Literal["python", "cpp"] = "python",
backend: Optional[Literal["python", "cpp"]],
) -> ast.SelectQuery | ast.SelectUnionQuery:
if not backend:
# TODO: Switch over to C++ in production once we are confident there are no issues
backend = "cpp" if settings.DEBUG else "python"
if timings is None:
timings = HogQLTimings()
with timings.measure(f"parse_select_{backend}"):
Expand Down

0 comments on commit 111eeff

Please sign in to comment.