pitrou commented on a change in pull request #11199:
URL: https://github.com/apache/arrow/pull/11199#discussion_r713190987
##########
File path: cpp/src/arrow/compute/kernels/aggregate_test.cc
##########
@@ -3312,6 +3313,71 @@ TEST_F(TestRandomFloatQuantileKernel, Sliced) {
}
#endif
+TEST(TestQuantileKernel, AllNullsOrNaNs) {
+ const std::vector<std::vector<std::string>> tests = {
+ {"[]"},
+ {"[null, null]", "[]", "[null]"},
+ {"[NaN]", "[NaN, NaN]", "[]"},
+ {"[null, NaN, null]"},
+ {"[NaN, NaN]", "[]", "[null]"},
+ };
+
+ for (const auto& json : tests) {
+ auto chunked = ChunkedArrayFromJSON(float64(), json);
+ ASSERT_OK_AND_ASSIGN(Datum out, Quantile(chunked, QuantileOptions()));
+ auto out_array = out.make_array();
+ ValidateOutput(*out_array);
+ AssertArraysEqual(*ArrayFromJSON(float64(), "[null]"), *out_array,
/*verbose=*/true);
+ }
+}
+
+TEST(TestQuantileKernel, Scalar) {
+ for (const auto& ty : {float64(), int64(), uint64()}) {
+ QuantileOptions options(std::vector<double>{0.0, 0.5, 1.0});
+ EXPECT_THAT(Quantile(*MakeScalar(ty, 1), options),
+ ResultWith(ArrayFromJSON(float64(), "[1.0, 1.0, 1.0]")));
Review comment:
Did you mean to also test with a null scalar here?
--
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]