Skip to content

Commit

Permalink
Fix tiny difference when field is path
Browse files Browse the repository at this point in the history
  • Loading branch information
webjunkie committed Jan 26, 2024
1 parent dd5b3e9 commit e8f0b87
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions posthog/hogql_queries/insights/paths_query_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),
},
Expand Down

0 comments on commit e8f0b87

Please sign in to comment.