Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(insights): first time for user math type for Actors Query #23993

Merged
merged 12 commits into from
Jul 29, 2024
17 changes: 0 additions & 17 deletions mypy-baseline.txt
Original file line number Diff line number Diff line change
Expand Up @@ -364,23 +364,6 @@ posthog/hogql_queries/legacy_compatibility/test/test_filter_to_query.py:0: error
posthog/hogql_queries/legacy_compatibility/test/test_filter_to_query.py:0: error: Need type annotation for "filter" (hint: "filter: dict[<type>, <type>] = ...") [var-annotated]
posthog/hogql_queries/legacy_compatibility/test/test_filter_to_query.py:0: error: Need type annotation for "filter" (hint: "filter: dict[<type>, <type>] = ...") [var-annotated]
posthog/hogql_queries/legacy_compatibility/test/test_filter_to_query.py:0: error: Need type annotation for "filter" (hint: "filter: dict[<type>, <type>] = ...") [var-annotated]
posthog/hogql_queries/insights/trends/test/test_aggregation_operations.py:0: error: Item "SelectUnionQuery" of "SelectQuery | SelectUnionQuery" has no attribute "select" [union-attr]
posthog/hogql_queries/insights/trends/test/test_aggregation_operations.py:0: error: Item "SelectUnionQuery" of "SelectQuery | SelectUnionQuery" has no attribute "select" [union-attr]
posthog/hogql_queries/insights/trends/test/test_aggregation_operations.py:0: error: Item "SelectUnionQuery" of "SelectQuery | SelectUnionQuery" has no attribute "group_by" [union-attr]
posthog/hogql_queries/insights/trends/test/test_aggregation_operations.py:0: error: Argument 1 to "len" has incompatible type "list[Expr] | Any | None"; expected "Sized" [arg-type]
posthog/hogql_queries/insights/trends/test/test_aggregation_operations.py:0: error: Item "SelectUnionQuery" of "SelectQuery | SelectUnionQuery" has no attribute "group_by" [union-attr]
posthog/hogql_queries/insights/trends/test/test_aggregation_operations.py:0: error: Value of type "list[Expr] | Any | None" is not indexable [index]
posthog/hogql_queries/insights/trends/test/test_aggregation_operations.py:0: error: Item "SelectUnionQuery" of "SelectQuery | SelectUnionQuery" has no attribute "group_by" [union-attr]
posthog/hogql_queries/insights/trends/test/test_aggregation_operations.py:0: error: Argument 1 to "len" has incompatible type "list[Expr] | Any | None"; expected "Sized" [arg-type]
posthog/hogql_queries/insights/trends/test/test_aggregation_operations.py:0: error: Item "SelectUnionQuery" of "SelectQuery | SelectUnionQuery" has no attribute "group_by" [union-attr]
posthog/hogql_queries/insights/trends/test/test_aggregation_operations.py:0: error: Value of type "list[Expr] | Any | None" is not indexable [index]
posthog/hogql_queries/insights/trends/test/test_aggregation_operations.py:0: error: Item "SelectUnionQuery" of "SelectQuery | SelectUnionQuery" has no attribute "group_by" [union-attr]
posthog/hogql_queries/insights/trends/test/test_aggregation_operations.py:0: error: Value of type "list[Expr] | Any | None" is not indexable [index]
posthog/hogql_queries/insights/trends/test/test_aggregation_operations.py:0: error: Item "SelectUnionQuery" of "SelectQuery | SelectUnionQuery" has no attribute "select_from" [union-attr]
posthog/hogql_queries/insights/trends/test/test_aggregation_operations.py:0: error: Item "None" of "JoinExpr | Any | None" has no attribute "table" [union-attr]
posthog/hogql_queries/insights/trends/test/test_aggregation_operations.py:0: error: Item "SelectQuery" of "SelectQuery | SelectUnionQuery | Field | Any | None" has no attribute "chain" [union-attr]
posthog/hogql_queries/insights/trends/test/test_aggregation_operations.py:0: error: Item "SelectUnionQuery" of "SelectQuery | SelectUnionQuery | Field | Any | None" has no attribute "chain" [union-attr]
posthog/hogql_queries/insights/trends/test/test_aggregation_operations.py:0: error: Item "None" of "SelectQuery | SelectUnionQuery | Field | Any | None" has no attribute "chain" [union-attr]
posthog/hogql_queries/insights/test/test_paginators.py:0: error: Value of type "object" is not indexable [index]
posthog/hogql_queries/insights/test/test_paginators.py:0: error: Value of type "object" is not indexable [index]
posthog/hogql_queries/insights/test/test_paginators.py:0: error: Value of type "object" is not indexable [index]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@
toTimeZone(e.timestamp, 'US/Pacific') AS timestamp,
e.uuid AS uuid
FROM events AS e
WHERE and(equals(e.team_id, 2), equals(e.event, '$pageview'), greaterOrEquals(toTimeZone(e.timestamp, 'US/Pacific'), toDateTime64('2020-01-09 00:00:00.000000', 6, 'US/Pacific')), less(toTimeZone(e.timestamp, 'US/Pacific'), toDateTime64('2020-01-10 00:00:00.000000', 6, 'US/Pacific')), notEquals(e.`$group_0`, '')))
WHERE and(equals(e.team_id, 2), ifNull(greaterOrEquals(timestamp, toDateTime64('2020-01-09 00:00:00.000000', 6, 'US/Pacific')), 0), ifNull(less(timestamp, toDateTime64('2020-01-10 00:00:00.000000', 6, 'US/Pacific')), 0), notEquals(e.`$group_0`, ''), equals(e.event, '$pageview')))
GROUP BY actor_id) AS source
INNER JOIN
(SELECT argMax(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(groups.group_properties, 'name'), ''), 'null'), '^"|"$', ''), toTimeZone(groups._timestamp, 'US/Pacific')) AS properties___name,
Expand Down Expand Up @@ -347,7 +347,7 @@
WHERE equals(person.team_id, 2)
GROUP BY person.id
HAVING and(ifNull(equals(argMax(person.is_deleted, person.version), 0), 0), ifNull(less(argMax(toTimeZone(person.created_at, 'US/Pacific'), person.version), plus(now64(6, 'US/Pacific'), toIntervalDay(1))), 0)) SETTINGS optimize_aggregation_in_order=1) AS e__pdi__person ON equals(e__pdi.e__pdi___person_id, e__pdi__person.id)
WHERE and(equals(e.team_id, 2), equals(e.event, '$pageview'), ifNull(notEquals(e__pdi__person.properties___email, '[email protected]'), 1), greaterOrEquals(toTimeZone(e.timestamp, 'US/Pacific'), toDateTime64('2020-01-09 00:00:00.000000', 6, 'US/Pacific')), less(toTimeZone(e.timestamp, 'US/Pacific'), toDateTime64('2020-01-10 00:00:00.000000', 6, 'US/Pacific'))))
WHERE and(equals(e.team_id, 2), ifNull(notEquals(e__pdi__person.properties___email, '[email protected]'), 1), ifNull(greaterOrEquals(timestamp, toDateTime64('2020-01-09 00:00:00.000000', 6, 'US/Pacific')), 0), ifNull(less(timestamp, toDateTime64('2020-01-10 00:00:00.000000', 6, 'US/Pacific')), 0), equals(e.event, '$pageview')))
GROUP BY actor_id) AS source
INNER JOIN
(SELECT argMax(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(person.properties, 'name'), ''), 'null'), '^"|"$', ''), person.version) AS properties___name,
Expand All @@ -372,7 +372,7 @@
WHERE equals(person.team_id, 2)
GROUP BY person.id
HAVING and(ifNull(equals(argMax(person.is_deleted, person.version), 0), 0), ifNull(less(argMax(toTimeZone(person.created_at, 'US/Pacific'), person.version), plus(now64(6, 'US/Pacific'), toIntervalDay(1))), 0)) SETTINGS optimize_aggregation_in_order=1) AS e__pdi__person ON equals(e__pdi.e__pdi___person_id, e__pdi__person.id)
WHERE and(equals(e.team_id, 2), equals(e.event, '$pageview'), ifNull(notEquals(e__pdi__person.properties___email, '[email protected]'), 1), greaterOrEquals(toTimeZone(e.timestamp, 'US/Pacific'), toDateTime64('2020-01-09 00:00:00.000000', 6, 'US/Pacific')), less(toTimeZone(e.timestamp, 'US/Pacific'), toDateTime64('2020-01-10 00:00:00.000000', 6, 'US/Pacific'))))
WHERE and(equals(e.team_id, 2), ifNull(notEquals(e__pdi__person.properties___email, '[email protected]'), 1), ifNull(greaterOrEquals(timestamp, toDateTime64('2020-01-09 00:00:00.000000', 6, 'US/Pacific')), 0), ifNull(less(timestamp, toDateTime64('2020-01-10 00:00:00.000000', 6, 'US/Pacific')), 0), equals(e.event, '$pageview')))
GROUP BY actor_id) AS source)))
GROUP BY person.id
HAVING and(ifNull(equals(argMax(person.is_deleted, person.version), 0), 0), ifNull(less(argMax(toTimeZone(person.created_at, 'US/Pacific'), person.version), plus(now64(6, 'US/Pacific'), toIntervalDay(1))), 0)) SETTINGS optimize_aggregation_in_order=1) AS persons ON equals(persons.id, source.actor_id)
Expand Down Expand Up @@ -418,7 +418,7 @@
WHERE equals(person.team_id, 2)
GROUP BY person.id
HAVING and(ifNull(equals(argMax(person.is_deleted, person.version), 0), 0), ifNull(less(argMax(toTimeZone(person.created_at, 'US/Pacific'), person.version), plus(now64(6, 'US/Pacific'), toIntervalDay(1))), 0)))), 0)) SETTINGS optimize_aggregation_in_order=1) AS e__pdi__person ON equals(e__pdi.e__pdi___person_id, e__pdi__person.id)
WHERE and(equals(e.team_id, 2), equals(e.event, '$pageview'), ifNull(notEquals(e__pdi__person.properties___email, '[email protected]'), 1), greaterOrEquals(toTimeZone(e.timestamp, 'US/Pacific'), toDateTime64('2020-01-09 00:00:00.000000', 6, 'US/Pacific')), less(toTimeZone(e.timestamp, 'US/Pacific'), toDateTime64('2020-01-10 00:00:00.000000', 6, 'US/Pacific'))))
WHERE and(equals(e.team_id, 2), ifNull(notEquals(e__pdi__person.properties___email, '[email protected]'), 1), ifNull(greaterOrEquals(timestamp, toDateTime64('2020-01-09 00:00:00.000000', 6, 'US/Pacific')), 0), ifNull(less(timestamp, toDateTime64('2020-01-10 00:00:00.000000', 6, 'US/Pacific')), 0), equals(e.event, '$pageview')))
GROUP BY actor_id) AS source
INNER JOIN
(SELECT person.id AS id,
Expand Down Expand Up @@ -449,7 +449,7 @@
WHERE equals(person.team_id, 2)
GROUP BY person.id
HAVING and(ifNull(equals(argMax(person.is_deleted, person.version), 0), 0), ifNull(less(argMax(toTimeZone(person.created_at, 'US/Pacific'), person.version), plus(now64(6, 'US/Pacific'), toIntervalDay(1))), 0)))), 0)) SETTINGS optimize_aggregation_in_order=1) AS e__pdi__person ON equals(e__pdi.e__pdi___person_id, e__pdi__person.id)
WHERE and(equals(e.team_id, 2), equals(e.event, '$pageview'), ifNull(notEquals(e__pdi__person.properties___email, '[email protected]'), 1), greaterOrEquals(toTimeZone(e.timestamp, 'US/Pacific'), toDateTime64('2020-01-09 00:00:00.000000', 6, 'US/Pacific')), less(toTimeZone(e.timestamp, 'US/Pacific'), toDateTime64('2020-01-10 00:00:00.000000', 6, 'US/Pacific'))))
WHERE and(equals(e.team_id, 2), ifNull(notEquals(e__pdi__person.properties___email, '[email protected]'), 1), ifNull(greaterOrEquals(timestamp, toDateTime64('2020-01-09 00:00:00.000000', 6, 'US/Pacific')), 0), ifNull(less(timestamp, toDateTime64('2020-01-10 00:00:00.000000', 6, 'US/Pacific')), 0), equals(e.event, '$pageview')))
GROUP BY actor_id) AS source)))
GROUP BY person.id
HAVING and(ifNull(equals(argMax(person.is_deleted, person.version), 0), 0), ifNull(less(argMax(toTimeZone(person.created_at, 'US/Pacific'), person.version), plus(now64(6, 'US/Pacific'), toIntervalDay(1))), 0))))) SETTINGS optimize_aggregation_in_order=1) AS persons ON equals(persons.id, source.actor_id)
Expand Down
Loading
Loading