drop split indices that creates empty block split. This could happen when there are duplicated indices, or index equal to 0 (start of the block) or num_block_rows (end of the block).
(block_split_indices: List[int], num_rows: int)
| 136 | |
| 137 | |
| 138 | def _drop_empty_block_split(block_split_indices: List[int], num_rows: int) -> List[int]: |
| 139 | """drop split indices that creates empty block split. This could happen when there |
| 140 | are duplicated indices, or index equal to 0 (start of the block) or num_block_rows |
| 141 | (end of the block). |
| 142 | """ |
| 143 | prev_index = -1 |
| 144 | optimized_indices = [] |
| 145 | for index in block_split_indices: |
| 146 | if index == 0 or index == num_rows: |
| 147 | continue |
| 148 | if index == prev_index: |
| 149 | continue |
| 150 | optimized_indices.append(index) |
| 151 | prev_index = index |
| 152 | return optimized_indices |
| 153 | |
| 154 | |
| 155 | def _split_all_blocks( |
searching dependent graphs…