Skip to content

Commit c392cbd

Browse files
committed
Add comment; improve test coverage
1 parent 9b843b5 commit c392cbd

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

cpp/src/arrow/compute/kernels/scalar_compare.cc

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,10 @@ struct ListEqual {
6464
if (left.length != right.length) {
6565
return false;
6666
} else {
67+
// The offsets are hard-coded to zero because the scalar unboxing and
68+
// array iteration routines already set the offset from the list parent
6769
RangeDataEqualsImpl range_comparer{
68-
EqualOptions::Defaults(),
69-
false,
70-
left,
71-
right,
72-
left.offset,
73-
right.offset,
74-
left.length,
70+
EqualOptions::Defaults(), false, left, right, 0, 0, left.length,
7571
};
7672
return range_comparer.Compare();
7773
}
@@ -87,7 +83,9 @@ struct ListNotEqual {
8783
return true;
8884
} else {
8985
RangeDataEqualsImpl range_comparer{
90-
EqualOptions::Defaults(), false, left, right, 0, 0, 1,
86+
// The offsets are hard-coded to zero because the scalar unboxing and
87+
// array iteration routines already set the offset from the list parent
88+
EqualOptions::Defaults(), false, left, right, 0, 0, left.length,
9189
};
9290

9391
return !range_comparer.Compare();

cpp/src/arrow/compute/kernels/scalar_compare_test.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -745,7 +745,8 @@ TYPED_TEST(TestCompareList, ArrayArray) {
745745
{"equal", "[1, 0, 0, null]"},
746746
{"not_equal", "[0, 1, 1, null]"},
747747
};
748-
const auto lhs_int = ArrayFromJSON(int_ty, R"([[1, 2, 3], [4, 5, 6], [7], null])");
748+
const auto lhs_int =
749+
ArrayFromJSON(int_ty, R"([[1, 2, 3], [4, 5, 6], [6, 8, 7], null])");
749750
const auto lhs_bin = ArrayFromJSON(
750751
bin_ty, R"([["a", "b", "c"], ["foo", "bar", "baz"], ["hello"], null])");
751752
const auto rhs_int = ArrayFromJSON(int_ty, R"([[1, 2, 3], [4, 5], [6, 7, 8], null])");

0 commit comments

Comments
 (0)