wgtmac commented on code in PR #55449:
URL: https://github.com/apache/arrow/pull/55449#discussion_r4545536315
##########
cpp/src/arrow/util/alp/alp_test.cc:
##########
@@ -776,11 +774,34 @@ TYPED_TEST(AlpSamplerTest, PresetGenerationDecimalData) {
output, std::vector<TypeParam>(data.begin(), data.begin() +
kNumValues)));
}
+TYPED_TEST(AlpSamplerTest, SamplingWindowSize) {
+ constexpr int64_t kChunkSize = AlpSamplingOptions::kChunkSize;
+ const std::vector<TypeParam> nan_chunk(kChunkSize,
+
std::numeric_limits<TypeParam>::quiet_NaN());
+ const std::vector<TypeParam> decimal_chunk(kChunkSize,
static_cast<TypeParam>(1.25));
+ const auto decimal_preset =
AlpCompression<TypeParam>::MakePreset({decimal_chunk});
+
+ // The sampler targets eight chunks per window. An eight-chunk window samples
+ // both inputs, but only decimal_chunk can contribute usable parameters.
+ AlpSampler<TypeParam> every_chunk(/*sampling_window_size=*/8 * kChunkSize);
+ every_chunk.AddSample(nan_chunk);
+ every_chunk.AddSample(decimal_chunk);
+ EXPECT_EQ(decimal_preset.combinations,
every_chunk.MakePreset().combinations);
+
+ // A sixteen-chunk window samples every other chunk, skipping decimal_chunk.
+ // With only NaNs sampled, the preset falls back to identity.
+ AlpSampler<TypeParam> every_other_chunk(/*sampling_window_size=*/16 *
kChunkSize);
Review Comment:
Yes, let me make it explicit.
--
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]