From e8f0b87b2cfe6f22b8063a80035b85b076fb3e3a Mon Sep 17 00:00:00 2001 From: Julian Bez Date: Fri, 26 Jan 2024 20:12:12 +0100 Subject: [PATCH] Fix tiny difference when field is path --- posthog/hogql_queries/insights/paths_query_runner.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/posthog/hogql_queries/insights/paths_query_runner.py b/posthog/hogql_queries/insights/paths_query_runner.py index f599c8332a2750..aafc6f97a34336 100644 --- a/posthog/hogql_queries/insights/paths_query_runner.py +++ b/posthog/hogql_queries/insights/paths_query_runner.py @@ -357,8 +357,12 @@ def get_start_end_filtered_limited(self) -> list[ast.Expr]: ast.Alias( alias=f"limited_{field}", expr=parse_expr( - "if(length({field}) > {event_in_session_limit}, arrayConcat(arraySlice({field}, 1, intDiv({event_in_session_limit}, 2)), [{field}[1+intDiv({event_in_session_limit}, 2)]], arraySlice({field}, (-1)*intDiv({event_in_session_limit}, 2), intDiv({event_in_session_limit}, 2))), {field})", - { + expr=( + "if(length({field}) > {event_in_session_limit}, arrayConcat(arraySlice({field}, 1, intDiv({event_in_session_limit}, 2)), ['...'], arraySlice({field}, (-1)*intDiv({event_in_session_limit}, 2), intDiv({event_in_session_limit}, 2))), {field})" + if field == "path" + else "if(length({field}) > {event_in_session_limit}, arrayConcat(arraySlice({field}, 1, intDiv({event_in_session_limit}, 2)), [{field}[1+intDiv({event_in_session_limit}, 2)]], arraySlice({field}, (-1)*intDiv({event_in_session_limit}, 2), intDiv({event_in_session_limit}, 2))), {field})" + ), + placeholders={ "field": ast.Field(chain=[f"filtered_{field}"]), "event_in_session_limit": ast.Constant(value=self.event_in_session_limit), },