1 /* Copyright (C) 2017 MariaDB Corporation 2 3 This program is free software; you can redistribute it and/or 4 modify it under the terms of the GNU General Public License 5 as published by the Free Software Foundation; version 2 of 6 the License. 7 8 This program is distributed in the hope that it will be useful, 9 but WITHOUT ANY WARRANTY; without even the implied warranty of 10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 GNU General Public License for more details. 12 13 You should have received a copy of the GNU General Public License 14 along with this program; if not, write to the Free Software 15 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 16 MA 02110-1301, USA. */ 17 18 /*********************************************************************** 19 * $Id$ 20 * 21 * regr_sxx.h 22 ***********************************************************************/ 23 24 /** 25 * Columnstore interface for for the regr_sxx function 26 * 27 * 28 * CREATE AGGREGATE FUNCTION regr_sxx returns REAL soname 'libregr_mysql.so'; 29 * 30 */ 31 #ifndef HEADER_regr_sxx 32 #define HEADER_regr_sxx 33 34 #include <cstdlib> 35 #include <string> 36 #include <vector> 37 #ifdef _MSC_VER 38 #include <unordered_map> 39 #else 40 #include <tr1/unordered_map> 41 #endif 42 43 #include "mcsv1_udaf.h" 44 #include "calpontsystemcatalog.h" 45 #include "windowfunctioncolumn.h" 46 47 #if defined(_MSC_VER) && defined(xxxRGNODE_DLLEXPORT) 48 #define EXPORT __declspec(dllexport) 49 #else 50 #define EXPORT 51 #endif 52 53 namespace mcsv1sdk 54 { 55 56 // Return the regr_sxx value of the dataset 57 58 class regr_sxx : public mcsv1_UDAF 59 { 60 public: 61 // Defaults OK regr_sxx()62 regr_sxx() : mcsv1_UDAF() {}; ~regr_sxx()63 virtual ~regr_sxx() {}; 64 65 virtual ReturnCode init(mcsv1Context* context, 66 ColumnDatum* colTypes); 67 68 virtual ReturnCode reset(mcsv1Context* context); 69 70 virtual ReturnCode nextValue(mcsv1Context* context, ColumnDatum* valsIn); 71 72 virtual ReturnCode subEvaluate(mcsv1Context* context, const UserData* valIn); 73 74 virtual ReturnCode evaluate(mcsv1Context* context, static_any::any& valOut); 75 76 virtual ReturnCode dropValue(mcsv1Context* context, ColumnDatum* valsDropped); 77 78 protected: 79 }; 80 81 }; // namespace 82 83 #undef EXPORT 84 85 #endif // HEADER_regr_sxx.h 86 87