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

Method EncodeSelected

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

Source from the content-addressed store, hash-verified

151}
152
153Status RowTableEncoder::EncodeSelected(RowTableImpl* rows, uint32_t num_selected,
154 const uint16_t* selection) {
155 rows->Clean();
156
157 // First AppendEmpty with num_selected rows and zero extra bytes to resize the
158 // fixed-length buffers (including buffer for offsets).
159 RETURN_NOT_OK(
160 rows->AppendEmpty(static_cast<uint32_t>(num_selected),
161 /*num_extra_bytes_to_append=*/static_cast<uint32_t>(0)));
162 // Then populate the offsets of the var-length columns, which will be used as the target
163 // size of the var-length buffers resizing below.
164 RETURN_NOT_OK(EncoderOffsets::GetRowOffsetsSelected(rows, batch_varbinary_cols_,
165 num_selected, selection));
166 // Last AppendEmpty with zero rows and zero extra bytes to resize the var-length buffers
167 // based on the populated offsets.
168 RETURN_NOT_OK(
169 rows->AppendEmpty(/*num_rows_to_append=*/static_cast<uint32_t>(0),
170 /*num_extra_bytes_to_append=*/static_cast<uint32_t>(0)));
171
172 for (size_t icol = 0; icol < batch_all_cols_.size(); ++icol) {
173 if (batch_all_cols_[icol].metadata().is_fixed_length) {
174 uint32_t offset_within_row = rows->metadata().column_offsets[icol];
175 EncoderBinary::EncodeSelected(offset_within_row, rows, batch_all_cols_[icol],
176 num_selected, selection);
177 }
178 }
179
180 EncoderOffsets::EncodeSelected(rows, batch_varbinary_cols_, num_selected, selection);
181
182 for (size_t icol = 0; icol < batch_varbinary_cols_.size(); ++icol) {
183 EncoderVarBinary::EncodeSelected(static_cast<uint32_t>(icol), rows,
184 batch_varbinary_cols_[icol], num_selected,
185 selection);
186 }
187
188 EncoderNulls::EncodeSelected(rows, batch_all_cols_, num_selected, selection);
189
190 return Status::OK();
191}
192
193namespace {
194struct TransformBoolean {

Callers 6

AppendBatchSelectionMethod · 0.80
MakeMethod · 0.80
TESTFunction · 0.80
MakeRowTableFromColumnFunction · 0.80
row_test.ccFile · 0.80

Calls 9

SetBitFunction · 0.85
CleanMethod · 0.80
OKFunction · 0.50
GetBitFunction · 0.50
AppendEmptyMethod · 0.45
sizeMethod · 0.45
metadataMethod · 0.45
dataMethod · 0.45
offsetsMethod · 0.45

Tested by 3

TESTFunction · 0.64
MakeRowTableFromColumnFunction · 0.64