summaryrefslogtreecommitdiffstats
path: root/eval
diff options
context:
space:
mode:
authorArne Juul <arnej@verizonmedia.com>2021-02-05 14:50:33 +0000
committerArne Juul <arnej@verizonmedia.com>2021-02-05 14:50:33 +0000
commit5b16f6c3f7f776e04993005cf606735ee1512ebb (patch)
treedfd7a768f201f9506997a331edc6c83cfa7b3357 /eval
parente83cad153e534f39670d9fdd5bd4d58975c4dad0 (diff)
make MergeParam and generic_mixed_merge public
Diffstat (limited to 'eval')
-rw-r--r--eval/src/vespa/eval/instruction/generic_merge.cpp34
-rw-r--r--eval/src/vespa/eval/instruction/generic_merge.h33
2 files changed, 36 insertions, 31 deletions
diff --git a/eval/src/vespa/eval/instruction/generic_merge.cpp b/eval/src/vespa/eval/instruction/generic_merge.cpp
index 7d2edfc7f0b..9b098db7763 100644
--- a/eval/src/vespa/eval/instruction/generic_merge.cpp
+++ b/eval/src/vespa/eval/instruction/generic_merge.cpp
@@ -17,37 +17,6 @@ namespace vespalib::eval::instruction {
using State = InterpretedFunction::State;
using Instruction = InterpretedFunction::Instruction;
-namespace {
-
-//-----------------------------------------------------------------------------
-
-struct MergeParam {
- const ValueType res_type;
- const join_fun_t function;
- const size_t num_mapped_dimensions;
- const size_t dense_subspace_size;
- std::vector<size_t> all_view_dims;
- const ValueBuilderFactory &factory;
- MergeParam(const ValueType &lhs_type, const ValueType &rhs_type,
- join_fun_t function_in, const ValueBuilderFactory &factory_in)
- : res_type(ValueType::join(lhs_type, rhs_type)),
- function(function_in),
- num_mapped_dimensions(lhs_type.count_mapped_dimensions()),
- dense_subspace_size(lhs_type.dense_subspace_size()),
- all_view_dims(num_mapped_dimensions),
- factory(factory_in)
- {
- assert(!res_type.is_error());
- assert(num_mapped_dimensions == rhs_type.count_mapped_dimensions());
- assert(num_mapped_dimensions == res_type.count_mapped_dimensions());
- assert(dense_subspace_size == rhs_type.dense_subspace_size());
- assert(dense_subspace_size == res_type.dense_subspace_size());
- for (size_t i = 0; i < num_mapped_dimensions; ++i) {
- all_view_dims[i] = i;
- }
- }
- ~MergeParam();
-};
MergeParam::~MergeParam() = default;
//-----------------------------------------------------------------------------
@@ -108,6 +77,9 @@ generic_mixed_merge(const Value &a, const Value &b,
return builder->build(std::move(builder));
}
+
+namespace {
+
template <typename LCT, typename RCT, typename OCT, typename Fun>
void my_mixed_merge_op(State &state, uint64_t param_in) {
const auto &param = unwrap_param<MergeParam>(param_in);
diff --git a/eval/src/vespa/eval/instruction/generic_merge.h b/eval/src/vespa/eval/instruction/generic_merge.h
index 2b2964366cc..0319f1a929f 100644
--- a/eval/src/vespa/eval/instruction/generic_merge.h
+++ b/eval/src/vespa/eval/instruction/generic_merge.h
@@ -6,6 +6,39 @@
namespace vespalib::eval::instruction {
+struct MergeParam {
+ const ValueType res_type;
+ const join_fun_t function;
+ const size_t num_mapped_dimensions;
+ const size_t dense_subspace_size;
+ std::vector<size_t> all_view_dims;
+ const ValueBuilderFactory &factory;
+ MergeParam(const ValueType &lhs_type, const ValueType &rhs_type,
+ join_fun_t function_in, const ValueBuilderFactory &factory_in)
+ : res_type(ValueType::join(lhs_type, rhs_type)),
+ function(function_in),
+ num_mapped_dimensions(lhs_type.count_mapped_dimensions()),
+ dense_subspace_size(lhs_type.dense_subspace_size()),
+ all_view_dims(num_mapped_dimensions),
+ factory(factory_in)
+ {
+ assert(!res_type.is_error());
+ assert(num_mapped_dimensions == rhs_type.count_mapped_dimensions());
+ assert(num_mapped_dimensions == res_type.count_mapped_dimensions());
+ assert(dense_subspace_size == rhs_type.dense_subspace_size());
+ assert(dense_subspace_size == res_type.dense_subspace_size());
+ for (size_t i = 0; i < num_mapped_dimensions; ++i) {
+ all_view_dims[i] = i;
+ }
+ }
+ ~MergeParam();
+};
+
+template <typename LCT, typename RCT, typename OCT, typename Fun>
+std::unique_ptr<Value>
+generic_mixed_merge(const Value &a, const Value &b,
+ const MergeParam &params);
+
struct GenericMerge {
static InterpretedFunction::Instruction
make_instruction(const ValueType &lhs_type, const ValueType &rhs_type,