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

Method DecodeFixedLengthBuffers

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

Source from the content-addressed store, hash-verified

58}
59
60void RowTableEncoder::DecodeFixedLengthBuffers(int64_t start_row_input,
61 int64_t start_row_output, int64_t num_rows,
62 const RowTableImpl& rows,
63 std::vector<KeyColumnArray>* cols,
64 int64_t hardware_flags,
65 util::TempVectorStack* temp_stack) {
66 // Prepare column array vectors
67 PrepareKeyColumnArrays(start_row_output, num_rows, *cols);
68
69 LightContext ctx;
70 ctx.hardware_flags = hardware_flags;
71 ctx.stack = temp_stack;
72
73 // Create two temp vectors with 16-bit elements
74 auto temp_buffer_holder_A =
75 util::TempVectorHolder<uint16_t>(ctx.stack, static_cast<uint32_t>(num_rows));
76 auto temp_buffer_A = KeyColumnArray(
77 KeyColumnMetadata(true, sizeof(uint16_t)), num_rows, nullptr,
78 reinterpret_cast<uint8_t*>(temp_buffer_holder_A.mutable_data()), nullptr);
79 auto temp_buffer_holder_B =
80 util::TempVectorHolder<uint16_t>(ctx.stack, static_cast<uint32_t>(num_rows));
81 auto temp_buffer_B = KeyColumnArray(
82 KeyColumnMetadata(true, sizeof(uint16_t)), num_rows, nullptr,
83 reinterpret_cast<uint8_t*>(temp_buffer_holder_B.mutable_data()), nullptr);
84
85 bool is_row_fixed_length = row_metadata_.is_fixed_length;
86 if (!is_row_fixed_length) {
87 EncoderOffsets::Decode(static_cast<uint32_t>(start_row_input),
88 static_cast<uint32_t>(num_rows), rows, &batch_varbinary_cols_,
89 batch_varbinary_cols_base_offsets_, &ctx);
90 }
91
92 // Process fixed length columns
93 const auto num_cols = static_cast<uint32_t>(batch_all_cols_.size());
94 for (uint32_t i = 0; i < num_cols;) {
95 if (!batch_all_cols_[i].metadata().is_fixed_length ||
96 batch_all_cols_[i].metadata().is_null_type) {
97 i += 1;
98 continue;
99 }
100 bool can_process_pair =
101 (i + 1 < num_cols) && batch_all_cols_[i + 1].metadata().is_fixed_length &&
102 EncoderBinaryPair::CanProcessPair(batch_all_cols_[i].metadata(),
103 batch_all_cols_[i + 1].metadata());
104 if (!can_process_pair) {
105 EncoderBinary::Decode(static_cast<uint32_t>(start_row_input),
106 static_cast<uint32_t>(num_rows),
107 row_metadata_.column_offsets[i], rows, &batch_all_cols_[i],
108 &ctx, &temp_buffer_A);
109 i += 1;
110 } else {
111 EncoderBinaryPair::Decode(
112 static_cast<uint32_t>(start_row_input), static_cast<uint32_t>(num_rows),
113 row_metadata_.column_offsets[i], rows, &batch_all_cols_[i],
114 &batch_all_cols_[i + 1], &ctx, &temp_buffer_A, &temp_buffer_B);
115 i += 2;
116 }
117 }

Callers 1

GetUniquesMethod · 0.80

Calls 5

KeyColumnMetadataFunction · 0.85
DecodeFunction · 0.70
mutable_dataMethod · 0.45
sizeMethod · 0.45
metadataMethod · 0.45

Tested by

no test coverage detected