| 122 | } |
| 123 | |
| 124 | Status RowArray::DecodeSelected(ResizableArrayData* output, int column_id, |
| 125 | int num_rows_to_append, const uint32_t* row_ids, |
| 126 | MemoryPool* pool) const { |
| 127 | int num_rows_before = output->num_rows(); |
| 128 | #ifdef ARROW_HAVE_RUNTIME_AVX2 |
| 129 | // Preprocess some rows if necessary to assure that AVX2 version sees 8-row aligned |
| 130 | // output address. |
| 131 | if ((hardware_flags_ & arrow::internal::CpuInfo::AVX2) && (num_rows_before % 8 != 0) && |
| 132 | (num_rows_to_append >= 8)) { |
| 133 | int num_rows_to_preprocess = 8 - num_rows_before % 8; |
| 134 | // The output must have allocated enough rows to store this few number of preprocessed |
| 135 | // rows without costly resizing the internal buffers. |
| 136 | DCHECK_GE(output->num_rows_allocated(), num_rows_before + num_rows_to_preprocess); |
| 137 | RETURN_NOT_OK( |
| 138 | DecodeSelected(output, column_id, num_rows_to_preprocess, row_ids, pool)); |
| 139 | return DecodeSelected(output, column_id, num_rows_to_append - num_rows_to_preprocess, |
| 140 | row_ids + num_rows_to_preprocess, pool); |
| 141 | } |
| 142 | |
| 143 | bool use_avx2 = |
| 144 | (hardware_flags_ & arrow::internal::CpuInfo::AVX2) && (num_rows_before % 8 == 0); |
| 145 | #endif |
| 146 | |
| 147 | RETURN_NOT_OK(output->ResizeFixedLengthBuffers(num_rows_before + num_rows_to_append)); |
| 148 | |
| 149 | // Both input (KeyRowArray) and output (ResizableArrayData) have buffers with |
| 150 | // extra bytes added at the end to avoid buffer overruns when using wide load |
| 151 | // instructions. |
| 152 | // |
| 153 | |
| 154 | ARROW_ASSIGN_OR_RAISE(KeyColumnMetadata column_metadata, output->column_metadata()); |
| 155 | int num_rows_processed = 0; |
| 156 | |
| 157 | if (column_metadata.is_fixed_length) { |
| 158 | uint32_t fixed_length = column_metadata.fixed_length; |
| 159 | |
| 160 | // Process fixed length columns |
| 161 | // |
| 162 | #ifdef ARROW_HAVE_RUNTIME_AVX2 |
| 163 | if (use_avx2) { |
| 164 | num_rows_processed = DecodeFixedLength_avx2( |
| 165 | output, num_rows_before, column_id, fixed_length, num_rows_to_append, row_ids); |
| 166 | } |
| 167 | #endif |
| 168 | DecodeFixedLength(output, num_rows_before + num_rows_processed, column_id, |
| 169 | fixed_length, num_rows_to_append - num_rows_processed, |
| 170 | row_ids + num_rows_processed); |
| 171 | } else { |
| 172 | // Process offsets for varying length columns |
| 173 | // |
| 174 | #ifdef ARROW_HAVE_RUNTIME_AVX2 |
| 175 | if (use_avx2) { |
| 176 | num_rows_processed = DecodeOffsets_avx2(output, num_rows_before, column_id, |
| 177 | num_rows_to_append, row_ids); |
| 178 | } |
| 179 | #endif |
| 180 | DecodeOffsets(output, num_rows_before + num_rows_processed, column_id, |
| 181 | num_rows_to_append - num_rows_processed, row_ids + num_rows_processed); |
no test coverage detected