zanmato1984 commented on code in PR #43734:
URL: https://github.com/apache/arrow/pull/43734#discussion_r1721534788
##########
cpp/src/arrow/compute/CMakeLists.txt:
##########
@@ -93,6 +93,7 @@ add_arrow_test(internals_test
row/compare_test.cc
row/grouper_test.cc
row/row_test.cc
+ row/row_encoder_internal_test.cc
Review Comment:
Ditto. Keep the order alphabetical.
##########
cpp/src/arrow/CMakeLists.txt:
##########
@@ -723,7 +723,7 @@ set(ARROW_COMPUTE_SRCS
compute/ordering.cc
compute/registry.cc
compute/kernels/codegen_internal.cc
- compute/kernels/row_encoder.cc
+ compute/row/row_encoder_internal.cc
Review Comment:
Could you move it to where keeps the alphabetical order?
##########
cpp/src/arrow/compute/row/row_encoder_internal.cc:
##########
@@ -75,26 +75,32 @@ void BooleanKeyEncoder::AddLengthNull(int32_t* length) {
Status BooleanKeyEncoder::Encode(const ExecValue& data, int64_t batch_length,
uint8_t** encoded_bytes) {
+ auto handle_next_valid_value = [&encoded_bytes](bool value) {
+ auto& encoded_ptr = *encoded_bytes++;
+ *encoded_ptr++ = kValidByte;
+ *encoded_ptr++ = value;
+ };
+ auto handle_next_null_value = [&encoded_bytes]() {
+ auto& encoded_ptr = *encoded_bytes++;
+ *encoded_ptr++ = kNullByte;
+ *encoded_ptr++ = 0;
+ };
+
if (data.is_array()) {
VisitArraySpanInline<BooleanType>(
- data.array,
- [&](bool value) {
- auto& encoded_ptr = *encoded_bytes++;
- *encoded_ptr++ = kValidByte;
- *encoded_ptr++ = value;
- },
- [&] {
- auto& encoded_ptr = *encoded_bytes++;
- *encoded_ptr++ = kNullByte;
- *encoded_ptr++ = 0;
- });
+ data.array, [&](bool value) { handle_next_valid_value(value); },
+ [&] { handle_next_null_value(); });
Review Comment:
```suggestion
data.array, handle_next_valid_value, handle_next_null_value);
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]