diff options
author | Arne Juul <arnej@verizonmedia.com> | 2020-10-08 16:06:20 +0000 |
---|---|---|
committer | Arne Juul <arnej@verizonmedia.com> | 2020-10-08 16:06:20 +0000 |
commit | 08ca6183f9f5a66ca9a1fe7c3150a4bd6761bd9d (patch) | |
tree | 075f2c4d48a2785b93938fb58d6ba096118c2b73 /eval | |
parent | 16d7902bc1fc911d69d82b0e40c3aef54651a299 (diff) |
handle concat(vector of float, double)
Diffstat (limited to 'eval')
-rw-r--r-- | eval/src/tests/instruction/generic_concat/generic_concat_test.cpp | 3 | ||||
-rw-r--r-- | eval/src/vespa/eval/instruction/generic_concat.cpp | 25 |
2 files changed, 16 insertions, 12 deletions
diff --git a/eval/src/tests/instruction/generic_concat/generic_concat_test.cpp b/eval/src/tests/instruction/generic_concat/generic_concat_test.cpp index 8cf18e25928..5405f957afc 100644 --- a/eval/src/tests/instruction/generic_concat/generic_concat_test.cpp +++ b/eval/src/tests/instruction/generic_concat/generic_concat_test.cpp @@ -21,6 +21,8 @@ using vespalib::make_string_short::fmt; std::vector<Layout> concat_layouts = { {}, {}, {}, {y(5)}, + float_cells({y(5)}), {}, + {}, float_cells({y(5)}), {y(5)}, {}, {y(2)}, {y(3)}, {y(2)}, {x(3)}, @@ -39,6 +41,7 @@ std::vector<Layout> concat_layouts = { {y(2),x(5),z(2)}, {y(3),x(5),z(2)}, {y(3),x(5)}, {x(5),z(7)}, float_cells({y(3),x(5)}), {x(5),z(7)}, + float_cells({y(3),x(5)}), {}, {y(3),x(5)}, float_cells({x(5),z(7)}), float_cells({y(3),x(5)}), float_cells({x(5),z(7)}), {x({"a","b","c"})}, {x({"a","b","c"})}, diff --git a/eval/src/vespa/eval/instruction/generic_concat.cpp b/eval/src/vespa/eval/instruction/generic_concat.cpp index 91ce75b2238..7c55afafcc1 100644 --- a/eval/src/vespa/eval/instruction/generic_concat.cpp +++ b/eval/src/vespa/eval/instruction/generic_concat.cpp @@ -45,14 +45,13 @@ struct ConcatParam } }; -template <typename LCT, typename RCT> +template <typename LCT, typename RCT, typename OCT> std::unique_ptr<Value> generic_concat(const Value &a, const Value &b, const SparseJoinPlan &sparse_plan, const DenseConcatPlan &dense_plan, const ValueType &res_type, const ValueBuilderFactory &factory) { - using OCT = typename eval::UnifyCellTypes<LCT, RCT>::type; auto a_cells = a.cells().typify<LCT>(); auto b_cells = b.cells().typify<RCT>(); SparseJoinState sparse(sparse_plan, a.index(), b.index()); @@ -82,21 +81,22 @@ generic_concat(const Value &a, const Value &b, return builder->build(std::move(builder)); } -template <typename LCT, typename RCT> +template <typename LCT, typename RCT, typename OCT> void my_generic_concat_op(State &state, uint64_t param_in) { const auto ¶m = unwrap_param<ConcatParam>(param_in); const Value &lhs = state.peek(1); const Value &rhs = state.peek(0); - auto res_value = generic_concat<LCT, RCT>(lhs, rhs, param.sparse_plan, param.dense_plan, - param.res_type, param.factory); + auto res_value = generic_concat<LCT, RCT, OCT>( + lhs, rhs, + param.sparse_plan, param.dense_plan, + param.res_type, param.factory); auto &result = state.stash.create<std::unique_ptr<Value>>(std::move(res_value)); const Value &result_ref = *(result.get()); state.pop_pop_push(result_ref); } -template <typename LCT, typename RCT> +template <typename LCT, typename RCT, typename OCT> void my_dense_simple_concat_op(State &state, uint64_t param_in) { - using OCT = typename eval::UnifyCellTypes<LCT, RCT>::type; const auto ¶m = unwrap_param<ConcatParam>(param_in); const Value &lhs = state.peek(1); const Value &rhs = state.peek(0); @@ -115,16 +115,16 @@ void my_dense_simple_concat_op(State &state, uint64_t param_in) { } struct SelectGenericConcatOp { - template <typename LCT, typename RCT> static auto invoke(const ConcatParam ¶m) { + template <typename LCT, typename RCT, typename OCT> static auto invoke(const ConcatParam ¶m) { if (param.sparse_plan.sources.empty() && param.res_type.is_dense()) { auto & dp = param.dense_plan; if ((dp.output_size == (dp.left.input_size + dp.right.input_size)) && (dp.right_offset == dp.left.input_size)) { - return my_dense_simple_concat_op<LCT, RCT>; + return my_dense_simple_concat_op<LCT, RCT, OCT>; } } - return my_generic_concat_op<LCT, RCT>; + return my_generic_concat_op<LCT, RCT, OCT>; } }; @@ -196,8 +196,9 @@ GenericConcat::make_instruction(const ValueType &lhs_type, const ValueType &rhs_ const ValueBuilderFactory &factory, Stash &stash) { auto ¶m = stash.create<ConcatParam>(lhs_type, rhs_type, dimension, factory); - auto fun = typify_invoke<2,TypifyCellType,SelectGenericConcatOp>( - lhs_type.cell_type(), rhs_type.cell_type(), param); + auto fun = typify_invoke<3,TypifyCellType,SelectGenericConcatOp>( + lhs_type.cell_type(), rhs_type.cell_type(), param.res_type.cell_type(), + param); return Instruction(fun, wrap_param<ConcatParam>(param)); } |