github.com/rohankumardubey/aresdb@v0.0.2-0.20190517170215-e54e3ca06b9c/query/measure_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>::transformMeasureOutput( 22 MeasureOutputVector output) { 23 switch (output.DataType) { 24 #define BIND_MEASURE_OUTPUT(dataType) \ 25 return transform( \ 26 ares::make_measure_output_iterator( \ 27 reinterpret_cast<dataType *>(output.Values), \ 28 indexVector, baseCounts, \ 29 output.AggFunc)); 30 31 case Int32:BIND_MEASURE_OUTPUT(int32_t) 32 case Uint32:BIND_MEASURE_OUTPUT(uint32_t) 33 case Float32:BIND_MEASURE_OUTPUT(float_t) 34 case Int64:BIND_MEASURE_OUTPUT(int64_t) 35 case Float64:BIND_MEASURE_OUTPUT(double_t) 36 default:throw 37 std::invalid_argument( 38 "Unsupported data type for MeasureOutput"); 39 } 40 } 41 42 // explicit instantiations. 43 template int OutputVectorBinder<1, 44 UnaryFunctorType>::transformMeasureOutput( 45 MeasureOutputVector output); 46 47 template int OutputVectorBinder<2, 48 BinaryFunctorType>::transformMeasureOutput( 49 MeasureOutputVector output); 50 51 } // namespace ares