OmniSciDB  2e3a973ef4
ExtensionFunctionsArray.hpp
Go to the documentation of this file.
1 #include <cassert>
2 
3 #ifndef __CUDACC__
4 
5 namespace {
6 
7 template <typename T>
9  Array<T> out_arr(in_arr.getSize() + 1);
10  for (int64_t i = 0; i < in_arr.getSize(); i++) {
11  out_arr[i] = in_arr(i);
12  }
13  out_arr[in_arr.getSize()] = val;
14  return out_arr;
15 }
16 
17 } // namespace
18 
19 #endif
20 
22  const int64_t val) {
23 #ifndef __CUDACC__
24  return array_append_impl(in_arr, val);
25 #else
26  assert(false);
27  return Array<int64_t>(0, true);
28 #endif
29 }
30 
32  const int32_t val) {
33 #ifndef __CUDACC__
34  return array_append_impl(in_arr, val);
35 #else
36  assert(false);
37  return Array<int32_t>(0, true);
38 #endif
39 }
40 
42  const int16_t val) {
43 #ifndef __CUDACC__
44  return array_append_impl(in_arr, val);
45 #else
46  assert(false);
47  return Array<int16_t>(0, true);
48 #endif
49 }
50 
52  const int8_t val) {
53 #ifndef __CUDACC__
54  return array_append_impl(in_arr, val);
55 #else
56  assert(false);
57  return Array<int8_t>(0, true);
58 #endif
59 }
60 
62  const double val) {
63 #ifndef __CUDACC__
64  return array_append_impl(in_arr, val);
65 #else
66  assert(false);
67  return Array<double>(0, true);
68 #endif
69 }
70 
72  const float val) {
73 #ifndef __CUDACC__
74  return array_append_impl(in_arr, val);
75 #else
76  assert(false);
77  return Array<float>(0, true);
78 #endif
79 }
80 
81 /*
82  Overloading UDFs works for types in the same SQL family. BOOLEAN
83  does not belong to NUMERIC family, hence we need to use different
84  name for boolean UDF.
85  */
87 #ifndef __CUDACC__
88  return array_append_impl(in_arr, val);
89 #else
90  assert(false);
91  return Array<bool>(0, true);
92 #endif
93 }
EXTENSION_NOINLINE Array< bool > barray_append(const Array< bool > in_arr, const bool val)
EXTENSION_NOINLINE Array< int16_t > array_append__1(const Array< int16_t > in_arr, const int16_t val)
DEVICE int64_t getSize() const
Definition: OmniSciTypes.h:56
#define DEVICE
#define EXTENSION_NOINLINE
Definition: OmniSciTypes.h:25
EXTENSION_NOINLINE Array< float > array_append__4(const Array< float > in_arr, const float val)
EXTENSION_NOINLINE Array< int32_t > array_append__(const Array< int32_t > in_arr, const int32_t val)
EXTENSION_NOINLINE Array< double > array_append__3(const Array< double > in_arr, const double val)
EXTENSION_NOINLINE Array< int64_t > array_append(const Array< int64_t > in_arr, const int64_t val)
EXTENSION_NOINLINE Array< int8_t > array_append__2(const Array< int8_t > in_arr, const int8_t val)
DEVICE ALWAYS_INLINE Array< T > array_append_impl(const Array< T > in_arr, T val)
#define ALWAYS_INLINE