OmniSciDB  fe05a0c208
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
TableFunctionsTesting.hpp
Go to the documentation of this file.
1 /*
2  This file contains tesing compile-time UDTFs. The unit-tests are
3  implemented within the RBC package.
4  */
5 
6 #define CPU_DEVICE_CODE 0x637075; // 'cpu' in hex
7 #define GPU_DEVICE_CODE 0x677075; // 'gpu' in hex
8 
9 // clang-format off
10 /*
11  UDTF: ct_device_selection_udtf_any(Cursor<int32_t>) -> Column<int32_t>
12  UDTF: ct_device_selection_udtf_cpu__cpu_(Cursor<int32_t>) -> Column<int32_t>
13  UDTF: ct_device_selection_udtf_gpu__gpu_(Cursor<int32_t>) -> Column<int32_t>
14  UDTF: ct_device_selection_udtf_both__cpu_(Cursor<int32_t>) -> Column<int32_t>
15  UDTF: ct_device_selection_udtf_both__gpu_(Cursor<int32_t>) -> Column<int32_t>
16 */
17 // clang-format on
18 
21 #ifdef __CUDACC__
22  out[0] = GPU_DEVICE_CODE;
23 #else
24  out[0] = CPU_DEVICE_CODE;
25 #endif
26  return 1;
27 }
28 
31  Column<int64_t>& out) {
32  out[0] = CPU_DEVICE_CODE;
33  return 1;
34 }
35 
38  Column<int64_t>& out) {
39  out[0] = GPU_DEVICE_CODE;
40  return 1;
41 }
42 
45  Column<int64_t>& out) {
46  out[0] = CPU_DEVICE_CODE;
47  return 1;
48 }
49 
52  Column<int64_t>& out) {
53  out[0] = GPU_DEVICE_CODE;
54  return 1;
55 }
56 
57 #undef CPU_DEVICE_CODE
58 #undef GPU_DEVICE_CODE
59 
60 // clang-format off
61 /*
62  Test functions for constant sizer parameter:
63 
64  UDTF: ct_binding_udtf_constant__cpu_1(Cursor<int32_t>) -> Column<int32_t>
65  UDTF: ct_binding_udtf_constant__cpu_2(Cursor<int32_t, int32_t>) -> Column<int32_t>
66  UDTF: ct_binding_udtf_constant__cpu_3(Cursor<int32_t, int32_t, int32_t>) -> Column<int32_t>
67  UDTF: ct_binding_udtf_constant__cpu_4(Cursor<int64_t, int32_t, int32_t>) -> Column<int32_t>
68  UDTF: ct_binding_udtf_constant__cpu_5(Cursor<int64_t, int64_t, int32_t>) -> Column<int32_t>
69  UDTF: ct_binding_udtf_constant__cpu_6(Cursor<int64_t, int32_t, int64_t>) -> Column<int32_t>
70  UDTF: ct_binding_udtf_constant__cpu_7(Cursor<int32_t, ColumnList<int32_t>>) -> Column<int32_t>
71  UDTF: ct_binding_udtf_constant__cpu_8(Cursor<ColumnList<int32_t>, int64_t>) -> Column<int32_t>
72  UDTF: ct_binding_udtf_constant__cpu_9(Cursor<ColumnList<int32_t>, ColumnList<int64_t>>) -> Column<int32_t>
73  UDTF: ct_binding_udtf_constant__cpu_10(Cursor<int64_t, ColumnList<int64_t>, int64_t>) -> Column<int32_t>
74 
75 
76  Test functions for row multiplier sizer parameter:
77 
78  UDTF: ct_binding_udtf__cpu_11(Cursor<int32_t>, RowMultiplier) -> Column<int32_t>
79  UDTF: ct_binding_udtf__cpu_12(Cursor<int32_t, int32_t>, RowMultiplier) -> Column<int32_t>
80  UDTF: ct_binding_udtf__cpu_13(Cursor<int32_t, int32_t, int32_t>, RowMultiplier) -> Column<int32_t>
81  UDTF: ct_binding_udtf__cpu_14(Cursor<int64_t, int32_t, int32_t>, RowMultiplier) -> Column<int32_t>
82  UDTF: ct_binding_udtf__cpu_15(Cursor<int64_t, int64_t, int32_t>, RowMultiplier) -> Column<int32_t>
83  UDTF: ct_binding_udtf__cpu_16(Cursor<int64_t, int32_t, int64_t>, RowMultiplier) -> Column<int32_t>
84  UDTF: ct_binding_udtf__cpu_17(Cursor<int32_t, ColumnList<int32_t>>, RowMultiplier) -> Column<int32_t>
85  UDTF: ct_binding_udtf__cpu_18(Cursor<ColumnList<int32_t>, int64_t>, RowMultiplier) -> Column<int32_t>
86  UDTF: ct_binding_udtf__cpu_19(Cursor<ColumnList<int32_t>, ColumnList<int64_t>>, RowMultiplier) -> Column<int32_t>
87  UDTF: ct_binding_udtf__cpu_20(Cursor<int64_t, ColumnList<int64_t>, int64_t>, RowMultiplier) -> Column<int32_t>
88 
89  UDTF: ct_binding_udtf2__cpu_21(RowMultiplier, Cursor<int32_t>) -> Column<int32_t>
90  UDTF: ct_binding_udtf6__cpu_22(Cursor<int32_t>, RowMultiplier, int32_t) -> Column<int32_t>
91  UDTF: ct_binding_udtf4__cpu_23(Cursor<ColumnList<int32_t>>, RowMultiplier, int32_t) -> Column<int32_t>
92  UDTF: ct_binding_udtf5__cpu_24(Cursor<ColumnList<int32_t>>, int32_t, RowMultiplier) -> Column<int32_t>
93  UDTF: ct_binding_udtf3__cpu_25(Cursor<Column<int32_t>>, int32_t, RowMultiplier) -> Column<int32_t>
94 */
95 // clang-format on
96 
98  Column<int32_t>& out) {
99  out[0] = 1;
100  return 1;
101 }
103  const Column<int32_t>& input2,
104  Column<int32_t>& out) {
105  out[0] = 11;
106  return 1;
107 }
109  const Column<int32_t>& input2,
110  const Column<int32_t>& input3,
111  Column<int32_t>& out) {
112  out[0] = 111;
113  return 1;
114 }
116  const Column<int32_t>& input2,
117  const Column<int32_t>& input3,
118  Column<int32_t>& out) {
119  out[0] = 211;
120  return 1;
121 }
123  const Column<int64_t>& input2,
124  const Column<int32_t>& input3,
125  Column<int32_t>& out) {
126  out[0] = 221;
127  return 1;
128 }
130  const Column<int32_t>& input2,
131  const Column<int64_t>& input3,
132  Column<int32_t>& out) {
133  out[0] = 212;
134  return 1;
135 }
136 EXTENSION_NOINLINE int32_t
138  const ColumnList<int32_t>& input2,
139  Column<int32_t>& out) {
140  out[0] = 13;
141  return 1;
142 }
143 EXTENSION_NOINLINE int32_t
145  const Column<int64_t>& input2,
146  Column<int32_t>& out) {
147  out[0] = 32;
148  return 1;
149 }
150 EXTENSION_NOINLINE int32_t
152  const ColumnList<int64_t>& input2,
153  Column<int32_t>& out) {
154  out[0] = 34;
155  return 1;
156 }
157 EXTENSION_NOINLINE int32_t
159  const ColumnList<int64_t>& input2,
160  const Column<int64_t>& input3,
161  Column<int64_t>& out) {
162  out[0] = 242;
163  return 1;
164 }
165 
167  const int32_t multiplier,
168  Column<int32_t>& out) {
169  out[0] = 1000 + 19 + multiplier;
170  return 1;
171 }
173  const Column<int32_t>& input2,
174  const int32_t multiplier,
175  Column<int32_t>& out) {
176  out[0] = 1000 + 119 + multiplier;
177  return 1;
178 }
180  const Column<int32_t>& input2,
181  const Column<int32_t>& input3,
182  const int32_t multiplier,
183  Column<int32_t>& out) {
184  out[0] = 1000 + 1119 + multiplier;
185  return 1;
186 }
188  const Column<int32_t>& input2,
189  const Column<int32_t>& input3,
190  const int32_t multiplier,
191  Column<int32_t>& out) {
192  out[0] = 1000 + 2119 + multiplier;
193  return 1;
194 }
196  const Column<int64_t>& input2,
197  const Column<int32_t>& input3,
198  const int32_t multiplier,
199  Column<int32_t>& out) {
200  out[0] = 1000 + 2219 + multiplier;
201  return 1;
202 }
204  const Column<int32_t>& input2,
205  const Column<int64_t>& input3,
206  const int32_t multiplier,
207  Column<int32_t>& out) {
208  out[0] = 1000 + 2129 + multiplier;
209  return 1;
210 }
212  const ColumnList<int32_t>& input2,
213  const int32_t multiplier,
214  Column<int32_t>& out) {
215  out[0] = 1000 + 139 + multiplier;
216  return 1;
217 }
219  const Column<int64_t>& input2,
220  const int32_t multiplier,
221  Column<int32_t>& out) {
222  out[0] = 1000 + 329 + multiplier;
223  return 1;
224 }
226  const ColumnList<int64_t>& input2,
227  const int32_t multiplier,
228  Column<int32_t>& out) {
229  out[0] = 1000 + 349 + multiplier;
230  return 1;
231 }
233  const ColumnList<int64_t>& input2,
234  const Column<int64_t>& input3,
235  const int32_t multiplier,
236  Column<int64_t>& out) {
237  out[0] = 1000 + 2429 + multiplier;
238  return 1;
239 }
240 
241 EXTENSION_NOINLINE int32_t ct_binding_udtf2__cpu_21(const int32_t multiplier,
242  const Column<int32_t>& input1,
243  Column<int32_t>& out) {
244  out[0] = 1000 + 91 + multiplier;
245  return 1;
246 }
248  const int32_t multiplier,
249  const int32_t input2,
250  Column<int32_t>& out) {
251  out[0] = 1000 + 196 + multiplier + 10 * input2;
252  return 1;
253 }
255  const int32_t multiplier,
256  const int32_t input2,
257  Column<int32_t>& out) {
258  out[0] = 1000 + 396 + multiplier + 10 * input2;
259  return 1;
260 }
262  const int32_t input2,
263  const int32_t multiplier,
264  Column<int32_t>& out) {
265  out[0] = 1000 + 369 + multiplier + 10 * input2;
266  return 1;
267 }
269  const int32_t input2,
270  const int32_t multiplier,
271  Column<int32_t>& out) {
272  out[0] = 1000 + 169 + multiplier + 10 * input2;
273  return 1;
274 }
275 
276 /*
277  Test functions for default sizer parameter:
278 */
279 
280 // clang-format off
281 /*
282  UDTF: ct_udtf_default_sizer1a__cpu_1(Cursor<int32_t>, RowMultiplier) -> Column<int32_t>
283  UDTF: ct_udtf_default_sizer1b__cpu_2(Cursor<int32_t>, Cursor<int32_t>, RowMultiplier) -> Column<int32_t>
284  UDTF: ct_udtf_default_sizer1c__cpu_3(Cursor<int32_t, int32_t, int32_t>, RowMultiplier, Cursor<int32_t>, int32_t) -> Column<int32_t>
285  UDTF: ct_udtf_default_sizer1d__cpu_4(RowMultiplier, int32_t, Cursor<int32_t>) -> Column<int32_t>
286  UDTF: ct_udtf_default_sizer2a__cpu_1(Cursor<int32_t>, int32_t, RowMultiplier) -> Column<int32_t>
287  UDTF: ct_udtf_default_sizer2b__cpu_2(Cursor<int32_t>, RowMultiplier, Cursor<int32_t>) -> Column<int32_t>
288  UDTF: ct_udtf_default_sizer2c__cpu_3(int32_t, RowMultiplier, Cursor<int32_t>) -> Column<int32_t>
289  UDTF: ct_udtf_default_sizer3a__cpu_1(Cursor<int32_t>, RowMultiplier, int32_t) -> Column<int32_t>
290  UDTF: ct_udtf_default_sizer3b__cpu_2(Cursor<int32_t>, int32_t, Cursor<int32_t>, RowMultiplier) -> Column<int32_t>
291  UDTF: ct_udtf_default_sizer4a__cpu_1(Cursor<int32_t>, RowMultiplier, Cursor<int32_t>, int32_t) -> Column<int32_t>
292  UDTF: ct_udtf_default_sizer4b__cpu_2(RowMultiplier, Cursor<int32_t>, int32_t) -> Column<int32_t>
293 */
294 // clang-format on
296  const int32_t multiplier,
297  Column<int32_t>& out) {
298  out[0] = 1000 + 1 + 10 * multiplier;
299  return 1;
300 }
302  const Column<int32_t>& input2,
303  const int32_t multiplier,
304  Column<int32_t>& out) {
305  out[0] = 1000 + 2 + 11 * multiplier;
306  return 1;
307 }
309  const Column<int32_t>& input2,
310  const Column<int32_t>& input3,
311  const int32_t multiplier,
312  const Column<int32_t>& input4,
313  const int32_t x,
314  Column<int32_t>& out) {
315  out[0] = 1000 + 101 + 10 * multiplier + x;
316  return 1;
317 }
318 EXTENSION_NOINLINE int32_t ct_udtf_default_sizer1d__cpu_4(const int32_t multiplier,
319  const int32_t x,
320  const Column<int32_t>& input1,
321  Column<int32_t>& out) {
322  out[0] = 1000 + 99 + 10 * multiplier + x;
323  return 1;
324 }
326  const int32_t x,
327  const int32_t multiplier,
328  Column<int32_t>& out) {
329  out[0] = 1000 + 98 + multiplier + 10 * x;
330  return 1;
331 }
333  const int32_t multiplier,
334  const Column<int32_t>& input2,
335  Column<int32_t>& out) {
336  out[0] = 1000 + 2 + multiplier;
337  return 1;
338 }
340  const int32_t multiplier,
341  const Column<int32_t>& input1,
342  Column<int32_t>& out) {
343  out[0] = 1000 + 99 + multiplier + 11 * x;
344  return 1;
345 }
347  const int32_t multiplier,
348  const int32_t x,
349  Column<int32_t>& out) {
350  out[0] = 1000 + 98 + 100 * multiplier + x;
351  return 1;
352 }
354  const int32_t x,
355  const Column<int32_t>& input2,
356  const int32_t multiplier,
357  Column<int32_t>& out) {
358  out[0] = 1000 + 99 + 100 * multiplier + x;
359  return 1;
360 }
362  const int32_t multiplier,
363  const Column<int32_t>& input2,
364  const int32_t x,
365  Column<int32_t>& out) {
366  out[0] = 1000 + 99 + 10 * multiplier + x;
367  return 1;
368 }
369 EXTENSION_NOINLINE int32_t ct_udtf_default_sizer4b__cpu_2(const int32_t multiplier,
370  const Column<int32_t>& input,
371  const int32_t x,
372  Column<int32_t>& out) {
373  out[0] = 1000 + 99 + 9 * multiplier + x;
374  return 1;
375 }
EXTENSION_NOINLINE int32_t ct_binding_udtf__cpu_12(const Column< int32_t > &input1, const Column< int32_t > &input2, const int32_t multiplier, Column< int32_t > &out)
EXTENSION_NOINLINE int32_t ct_binding_udtf3__cpu_25(const Column< int32_t > &input1, const int32_t input2, const int32_t multiplier, Column< int32_t > &out)
EXTENSION_NOINLINE int32_t ct_binding_udtf__cpu_13(const Column< int32_t > &input1, const Column< int32_t > &input2, const Column< int32_t > &input3, const int32_t multiplier, Column< int32_t > &out)
EXTENSION_NOINLINE int32_t ct_binding_udtf2__cpu_21(const int32_t multiplier, const Column< int32_t > &input1, Column< int32_t > &out)
EXTENSION_NOINLINE int32_t ct_udtf_default_sizer4b__cpu_2(const int32_t multiplier, const Column< int32_t > &input, const int32_t x, Column< int32_t > &out)
EXTENSION_NOINLINE int32_t ct_udtf_default_sizer2b__cpu_2(const Column< int32_t > &input1, const int32_t multiplier, const Column< int32_t > &input2, Column< int32_t > &out)
EXTENSION_NOINLINE int32_t ct_udtf_default_sizer3a__cpu_1(const Column< int32_t > &input1, const int32_t multiplier, const int32_t x, Column< int32_t > &out)
EXTENSION_NOINLINE int32_t ct_binding_udtf_constant__cpu_3(const Column< int32_t > &input1, const Column< int32_t > &input2, const Column< int32_t > &input3, Column< int32_t > &out)
EXTENSION_NOINLINE int32_t ct_binding_udtf_constant__cpu_9(const ColumnList< int32_t > &input1, const ColumnList< int64_t > &input2, Column< int32_t > &out)
EXTENSION_NOINLINE int32_t ct_udtf_default_sizer2c__cpu_3(const int32_t x, const int32_t multiplier, const Column< int32_t > &input1, Column< int32_t > &out)
EXTENSION_NOINLINE int32_t ct_udtf_default_sizer2a__cpu_1(const Column< int32_t > &input1, const int32_t x, const int32_t multiplier, Column< int32_t > &out)
EXTENSION_NOINLINE int32_t ct_binding_udtf__cpu_11(const Column< int32_t > &input1, const int32_t multiplier, Column< int32_t > &out)
EXTENSION_NOINLINE int32_t ct_binding_udtf_constant__cpu_7(const Column< int32_t > &input1, const ColumnList< int32_t > &input2, Column< int32_t > &out)
EXTENSION_NOINLINE int32_t ct_binding_udtf__cpu_15(const Column< int64_t > &input1, const Column< int64_t > &input2, const Column< int32_t > &input3, const int32_t multiplier, Column< int32_t > &out)
EXTENSION_NOINLINE int32_t ct_binding_udtf5__cpu_24(const ColumnList< int32_t > &input1, const int32_t input2, const int32_t multiplier, Column< int32_t > &out)
EXTENSION_NOINLINE int32_t ct_binding_udtf_constant__cpu_6(const Column< int64_t > &input1, const Column< int32_t > &input2, const Column< int64_t > &input3, Column< int32_t > &out)
EXTENSION_NOINLINE int32_t ct_binding_udtf__cpu_17(const Column< int32_t > &input1, const ColumnList< int32_t > &input2, const int32_t multiplier, Column< int32_t > &out)
#define CPU_DEVICE_CODE
#define EXTENSION_NOINLINE
Definition: OmniSciTypes.h:27
EXTENSION_NOINLINE int32_t ct_binding_udtf__cpu_16(const Column< int64_t > &input1, const Column< int32_t > &input2, const Column< int64_t > &input3, const int32_t multiplier, Column< int32_t > &out)
EXTENSION_NOINLINE int32_t ct_binding_udtf_constant__cpu_4(const Column< int64_t > &input1, const Column< int32_t > &input2, const Column< int32_t > &input3, Column< int32_t > &out)
EXTENSION_NOINLINE int32_t ct_binding_udtf__cpu_20(const Column< int64_t > &input1, const ColumnList< int64_t > &input2, const Column< int64_t > &input3, const int32_t multiplier, Column< int64_t > &out)
#define GPU_DEVICE_CODE
EXTENSION_NOINLINE int32_t ct_binding_udtf__cpu_18(const ColumnList< int32_t > &input1, const Column< int64_t > &input2, const int32_t multiplier, Column< int32_t > &out)
EXTENSION_NOINLINE int32_t ct_binding_udtf4__cpu_23(const ColumnList< int32_t > &input1, const int32_t multiplier, const int32_t input2, Column< int32_t > &out)
EXTENSION_NOINLINE int32_t ct_binding_udtf_constant__cpu_10(const Column< int64_t > &input1, const ColumnList< int64_t > &input2, const Column< int64_t > &input3, Column< int64_t > &out)
EXTENSION_NOINLINE int32_t ct_device_selection_udtf_cpu__cpu_(const Column< int32_t > &input, Column< int64_t > &out)
EXTENSION_NOINLINE int32_t ct_udtf_default_sizer1a__cpu_1(const Column< int32_t > &input1, const int32_t multiplier, Column< int32_t > &out)
EXTENSION_NOINLINE int32_t ct_binding_udtf_constant__cpu_5(const Column< int64_t > &input1, const Column< int64_t > &input2, const Column< int32_t > &input3, Column< int32_t > &out)
EXTENSION_NOINLINE int32_t ct_binding_udtf_constant__cpu_1(const Column< int32_t > &input1, Column< int32_t > &out)
EXTENSION_NOINLINE int32_t ct_udtf_default_sizer3b__cpu_2(const Column< int32_t > &input1, const int32_t x, const Column< int32_t > &input2, const int32_t multiplier, Column< int32_t > &out)
EXTENSION_NOINLINE int32_t ct_binding_udtf6__cpu_22(const Column< int32_t > &input1, const int32_t multiplier, const int32_t input2, Column< int32_t > &out)
EXTENSION_NOINLINE int32_t ct_udtf_default_sizer4a__cpu_1(const Column< int32_t > &input1, const int32_t multiplier, const Column< int32_t > &input2, const int32_t x, Column< int32_t > &out)
EXTENSION_NOINLINE int32_t ct_binding_udtf_constant__cpu_2(const Column< int32_t > &input1, const Column< int32_t > &input2, Column< int32_t > &out)
EXTENSION_NOINLINE int32_t ct_device_selection_udtf_both__cpu_(const Column< int32_t > &input, Column< int64_t > &out)
EXTENSION_NOINLINE int32_t ct_device_selection_udtf_any(const Column< int32_t > &input, Column< int64_t > &out)
EXTENSION_NOINLINE int32_t ct_udtf_default_sizer1d__cpu_4(const int32_t multiplier, const int32_t x, const Column< int32_t > &input1, Column< int32_t > &out)
EXTENSION_NOINLINE int32_t ct_udtf_default_sizer1b__cpu_2(const Column< int32_t > &input1, const Column< int32_t > &input2, const int32_t multiplier, Column< int32_t > &out)
EXTENSION_NOINLINE int32_t ct_binding_udtf__cpu_14(const Column< int64_t > &input1, const Column< int32_t > &input2, const Column< int32_t > &input3, const int32_t multiplier, Column< int32_t > &out)
EXTENSION_NOINLINE int32_t ct_binding_udtf__cpu_19(const ColumnList< int32_t > &input1, const ColumnList< int64_t > &input2, const int32_t multiplier, Column< int32_t > &out)
EXTENSION_NOINLINE int32_t ct_device_selection_udtf_both__gpu_(const Column< int32_t > &input, Column< int64_t > &out)
EXTENSION_NOINLINE int32_t ct_binding_udtf_constant__cpu_8(const ColumnList< int32_t > &input1, const Column< int64_t > &input2, Column< int32_t > &out)
EXTENSION_NOINLINE int32_t ct_device_selection_udtf_gpu__gpu_(const Column< int32_t > &input, Column< int64_t > &out)
EXTENSION_NOINLINE int32_t ct_udtf_default_sizer1c__cpu_3(const Column< int32_t > &input1, const Column< int32_t > &input2, const Column< int32_t > &input3, const int32_t multiplier, const Column< int32_t > &input4, const int32_t x, Column< int32_t > &out)