lidavidm commented on a change in pull request #12368:
URL: https://github.com/apache/arrow/pull/12368#discussion_r807991560
##########
File path: cpp/src/arrow/compute/kernels/hash_aggregate_test.cc
##########
@@ -2460,6 +2461,315 @@ TEST(GroupBy, Distinct) {
}
}
+MATCHER_P2(AnyOfJSON, type, array_json, "") {
+ auto array = ArrayFromJSON(type, array_json);
+ for (int64_t i = 0; i < array->length(); ++i) {
+ std::shared_ptr<Scalar> scalar;
+ auto maybe_scalar = array->GetScalar(i);
+ if (maybe_scalar.ok()) {
+ scalar = maybe_scalar.ValueOrDie();
+ } else {
+ *result_listener << "Unable to retrieve scalar via GetScalar() "
+ << "at index " << i << " from the input JSON Array";
+ return false;
+ }
+
+ if (scalar->Equals(arg)) return true;
+ }
+ *result_listener << "Argument scalar: '" << arg->ToString()
+ << "' matches no input scalar.";
Review comment:
also include `array_json`?
##########
File path: cpp/src/arrow/compute/kernels/hash_aggregate_test.cc
##########
@@ -2460,6 +2461,315 @@ TEST(GroupBy, Distinct) {
}
}
+MATCHER_P2(AnyOfJSON, type, array_json, "") {
+ auto array = ArrayFromJSON(type, array_json);
+ for (int64_t i = 0; i < array->length(); ++i) {
+ std::shared_ptr<Scalar> scalar;
+ auto maybe_scalar = array->GetScalar(i);
+ if (maybe_scalar.ok()) {
+ scalar = maybe_scalar.ValueOrDie();
+ } else {
+ *result_listener << "Unable to retrieve scalar via GetScalar() "
+ << "at index " << i << " from the input JSON Array";
Review comment:
also include `maybe_scalar.status().ToString()`?
##########
File path: cpp/src/arrow/compute/kernels/hash_aggregate_test.cc
##########
@@ -2460,6 +2461,315 @@ TEST(GroupBy, Distinct) {
}
}
+MATCHER_P2(AnyOfJSON, type, array_json, "") {
Review comment:
Just reiterating my earlier comment - but we've found before that these
convenience macros don't work in all environments.
--
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]