bkietz commented on code in PR #35003:
URL: https://github.com/apache/arrow/pull/35003#discussion_r1373365479
##########
cpp/src/arrow/array/diff.cc:
##########
@@ -164,56 +382,38 @@ class QuadraticSpaceMyersDiff {
: base_(base),
target_(target),
pool_(pool),
- value_comparator_(GetValueComparator(*base.type())),
- base_begin_(0),
base_end_(base.length()),
- target_begin_(0),
target_end_(target.length()),
- endpoint_base_({ExtendFrom({base_begin_, target_begin_}).base}),
insert_({true}) {
- if ((base_end_ - base_begin_ == target_end_ - target_begin_) &&
- endpoint_base_[0] == base_end_) {
- // trivial case: base == target
- finish_index_ = 0;
- }
- }
-
- bool ValuesEqual(int64_t base_index, int64_t target_index) const {
- bool base_null = base_.IsNull(base_index);
- bool target_null = target_.IsNull(target_index);
- if (base_null || target_null) {
- // If only one is null, then this is false, otherwise true
- return base_null && target_null;
- }
- return value_comparator_(base_, base_index, target_, target_index);
+ // endpoint_base_ is initialized when Diff() is called to start the
algorithm.
Review Comment:
I think `Diff` being the only entry point is good, but in either case I'd
like to avoid splitting initialization as much as possible. Would you mind
moving everything except the reference member init into Diff?
--
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]