File tree Expand file tree Collapse file tree 2 files changed +12
-6
lines changed Expand file tree Collapse file tree 2 files changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -98,13 +98,18 @@ def remove_family_guids(
98
98
family_guids : hl .SetExpression ,
99
99
) -> hl .Table :
100
100
# Remove families from the existing project table structure (both the entries arrays and the globals are mutated)
101
- family_indexes_to_keep = hl .array (
101
+ family_indexes_to_keep = hl .eval ( hl . array (
102
102
hl .enumerate (ht .globals .family_guids )
103
103
.filter (lambda item : ~ family_guids .contains (item [1 ]))
104
104
.map (lambda item : item [0 ]),
105
- )
105
+ ))
106
106
ht = ht .annotate (
107
- family_entries = family_indexes_to_keep .map (lambda i : ht .family_entries [i ]),
107
+ # NB: this "should" work without the extra if statement (and does in the tests)
108
+ # however, experiments on dataproc showed this statement hanging with an empty
109
+ # indexes array.
110
+ family_entries = family_indexes_to_keep .map (lambda i : ht .family_entries [i ])
111
+ if len (family_indexes_to_keep ) > 0
112
+ else hl .empty_array (ht .family_entries .dtype .element_type )
108
113
)
109
114
return ht .annotate_globals (
110
115
family_guids = ht .family_guids .filter (
Original file line number Diff line number Diff line change @@ -135,9 +135,10 @@ def remove_project(
135
135
)
136
136
ht = ht .annotate (
137
137
project_stats = (
138
- project_indexes_to_keep .map (
139
- lambda i : ht .project_stats [i ],
140
- )
138
+ # See "remove_family_guids" func for why this was necessary
139
+ project_stats = project_indexes_to_keep .map (lambda i : ht .project_stats [i ])
140
+ if len (project_indexes_to_keep ) > 0
141
+ else hl .empty_array (ht .project_stats .dtype .element_type )
141
142
),
142
143
)
143
144
ht = ht .filter (hl .any (ht .project_stats .map (hl .is_defined )))
You can’t perform that action at this time.
0 commit comments