github-actions[bot] commented on code in PR #64593:
URL: https://github.com/apache/doris/pull/64593#discussion_r3430627463


##########
be/test/exprs/aggregate/agg_percentile_reservoir_test.cpp:
##########
@@ -0,0 +1,122 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#include <gtest/gtest.h>
+
+#include <memory>
+#include <vector>
+
+#include "core/block/column_with_type_and_name.h"
+#include "core/column/column_const.h"
+#include "core/column/column_vector.h"
+#include "core/data_type/data_type_number.h"
+#include "exprs/aggregate/aggregate_function_simple_factory.h"
+
+namespace doris {
+
+namespace {
+
+AggregateFunctionPtr create_percentile_reservoir_function(bool is_window = 
false) {
+    return AggregateFunctionSimpleFactory::instance().get(
+            "percentile_reservoir",
+            {std::make_shared<DataTypeFloat64>(), 
std::make_shared<DataTypeFloat64>()},
+            std::make_shared<DataTypeFloat64>(), false, 
BeExecVersionManager::get_newest_version(),
+            {.is_window_function = is_window, .column_names = {}});
+}
+
+ColumnWithTypeAndName create_level_argument(double level) {
+    auto level_column = ColumnFloat64::create();
+    level_column->insert_value(level);
+    auto const_column = ColumnConst::create(level_column->get_ptr(), 1);
+    return {std::move(const_column), std::make_shared<DataTypeFloat64>(), 
"level"};
+}
+
+ColumnWithTypeAndName create_value_block(const std::vector<double>& values) {
+    auto value_column = ColumnFloat64::create();
+    for (double value : values) {
+        value_column->insert_value(value);
+    }
+    return {std::move(value_column), std::make_shared<DataTypeFloat64>(), 
"value"};
+}
+
+double read_result(AggregateFunctionPtr fn, AggregateDataPtr place) {
+    auto result_column = ColumnFloat64::create();
+    fn->insert_result_into(place, *result_column);
+    return result_column->get_element(0);
+}
+
+} // namespace
+
+TEST(AggregateFunctionPercentileReservoirTest, 
batch_paths_cover_all_overrides) {
+    auto fn = create_percentile_reservoir_function();
+    ASSERT_TRUE(fn != nullptr);
+
+    std::vector<ColumnWithTypeAndName> arguments;
+    arguments.emplace_back(create_value_block({1.0, 2.0, 3.0, 4.0}));
+    arguments.emplace_back(create_level_argument(0.5));
+    ASSERT_TRUE(fn->set_precomputed_arguments({arguments[1]}).ok());

Review Comment:
   `AggregateFunctionPtr` is an alias for 
`std::shared_ptr<IAggregateFunction>`, and `IAggregateFunction` does not define 
`set_precomputed_arguments` (there are no other calls in this checkout). 
Because `be/test/CMakeLists.txt` glob-includes `exprs/*.cpp`, this new file is 
compiled into `doris_be_test` and will fail at this line. The percentile 
reservoir add paths still read `columns[1]`, so please build the test input 
with both `ColumnFloat64` columns (repeating or single-valuing the constant 
level as appropriate) or drive the real evaluator path that supplies the second 
argument.



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to