github.com/rohankumardubey/aresdb@v0.0.2-0.20190517170215-e54e3ca06b9c/query/scratch_space_transform.cu (about) 1 // Copyright (c) 2017-2018 Uber Technologies, Inc. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 #include <algorithm> 16 #include "query/transform.hpp" 17 18 namespace ares { 19 20 template<int NInput, typename FunctorType> 21 int OutputVectorBinder<NInput, FunctorType>::transformScratchSpaceOutput( 22 ScratchSpaceVector output) { 23 switch (output.DataType) { 24 #define BIND_SCRATCH__SPACE_OUTPUT(dataType) \ 25 return transform(ares::make_scratch_space_output_iterator( \ 26 reinterpret_cast<dataType *>(output.Values), \ 27 output.NullsOffset)); 28 29 case Int32:BIND_SCRATCH__SPACE_OUTPUT(int32_t) 30 case Uint32:BIND_SCRATCH__SPACE_OUTPUT(uint32_t) 31 case Float32:BIND_SCRATCH__SPACE_OUTPUT(float_t) 32 default:throw 33 std::invalid_argument( 34 "Unsupported data type for ScratchSpaceOutput"); 35 } 36 } 37 38 // explicit instantiations. 39 template int OutputVectorBinder<1, 40 UnaryFunctorType>::transformScratchSpaceOutput( 41 ScratchSpaceVector output); 42 43 template int OutputVectorBinder<2, 44 BinaryFunctorType>::transformScratchSpaceOutput( 45 ScratchSpaceVector output); 46 47 } // namespace ares