MCPcopy Create free account
hub / github.com/apache/arrow / Decode

Method Decode

cpp/src/arrow/compute/row/encode_internal.cc:248–332  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

246}
247
248void EncoderInteger::Decode(uint32_t start_row, uint32_t num_rows,
249 uint32_t offset_within_row, const RowTableImpl& rows,
250 KeyColumnArray* col, LightContext* ctx,
251 KeyColumnArray* temp) {
252 KeyColumnArray col_prep;
253 if (UsesTransform(*col)) {
254 col_prep = ArrayReplace(*col, *temp);
255 } else {
256 col_prep = *col;
257 }
258
259 // When we have a single fixed length column we can just do memcpy
260 if (rows.metadata().is_fixed_length &&
261 col_prep.metadata().fixed_length == rows.metadata().fixed_length) {
262 DCHECK_EQ(offset_within_row, 0);
263 uint32_t row_size = rows.metadata().fixed_length;
264 memcpy(col_prep.mutable_data(1), rows.fixed_length_rows(start_row),
265 static_cast<int64_t>(num_rows) * row_size);
266 } else if (rows.metadata().is_fixed_length) {
267 uint8_t* col_base = col_prep.mutable_data(1);
268 switch (col_prep.metadata().fixed_length) {
269 case 1:
270 for (uint32_t i = 0; i < num_rows; ++i) {
271 col_base[i] = *(rows.fixed_length_rows(start_row + i) + offset_within_row);
272 }
273 break;
274 case 2:
275 for (uint32_t i = 0; i < num_rows; ++i) {
276 reinterpret_cast<uint16_t*>(col_base)[i] = *reinterpret_cast<const uint16_t*>(
277 rows.fixed_length_rows(start_row + i) + offset_within_row);
278 }
279 break;
280 case 4:
281 for (uint32_t i = 0; i < num_rows; ++i) {
282 reinterpret_cast<uint32_t*>(col_base)[i] = *reinterpret_cast<const uint32_t*>(
283 rows.fixed_length_rows(start_row + i) + offset_within_row);
284 }
285 break;
286 case 8:
287 for (uint32_t i = 0; i < num_rows; ++i) {
288 reinterpret_cast<uint64_t*>(col_base)[i] = *reinterpret_cast<const uint64_t*>(
289 rows.fixed_length_rows(start_row + i) + offset_within_row);
290 }
291 break;
292 default:
293 DCHECK(false);
294 }
295 } else {
296 const RowTableImpl::offset_type* row_offsets = rows.offsets() + start_row;
297 const uint8_t* row_base = rows.var_length_rows();
298 row_base += offset_within_row;
299 uint8_t* col_base = col_prep.mutable_data(1);
300 switch (col_prep.metadata().fixed_length) {
301 case 1:
302 for (uint32_t i = 0; i < num_rows; ++i) {
303 col_base[i] = row_base[row_offsets[i]];
304 }
305 break;

Callers 1

GetUniquesMethod · 0.45

Calls 12

BytesForBitsFunction · 0.85
ClearBitFunction · 0.85
has_avx2Method · 0.80
is_nullMethod · 0.80
DecodeFunction · 0.70
metadataMethod · 0.45
mutable_dataMethod · 0.45
offsetsMethod · 0.45
emptyMethod · 0.45
sizeMethod · 0.45
lengthMethod · 0.45

Tested by

no test coverage detected