Skip to content

Commit 4daaeee

Browse files
committed
emit null rather than an empty list or [null] when no branches/partials/labels are present
1 parent b440fcb commit 4daaeee

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/parsers/pyreport_shim/queries/samples_to_chunks.sql

+6-6
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ select
5757
coverage_sample.total_branches,
5858
method_data.hit_complexity_paths,
5959
method_data.total_complexity,
60-
json_group_array(branches_data.branch) as missing_branches,
61-
json_group_array(formatted_span_data.pyreport_partial) as partials,
62-
json_group_array(other_contexts.name) as labels
60+
json_group_array(branches_data.branch) filter (where branches_data.branch is not null) as missing_branches,
61+
json_group_array(formatted_span_data.pyreport_partial) filter (where formatted_span_data.pyreport_partial is not null) as partials,
62+
json_group_array(other_contexts.name) filter (where other_contexts.name is not null) as labels
6363
from
6464
coverage_sample
6565
left join
@@ -123,9 +123,9 @@ select
123123
line_sessions.total_branches,
124124
line_sessions.hit_complexity_paths,
125125
line_sessions.total_complexity,
126-
line_sessions.missing_branches,
127-
line_sessions.partials,
128-
line_sessions.labels
126+
iif(line_sessions.missing_branches = json_array(), null, line_sessions.missing_branches) as missing_branches,
127+
iif(line_sessions.partials = json_array(), null, line_sessions.partials) as partials,
128+
iif(line_sessions.labels = json_array(), null, line_sessions.labels) as labels
129129
from
130130
line_sessions
131131
left join

0 commit comments

Comments
 (0)