1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-30 19:23:07 +03:00

MCOL-4839: Fix clang build (#2100)

* Fix clang build

* Extern C returned to plugin_instance

Co-authored-by: Leonid Fedorov <l.fedorov@mail.corp.ru>
This commit is contained in:
Leonid Fedorov
2021-08-23 18:45:10 +03:00
committed by GitHub
parent 923bbf4033
commit 5c5f103f98
59 changed files with 422 additions and 600 deletions

View File

@ -21,6 +21,11 @@
using namespace idbdatafile;
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wreturn-type-c-linkage"
#endif
extern "C"
{
FileFactoryEnt plugin_instance()
@ -28,3 +33,7 @@ extern "C"
return FileFactoryEnt(IDBDataFile::CLOUD, "cloud", new SMFileFactory(), new SMFileSystem());
}
}
#ifdef __clang__
#pragma clang diagnostic pop
#endif

View File

@ -31,6 +31,7 @@
#include <list>
#include <stdint.h>
#include <limits>
#include <memory>
#undef min
#undef max
@ -102,7 +103,7 @@ public:
};
SimpleAllocator() throw() {}
SimpleAllocator(boost::shared_ptr<SimplePool> pool) throw()
SimpleAllocator(std::shared_ptr<SimplePool> pool) throw()
{
fPool = pool;
}
@ -158,10 +159,10 @@ public:
inline void setPool(SimplePool* pool)
{
fPool = pool;
fPool.reset(pool);
}
boost::shared_ptr<SimplePool> fPool;
std::shared_ptr<SimplePool> fPool;
};

View File

@ -45,32 +45,16 @@ using namespace std;
namespace
{
const uint64_t MAGIC_NUMBER = 0xfdc119a384d0778eULL;
const uint64_t VERSION_NUM1 = 1;
const uint64_t VERSION_NUM2 = 2;
const uint64_t VERSION_NUM3 = 3;
const int PTR_SECTION_OFFSET = compress::CompressInterface::HDR_BUF_LEN;
// version 1.1 of the chunk data has a short header
// QuickLZ compressed data never has the high bit set on the first byte
const uint8_t CHUNK_MAGIC1 = 0xff;
const int SIG_OFFSET = 0;
const int CHECKSUM_OFFSET = 1;
const int LEN_OFFSET = 5;
const unsigned HEADER_SIZE = 9;
/* version 1.2 of the chunk data changes the hash function used to calculate
* checksums. We can no longer use the algorithm used in ver 1.1. Everything
* else is the same
*/
const uint8_t CHUNK_MAGIC2 = 0xfe;
/* version 2.0 of the chunk data uses a new compression algo. For us, because of
* the finite number of block sizes we compress, the first byte of the compressed
* data will always be 0x80, so it can't be confused with V1.0 data (that has no
* header).
*/
const uint8_t CHUNK_MAGIC3 = 0xfd;
// The max number of lbids to be stored in segment file.
const uint32_t LBID_MAX_SIZE = 10;

View File

@ -1378,7 +1378,7 @@ DataConvert::StringToUDecimal(const datatypes::SystemCatalog::TypeAttributesStd&
const std::string& data, bool& pushWarning)
{
const cscDataType typeCode= datatypes::SystemCatalog::UDECIMAL;
// UDECIMAL numbers may not be negative
if (LIKELY(colType.colWidth == 16))
{
@ -1532,8 +1532,8 @@ DataConvert::StringToFloat(cscDataType typeCode,
if (floatvalue < 0.0 &&
typeCode == datatypes::SystemCatalog::UFLOAT &&
floatvalue != joblist::FLOATEMPTYROW &&
floatvalue != joblist::FLOATNULL)
floatvalue != static_cast<float>(joblist::FLOATEMPTYROW) &&
floatvalue != static_cast<float>(joblist::FLOATNULL))
{
value = 0.0; // QQ: should it assign floatvalue?
pushWarning = true;
@ -1595,8 +1595,8 @@ DataConvert::StringToDouble(cscDataType typeCode,
if (doublevalue < 0.0 &&
typeCode == datatypes::SystemCatalog::UDOUBLE &&
doublevalue != joblist::DOUBLEEMPTYROW &&
doublevalue != joblist::DOUBLENULL)
doublevalue != static_cast<double>(joblist::DOUBLEEMPTYROW) &&
doublevalue != static_cast<double>(joblist::DOUBLENULL))
{
doublevalue = 0.0; // QQ: should it assign "value" ?
pushWarning = true;

View File

@ -362,7 +362,7 @@ bool timeZoneToOffset(const char *str, std::string::size_type length, long *offs
return 1;
*offset = offset_tmp;
return 0;
}
@ -1111,11 +1111,11 @@ struct Time
signed is_neg : 1;
// NULL column value = 0xFFFFFFFFFFFFFFFE
Time() : msecond (0xFFFFFE),
second (0xFF),
minute (0xFF),
hour (0xFFF),
day (0x7FF),
Time() : msecond (-2),
second (-1),
minute (-1),
hour (-1),
day (-1),
is_neg (0b1)
{}
@ -1143,12 +1143,12 @@ struct Time
inline
void Time::reset()
{
msecond = 0xFFFFFE;
second = 0xFF;
minute = 0xFF;
hour = 0xFFF;
msecond = -2;
second = -1;
minute = -1;
hour = -1;
is_neg = 0b1;
day = 0x7FF;
day = -1;
}
inline
@ -1706,13 +1706,13 @@ inline int128_t strtoll128(const char* data, bool& saturate, char** ep)
if (*data == '\0')
{
if (ep)
if (ep)
*ep = (char*)data;
return res;
}
// skip leading whitespace characters
while (*data != '\0' &&
while (*data != '\0' &&
(*data == ' ' || *data == '\t' || *data == '\n'))
data++;

View File

@ -128,7 +128,7 @@ long long dateGet( uint64_t time, IntervalColumn::interval_type unit, bool dateT
return (sec * 1000000) + msec;
default:
throw runtime_error("unit type is not supported: " + unit);
throw runtime_error(std::string("unit type is not supported: ") + std::to_string(unit));
};
}
@ -215,13 +215,11 @@ long long timeGet( uint64_t time, IntervalColumn::interval_type unit )
return (sec * 1000000) + msec;
default:
throw runtime_error("unit type is not supported: " + unit);
};
throw runtime_error(std::string("unit type is not supported: ") + std::to_string(unit));
}; };
}
}
namespace funcexp
{

View File

@ -369,7 +369,7 @@ public:
uint64_t getUintVal(rowgroup::Row& row,
FunctionParm& fp,
bool& isNull,
execplan::CalpontSystemCatalog::ColType& op_ct);
execplan::CalpontSystemCatalog::ColType& op_ct) override;
};

View File

@ -155,14 +155,12 @@ private:
config::Config* fConfig; /// config file ptr
};
}//namespace logging
namespace std
{
template<> inline void swap<logging::Message>(logging::Message& lhs, logging::Message& rhs)
inline void swap(logging::Message& lhs, logging::Message& rhs)
{
lhs.swap(rhs);
}
}//namespace std
}//namespace logging
#endif

View File

@ -51,68 +51,6 @@ inline double cvtArgToDouble(int t, const char* v)
return d;
}
inline long long cvtArgToInt(int t, const char* v)
{
long long ll = 0;
switch (t)
{
case INT_RESULT:
ll = *((long long*)v);
break;
case REAL_RESULT:
ll = (long long)(*((double*)v));
break;
case DECIMAL_RESULT:
case STRING_RESULT:
ll = strtoll(v, 0, 0);
break;
case ROW_RESULT:
break;
}
return ll;
}
inline string cvtArgToString(int t, const char* v)
{
string str;
switch (t)
{
case INT_RESULT:
{
long long ll;
ll = *((long long*)v);
ostringstream oss;
oss << ll;
str = oss.str();
break;
}
case REAL_RESULT:
{
double d;
d = *((double*)v);
ostringstream oss;
oss << d;
str = oss.str();
break;
}
case DECIMAL_RESULT:
case STRING_RESULT:
str = v;
break;
case ROW_RESULT:
break;
}
return str;
}
}
/****************************************************************************
@ -143,14 +81,14 @@ extern "C"
//=======================================================================
/**
* regr_avgx
* regr_avgx
*/
struct regr_avgx_data
{
long double sumx;
int64_t cnt;
};
#ifdef _MSC_VER
__declspec(dllexport)
#endif
@ -171,7 +109,7 @@ extern "C"
{
initid->decimals += 4;
}
if (!(data = (struct regr_avgx_data*) malloc(sizeof(struct regr_avgx_data))))
{
strmov(message,"Couldn't allocate memory");
@ -190,7 +128,7 @@ extern "C"
void regr_avgx_deinit(UDF_INIT* initid)
{
free(initid->ptr);
}
}
#ifdef _MSC_VER
__declspec(dllexport)
@ -239,21 +177,21 @@ extern "C"
{
*is_null = 1;
}
return valOut;
}
//=======================================================================
/**
* regr_avgy
* regr_avgy
*/
struct regr_avgy_data
{
long double sumy;
int64_t cnt;
};
#ifdef _MSC_VER
__declspec(dllexport)
#endif
@ -275,7 +213,7 @@ extern "C"
{
initid->decimals += 4;
}
if (!(data = (struct regr_avgy_data*) malloc(sizeof(struct regr_avgy_data))))
{
strmov(message,"Couldn't allocate memory");
@ -294,7 +232,7 @@ extern "C"
void regr_avgy_deinit(UDF_INIT* initid)
{
free(initid->ptr);
}
}
#ifdef _MSC_VER
__declspec(dllexport)
@ -349,13 +287,13 @@ extern "C"
//=======================================================================
/**
* regr_count
* regr_count
*/
struct regr_count_data
{
int64_t cnt;
};
#ifdef _MSC_VER
__declspec(dllexport)
#endif
@ -385,7 +323,7 @@ extern "C"
void regr_count_deinit(UDF_INIT* initid)
{
free(initid->ptr);
}
}
#ifdef _MSC_VER
__declspec(dllexport)
@ -428,7 +366,7 @@ extern "C"
//=======================================================================
/**
* regr_slope
* regr_slope
*/
struct regr_slope_data
{
@ -438,7 +376,7 @@ extern "C"
long double sumy;
long double sumxy; // sum of (x*y)
};
#ifdef _MSC_VER
__declspec(dllexport)
#endif
@ -457,7 +395,7 @@ extern "C"
}
initid->decimals = DECIMAL_NOT_SPECIFIED;
if (!(data = (struct regr_slope_data*) malloc(sizeof(struct regr_slope_data))))
{
strmov(message,"Couldn't allocate memory");
@ -479,7 +417,7 @@ extern "C"
void regr_slope_deinit(UDF_INIT* initid)
{
free(initid->ptr);
}
}
#ifdef _MSC_VER
__declspec(dllexport)
@ -549,7 +487,7 @@ extern "C"
//=======================================================================
/**
* regr_intercept
* regr_intercept
*/
struct regr_intercept_data
{
@ -559,7 +497,7 @@ extern "C"
long double sumy;
long double sumxy; // sum of (x*y)
};
#ifdef _MSC_VER
__declspec(dllexport)
#endif
@ -599,7 +537,7 @@ extern "C"
void regr_intercept_deinit(UDF_INIT* initid)
{
free(initid->ptr);
}
}
#ifdef _MSC_VER
__declspec(dllexport)
@ -680,7 +618,7 @@ extern "C"
long double sumy2; // sum of (y squared)
long double sumxy; // sum of (x*y)
};
#ifdef _MSC_VER
__declspec(dllexport)
#endif
@ -722,7 +660,7 @@ extern "C"
void regr_r2_deinit(UDF_INIT* initid)
{
free(initid->ptr);
}
}
#ifdef _MSC_VER
__declspec(dllexport)
@ -820,7 +758,7 @@ extern "C"
long double sumy2; // sum of (y squared)
long double sumxy; // sum of (x*y)
};
#ifdef _MSC_VER
__declspec(dllexport)
#endif
@ -839,7 +777,7 @@ extern "C"
}
initid->decimals = DECIMAL_NOT_SPECIFIED;
if (!(data = (struct corr_data*) malloc(sizeof(struct corr_data))))
{
strmov(message,"Couldn't allocate memory");
@ -862,7 +800,7 @@ extern "C"
void corr_deinit(UDF_INIT* initid)
{
free(initid->ptr);
}
}
#ifdef _MSC_VER
__declspec(dllexport)
@ -957,7 +895,7 @@ extern "C"
long double sumx;
long double sumx2; // sum of (x squared)
};
#ifdef _MSC_VER
__declspec(dllexport)
#endif
@ -996,7 +934,7 @@ extern "C"
void regr_sxx_deinit(UDF_INIT* initid)
{
free(initid->ptr);
}
}
#ifdef _MSC_VER
__declspec(dllexport)
@ -1066,7 +1004,7 @@ extern "C"
long double sumy;
long double sumy2; // sum of (y squared)
};
#ifdef _MSC_VER
__declspec(dllexport)
#endif
@ -1085,7 +1023,7 @@ extern "C"
}
initid->decimals = DECIMAL_NOT_SPECIFIED;
if (!(data = (struct regr_syy_data*) malloc(sizeof(struct regr_syy_data))))
{
strmov(message,"Couldn't allocate memory");
@ -1105,7 +1043,7 @@ extern "C"
void regr_syy_deinit(UDF_INIT* initid)
{
free(initid->ptr);
}
}
#ifdef _MSC_VER
__declspec(dllexport)
@ -1177,7 +1115,7 @@ extern "C"
long double sumy;
long double sumxy; // sum of (x*y)
};
#ifdef _MSC_VER
__declspec(dllexport)
#endif
@ -1196,7 +1134,7 @@ extern "C"
}
initid->decimals = DECIMAL_NOT_SPECIFIED;
if (!(data = (struct regr_sxy_data*) malloc(sizeof(struct regr_sxy_data))))
{
strmov(message,"Couldn't allocate memory");
@ -1217,7 +1155,7 @@ extern "C"
void regr_sxy_deinit(UDF_INIT* initid)
{
free(initid->ptr);
}
}
#ifdef _MSC_VER
__declspec(dllexport)
@ -1291,7 +1229,7 @@ extern "C"
long double sumy;
long double sumxy; // sum of (x*y)
};
#ifdef _MSC_VER
__declspec(dllexport)
#endif
@ -1310,7 +1248,7 @@ extern "C"
}
initid->decimals = DECIMAL_NOT_SPECIFIED;
if (!(data = (struct covar_pop_data*) malloc(sizeof(struct covar_pop_data))))
{
strmov(message,"Couldn't allocate memory");
@ -1331,7 +1269,7 @@ extern "C"
void covar_pop_deinit(UDF_INIT* initid)
{
free(initid->ptr);
}
}
#ifdef _MSC_VER
__declspec(dllexport)
@ -1404,7 +1342,7 @@ extern "C"
long double sumy;
long double sumxy; // sum of (x*y)
};
#ifdef _MSC_VER
__declspec(dllexport)
#endif
@ -1423,7 +1361,7 @@ extern "C"
}
initid->decimals = DECIMAL_NOT_SPECIFIED;
if (!(data = (struct covar_samp_data*) malloc(sizeof(struct covar_samp_data))))
{
strmov(message,"Couldn't allocate memory");
@ -1444,7 +1382,7 @@ extern "C"
void covar_samp_deinit(UDF_INIT* initid)
{
free(initid->ptr);
}
}
#ifdef _MSC_VER
__declspec(dllexport)

View File

@ -18,6 +18,7 @@
#ifndef ROWSTORAGE_H
#define ROWSTORAGE_H
#include "resourcemanager.h"
#include "rowgroup.h"
#include <sys/stat.h>
#include <unistd.h>

View File

@ -33,68 +33,6 @@ inline double cvtArgToDouble(int t, const char* v)
return d;
}
inline long long cvtArgToInt(int t, const char* v)
{
long long ll = 0;
switch (t)
{
case INT_RESULT:
ll = *((long long*)v);
break;
case REAL_RESULT:
ll = (long long)(*((double*)v));
break;
case DECIMAL_RESULT:
case STRING_RESULT:
ll = strtoll(v, 0, 0);
break;
case ROW_RESULT:
break;
}
return ll;
}
inline string cvtArgToString(int t, const char* v)
{
string str;
switch (t)
{
case INT_RESULT:
{
long long ll;
ll = *((long long*)v);
ostringstream oss;
oss << ll;
str = oss.str();
break;
}
case REAL_RESULT:
{
double d;
d = *((double*)v);
ostringstream oss;
oss << d;
str = oss.str();
break;
}
case DECIMAL_RESULT:
case STRING_RESULT:
str = v;
break;
case ROW_RESULT:
break;
}
return str;
}
}
/****************************************************************************
@ -494,16 +432,16 @@ extern "C"
//=======================================================================
/**
* avgx connector stub. Exactly the same functionality as the
* built in avg() function. Use to test the performance of the
* API
* avgx connector stub. Exactly the same functionality as the
* built in avg() function. Use to test the performance of the
* API
*/
struct avgx_data
{
double sumx;
int64_t cnt;
};
#ifdef _MSC_VER
__declspec(dllexport)
#endif
@ -534,7 +472,7 @@ extern "C"
void avgx_deinit(UDF_INIT* initid)
{
free(initid->ptr);
}
}
#ifdef _MSC_VER
__declspec(dllexport)
@ -596,7 +534,7 @@ extern "C"
void distinct_count_deinit(UDF_INIT* initid)
{
// free(initid->ptr);
}
}
#ifdef _MSC_VER
__declspec(dllexport)

View File

@ -1194,9 +1194,6 @@ void WF_udaf::operator()(int64_t b, int64_t e, int64_t c)
fPrev = c;
}
boost::shared_ptr<WindowFunctionType> WF_udaf::makeFunction(int id, const string& name, int ct, mcsv1sdk::mcsv1Context& context, WindowFunctionColumn*);
} //namespace
// vim:ts=4 sw=4:

View File

@ -70,14 +70,17 @@ public:
{
return fUDAFContext;
}
bool getInterrupted()
{
return bInterrupted;
}
bool * getInterruptedPtr()
{
return &bInterrupted;
}
bool getDistinct()
{
return fDistinct;