Skip to content

Commit 4d857f1

Browse files
committed
fix: skip empty segment ids
Signed-off-by: anilb <epipav@gmail.com>
1 parent 637c408 commit 4d857f1

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

services/libs/tinybird/pipes/cdp_organization_aggregates_changed_grandparent_segments_sink.pipe

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ SQL >
1111
select id as segmentId
1212
from segments
1313
where
14-
grandparentId in (
14+
grandparentId <> ''
15+
and grandparentId in (
1516
select grandparentId
1617
from segments
1718
where
@@ -38,7 +39,8 @@ SQL >
3839
FROM cdp_organization_segment_aggregates_ds as cdp_aggs
3940
join segments s on s.id = cdp_aggs.segmentId
4041
where
41-
cdp_aggs.segmentId in (select segmentId from segments_with_changed_aggs_previous_day)
42+
s.grandparentId <> ''
43+
and cdp_aggs.segmentId in (select segmentId from segments_with_changed_aggs_previous_day)
4244
and organizationId in (select organizationId from organizations_with_changed_aggs_previous_day)
4345
GROUP BY grandparentId, organizationId
4446

services/libs/tinybird/pipes/cdp_organization_aggregates_changed_parent_segments_sink.pipe

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ SQL >
1111
select id as segmentId
1212
from segments
1313
where
14-
parentId in (
14+
parentId <> ''
15+
and parentId in (
1516
select parentId
1617
from segments
1718
where
@@ -39,7 +40,8 @@ SQL >
3940
FROM cdp_organization_segment_aggregates_ds as cdp_aggs
4041
join segments s on s.id = cdp_aggs.segmentId
4142
where
42-
cdp_aggs.segmentId in (select segmentId from segments_with_changed_aggs_previous_day)
43+
s.parentId <> ''
44+
and cdp_aggs.segmentId in (select segmentId from segments_with_changed_aggs_previous_day)
4345
and organizationId in (select organizationId from organizations_with_changed_aggs_previous_day)
4446
GROUP BY parentId, organizationId
4547

0 commit comments

Comments
 (0)