OmniSciDB  72c90bc290
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RuntimeLibTestTableFunctions.hpp
Go to the documentation of this file.
1 /*
2  * Copyright 2023 HEAVY.AI, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #pragma once
18 
19 #include "../../../QueryEngine/heavydbTypes.h"
20 #include "TestRuntimeLib.h"
21 
22 // clang-format off
23 /*
24  UDTF: ct_test_runtime_libs_add__cpu_template_(TableFunctionManager, Column<T>, Column<T>) -> Column<T>, T=[int64_t, double]
25  UDTF: ct_test_runtime_libs_sub__cpu_template_(TableFunctionManager, Column<T>, Column<T>) -> Column<T>, T=[int64_t, double]
26 */
27 // clang-format on
28 template <typename T>
29 TEMPLATE_NOINLINE int32_t
31  const Column<T>& input1,
32  const Column<T>& input2,
33  Column<T>& out) {
34  int64_t size = input1.size();
35  mgr.set_output_row_size(size);
36  for (int64_t i = 0; i < size; ++i) {
37  out[i] = _test_runtime_add(input1[i], input2[i]);
38  }
39  return size;
40 }
41 
42 template <typename T>
43 TEMPLATE_NOINLINE int32_t
45  const Column<T>& input1,
46  const Column<T>& input2,
47  Column<T>& out) {
48  int64_t size = input1.size();
49  mgr.set_output_row_size(size);
50  for (int64_t i = 0; i < size; ++i) {
51  out[i] = _test_runtime_sub(input1[i], input2[i]);
52  }
53  return size;
54 }
void set_output_row_size(int64_t num_rows)
Definition: heavydbTypes.h:373
DEVICE int64_t size() const
T _test_runtime_add(T x, T y)
T _test_runtime_sub(T x, T y)
TEMPLATE_NOINLINE int32_t ct_test_runtime_libs_add__cpu_template_(TableFunctionManager &mgr, const Column< T > &input1, const Column< T > &input2, Column< T > &out)
TEMPLATE_NOINLINE int32_t ct_test_runtime_libs_sub__cpu_template_(TableFunctionManager &mgr, const Column< T > &input1, const Column< T > &input2, Column< T > &out)
#define TEMPLATE_NOINLINE
Definition: heavydbTypes.h:60