OmniSciDB  95562058bd
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
TableFunctions.hpp
Go to the documentation of this file.
1 /*
2  * Copyright 2019 OmniSci, 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 #include "../../QueryEngine/OmniSciTypes.h"
18 #include "../../Shared/funcannotations.h"
19 
20 #define EXTENSION_INLINE extern "C" ALWAYS_INLINE DEVICE
21 #define EXTENSION_NOINLINE extern "C" NEVER_INLINE DEVICE
22 
24  int copy_multiplier,
25  Column<double> output_col) {
26  int32_t output_row_count = copy_multiplier * input_col.sz;
27  if (output_row_count > 100) {
28  // Test failure propagation.
29  return -1;
30  }
31  // Set the output columne size for consistency. The output column
32  // size will be effective only here, it will not propagate back to
33  // the caller because the output_col is passed in by value.
34  output_col.sz = output_row_count;
35 
36 #ifdef __CUDACC__
37  int32_t start = threadIdx.x + blockDim.x * blockIdx.x;
38  int32_t stop = static_cast<int32_t>(input_col.sz);
39  int32_t step = blockDim.x * gridDim.x;
40 #else
41  auto start = 0;
42  auto stop = input_col.sz;
43  auto step = 1;
44 #endif
45 
46  for (auto i = start; i < stop; i += step) {
47  for (int c = 0; c < copy_multiplier; c++) {
48  output_col.ptr[i + (c * input_col.sz)] = input_col.ptr[i];
49  }
50  }
51 
52  return output_row_count;
53 }
EXTENSION_NOINLINE int32_t row_copier(Column< double > input_col, int copy_multiplier, Column< double > output_col)
int64_t sz
Definition: OmniSciTypes.h:149
#define EXTENSION_NOINLINE