|
475 | 475 | ( |
476 | 476 | (SELECT persons.id AS id |
477 | 477 | FROM |
478 | | - (SELECT argMax(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(person.properties, 'name'), ''), 'null'), '^"|"$', ''), person.version) AS properties___name, |
| 478 | + (SELECT tupleElement(argMax(tuple(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(person.properties, 'name'), ''), 'null'), '^"|"$', '')), person.version), 1) AS properties___name, |
479 | 479 | person.id AS id |
480 | 480 | FROM person |
481 | 481 | WHERE and(equals(person.team_id, 99999), in(id, |
482 | 482 | (SELECT where_optimization.id AS id |
483 | 483 | FROM person AS where_optimization |
484 | 484 | WHERE and(equals(where_optimization.team_id, 99999), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(where_optimization.properties, 'name'), ''), 'null'), '^"|"$', ''), 'test'), 0))))) |
485 | 485 | GROUP BY person.id |
486 | | - HAVING and(ifNull(equals(argMax(person.is_deleted, person.version), 0), 0), ifNull(less(argMax(toTimeZone(person.created_at, 'UTC'), person.version), plus(now64(6, 'UTC'), toIntervalDay(1))), 0))) AS persons |
| 486 | + HAVING and(ifNull(equals(tupleElement(argMax(tuple(person.is_deleted), person.version), 1), 0), 0), ifNull(less(tupleElement(argMax(tuple(toTimeZone(person.created_at, 'UTC')), person.version), 1), plus(now64(6, 'UTC'), toIntervalDay(1))), 0))) AS persons |
487 | 487 | WHERE ifNull(equals(persons.properties___name, 'test'), 0) |
488 | 488 | ORDER BY persons.id ASC |
489 | 489 | LIMIT 1000000000 SETTINGS optimize_aggregation_in_order=1, |
|
502 | 502 | e.distinct_id AS distinct_id |
503 | 503 | FROM events AS e |
504 | 504 | LEFT OUTER JOIN |
505 | | - (SELECT argMax(person_distinct_id_overrides.person_id, person_distinct_id_overrides.version) AS person_id, |
| 505 | + (SELECT tupleElement(argMax(tuple(person_distinct_id_overrides.person_id), person_distinct_id_overrides.version), 1) AS person_id, |
506 | 506 | person_distinct_id_overrides.distinct_id AS distinct_id |
507 | 507 | FROM person_distinct_id_overrides |
508 | 508 | WHERE equals(person_distinct_id_overrides.team_id, 99999) |
509 | 509 | GROUP BY person_distinct_id_overrides.distinct_id |
510 | | - HAVING ifNull(equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0), 0) SETTINGS optimize_aggregation_in_order=1) AS e__override ON equals(e.distinct_id, e__override.distinct_id) |
511 | | - WHERE and(equals(e.team_id, 99999), greaterOrEquals(timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')), lessOrEquals(timestamp, toDateTime64('today', 6, 'UTC')), equals(e.event, '$pageview'))) |
| 510 | + HAVING ifNull(equals(tupleElement(argMax(tuple(person_distinct_id_overrides.is_deleted), person_distinct_id_overrides.version), 1), 0), 0) SETTINGS optimize_aggregation_in_order=1) AS e__override ON equals(e.distinct_id, e__override.distinct_id) |
| 511 | + WHERE and(equals(e.team_id, 99999), greaterOrEquals(timestamp, toDateTime64('2025-11-15 00:00:00.000000', 6, 'UTC')), lessOrEquals(timestamp, toDateTime64('today', 6, 'UTC')), equals(e.event, '$pageview'))) |
512 | 512 | GROUP BY actor_id) AS source |
513 | 513 | ORDER BY source.id ASC |
514 | 514 | LIMIT 1000000000 SETTINGS optimize_aggregation_in_order=1, |
|
568 | 568 | ( |
569 | 569 | (SELECT persons.id AS id |
570 | 570 | FROM |
571 | | - (SELECT argMax(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(person.properties, 'name'), ''), 'null'), '^"|"$', ''), person.version) AS properties___name, |
| 571 | + (SELECT tupleElement(argMax(tuple(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(person.properties, 'name'), ''), 'null'), '^"|"$', '')), person.version), 1) AS properties___name, |
572 | 572 | person.id AS id |
573 | 573 | FROM person |
574 | 574 | WHERE and(equals(person.team_id, 99999), in(id, |
575 | 575 | (SELECT where_optimization.id AS id |
576 | 576 | FROM person AS where_optimization |
577 | 577 | WHERE and(equals(where_optimization.team_id, 99999), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(where_optimization.properties, 'name'), ''), 'null'), '^"|"$', ''), 'test'), 0))))) |
578 | 578 | GROUP BY person.id |
579 | | - HAVING and(ifNull(equals(argMax(person.is_deleted, person.version), 0), 0), ifNull(less(argMax(toTimeZone(person.created_at, 'UTC'), person.version), plus(now64(6, 'UTC'), toIntervalDay(1))), 0))) AS persons |
| 579 | + HAVING and(ifNull(equals(tupleElement(argMax(tuple(person.is_deleted), person.version), 1), 0), 0), ifNull(less(tupleElement(argMax(tuple(toTimeZone(person.created_at, 'UTC')), person.version), 1), plus(now64(6, 'UTC'), toIntervalDay(1))), 0))) AS persons |
580 | 580 | WHERE ifNull(equals(persons.properties___name, 'test'), 0) |
581 | 581 | ORDER BY persons.id ASC |
582 | 582 | LIMIT 1000000000 SETTINGS optimize_aggregation_in_order=1, |
|
595 | 595 | e.distinct_id AS distinct_id |
596 | 596 | FROM events AS e |
597 | 597 | LEFT OUTER JOIN |
598 | | - (SELECT argMax(person_distinct_id_overrides.person_id, person_distinct_id_overrides.version) AS person_id, |
| 598 | + (SELECT tupleElement(argMax(tuple(person_distinct_id_overrides.person_id), person_distinct_id_overrides.version), 1) AS person_id, |
599 | 599 | person_distinct_id_overrides.distinct_id AS distinct_id |
600 | 600 | FROM person_distinct_id_overrides |
601 | 601 | WHERE equals(person_distinct_id_overrides.team_id, 99999) |
602 | 602 | GROUP BY person_distinct_id_overrides.distinct_id |
603 | | - HAVING ifNull(equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0), 0) SETTINGS optimize_aggregation_in_order=1) AS e__override ON equals(e.distinct_id, e__override.distinct_id) |
604 | | - WHERE and(equals(e.team_id, 99999), greaterOrEquals(timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')), lessOrEquals(timestamp, toDateTime64('today', 6, 'UTC')), equals(e.event, '$pageview'))) |
| 603 | + HAVING ifNull(equals(tupleElement(argMax(tuple(person_distinct_id_overrides.is_deleted), person_distinct_id_overrides.version), 1), 0), 0) SETTINGS optimize_aggregation_in_order=1) AS e__override ON equals(e.distinct_id, e__override.distinct_id) |
| 604 | + WHERE and(equals(e.team_id, 99999), greaterOrEquals(timestamp, toDateTime64('2025-11-15 00:00:00.000000', 6, 'UTC')), lessOrEquals(timestamp, toDateTime64('today', 6, 'UTC')), equals(e.event, '$pageview'))) |
605 | 605 | GROUP BY actor_id) AS source |
606 | 606 | ORDER BY source.id ASC |
607 | 607 | LIMIT 1000000000 SETTINGS optimize_aggregation_in_order=1, |
|
1118 | 1118 | WHERE equals(person_distinct_id_overrides.team_id, 99999) |
1119 | 1119 | GROUP BY person_distinct_id_overrides.distinct_id |
1120 | 1120 | HAVING ifNull(equals(tupleElement(argMax(tuple(person_distinct_id_overrides.is_deleted), person_distinct_id_overrides.version), 1), 0), 0) SETTINGS optimize_aggregation_in_order=1) AS e__override ON equals(e.distinct_id, e__override.distinct_id) |
1121 | | - WHERE and(equals(e.team_id, 99999), greaterOrEquals(timestamp, toDateTime64('2025-11-14 00:00:00.000000', 6, 'UTC')), lessOrEquals(timestamp, toDateTime64('today', 6, 'UTC')), equals(e.event, '$pageview'))) |
| 1121 | + WHERE and(equals(e.team_id, 99999), greaterOrEquals(timestamp, toDateTime64('2025-11-15 00:00:00.000000', 6, 'UTC')), lessOrEquals(timestamp, toDateTime64('today', 6, 'UTC')), equals(e.event, '$pageview'))) |
1122 | 1122 | GROUP BY actor_id) AS source |
1123 | 1123 | ORDER BY source.id ASC |
1124 | 1124 | LIMIT 1000000000 SETTINGS optimize_aggregation_in_order=1, |
|
0 commit comments