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

@ -62,6 +62,14 @@ using namespace cacheutils;
#include "IDBPolicy.h"
using namespace idbdatafile;
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wpotentially-evaluated-expression"
// for warnings on typeid :expression with side effects will be evaluated despite being used as an operand to 'typeid'
#endif
//TODO: this should be in a common header somewhere
struct extentInfo
{
@ -2504,3 +2512,6 @@ void AlterTableProcessor::renameColumn(uint32_t sessionID, execplan::CalpontSyst
}
// vim:ts=4 sw=4:
#ifdef __clang__
#pragma clang diagnostic pop
#endif

View File

@ -414,7 +414,6 @@ string CalpontSelectExecutionPlan::queryTypeToString(const uint32_t queryType)
void CalpontSelectExecutionPlan::serialize(messageqcpp::ByteStream& b) const
{
ReturnedColumnList::const_iterator rcit;
vector<ReturnedColumn*>::const_iterator it;
ColumnMap::const_iterator mapiter;
TableList::const_iterator tit;
@ -727,7 +726,6 @@ bool CalpontSelectExecutionPlan::operator==(const CalpontSelectExecutionPlan& t)
ReturnedColumnList::const_iterator rcit;
ReturnedColumnList::const_iterator rcit2;
vector<ReturnedColumn*>::const_iterator it, it2;
SelectList::const_iterator sit, sit2;
ColumnMap::const_iterator map_it, map_it2;

View File

@ -279,7 +279,6 @@ void FunctionColumn::unserialize(messageqcpp::ByteStream& b)
uint32_t size, i;
//SRCP rc;
SPTP pt;
FunctionParm::iterator it;
fFunctionParms.erase(fFunctionParms.begin(), fFunctionParms.end());
fSimpleColumnList.clear();

View File

@ -87,6 +87,14 @@ using namespace logging;
#include "jlf_tuplejoblist.h"
#include "mcs_decimal.h"
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wpotentially-evaluated-expression"
// for warnings on typeid :expression with side effects will be evaluated despite being used as an operand to 'typeid'
#endif
namespace
{
using namespace joblist;
@ -3558,3 +3566,6 @@ void JLF_ExecPlanToJobList::addJobSteps(JobStepVector& nsv, JobInfo& jobInfo, bo
} // end of joblist namespace
// vim:ts=4 sw=4:
#ifdef __clang__
#pragma clang diagnostic pop
#endif

View File

@ -35,6 +35,14 @@ using namespace joblist;
#include "jlf_graphics.h"
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wpotentially-evaluated-expression"
// for warnings on typeid :expression with side effects will be evaluated despite being used as an operand to 'typeid'
#endif
namespace jlf_graphics
{
@ -411,3 +419,6 @@ ostream& writeDotCmds(ostream& dotFile, const JobStepVector& query, const JobSte
// vim:ts=4 sw=4 syntax=cpp:
#ifdef __clang__
#pragma clang diagnostic pop
#endif

View File

@ -73,6 +73,14 @@ using namespace joblist;
#include "statistics.h"
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wpotentially-evaluated-expression"
// for warnings on typeid :expression with side effects will be evaluated despite being used as an operand to 'typeid'
#endif
namespace
{
@ -189,7 +197,7 @@ inline void addColumnInExpToRG(uint32_t cid, vector<uint32_t>& pos, vector<uint3
inline void addColumnsToRG(uint32_t tid, vector<uint32_t>& pos, vector<uint32_t>& oids,
vector<uint32_t>& keys, vector<uint32_t>& scale, vector<uint32_t>& precision,
vector<CalpontSystemCatalog::ColDataType>& types,
vector<uint32_t>& csNums,
vector<uint32_t>& csNums,
TableInfoMap& tableInfoMap, JobInfo& jobInfo)
{
// -- the selected columns
@ -494,7 +502,7 @@ void adjustLastStep(JobStepVector& querySteps, DeliveredTableMap& deliverySteps,
deliverySteps[CNX_VTABLE_ID] = ws;
}
// TODO MCOL-894 we don't need to run sorting|distinct
// TODO MCOL-894 we don't need to run sorting|distinct
// every time
// if ((jobInfo.limitCount != (uint64_t) - 1) ||
// (jobInfo.constantCol == CONST_COL_EXIST) ||
@ -532,7 +540,7 @@ void adjustLastStep(JobStepVector& querySteps, DeliveredTableMap& deliverySteps,
AnyDataListSPtr spdlIn(new AnyDataList());
RowGroupDL* dlIn;
if (jobInfo.orderByColVec.size() > 0)
if (jobInfo.orderByColVec.size() > 0)
dlIn = new RowGroupDL(jobInfo.orderByThreads, jobInfo.fifoSize);
else
dlIn = new RowGroupDL(1, jobInfo.fifoSize);
@ -2610,7 +2618,7 @@ SP_JoinInfo joinToLargeTable(uint32_t large, TableInfoMap& tableInfoMap, JobInfo
// @bug6158, try to put BPS on large side if possible
if (tsas && smallSides.size() == 1)
{
SJSTEP sspjs = tableInfoMap[cId].fQuerySteps.back(), get();
SJSTEP sspjs = tableInfoMap[cId].fQuerySteps.back();
BatchPrimitive* sbps = dynamic_cast<BatchPrimitive*>(sspjs.get());
TupleHashJoinStep* sthjs = dynamic_cast<TupleHashJoinStep*>(sspjs.get());
@ -4520,7 +4528,7 @@ SJSTEP unionQueries(JobStepVector& queries, uint64_t distinctUnionNum, JobInfo&
const vector<uint32_t>& precisionIn = rg.getPrecision();
const vector<CalpontSystemCatalog::ColDataType>& typesIn = rg.getColTypes();
const vector<uint32_t>& csNumsIn = rg.getCharsetNumbers();
for (uint64_t j = 0; j < colCount; ++j)
{
queryColTypes[j][i].colDataType = typesIn[j];
@ -4623,3 +4631,7 @@ SJSTEP unionQueries(JobStepVector& queries, uint64_t distinctUnionNum, JobInfo&
}
// vim:ts=4 sw=4:
#ifdef __clang__
#pragma clang diagnostic pop
#endif

View File

@ -47,6 +47,13 @@ using namespace execplan;
#include "atomicops.h"
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wpotentially-evaluated-expression"
// for warnings on typeid :expression with side effects will be evaluated despite being used as an operand to 'typeid'
#endif
namespace joblist
{
int JobList::fPmsConfigured = 0;
@ -1218,5 +1225,9 @@ void TupleJobList::abort()
}
#ifdef __clang__
#pragma clang diagnostic pop
#endif
// vim:ts=4 sw=4:

View File

@ -92,11 +92,17 @@ using namespace rowgroup;
#include "mcsv1_udaf.h"
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wpotentially-evaluated-expression"
// for warnings on typeid :expression with side effects will be evaluated despite being used as an operand to 'typeid'
#endif
namespace
{
using namespace joblist;
void projectSimpleColumn(const SimpleColumn* sc, JobStepVector& jsv, JobInfo& jobInfo)
{
if (sc == NULL)
@ -279,7 +285,7 @@ const JobStepVector doProject(const RetColsVector& retCols, JobInfo& jobInfo)
if (retCols[i]->windowfunctionColumnList().size() > 0)
jobInfo.expressionVec.push_back(key);
else if (find(jobInfo.expressionVec.begin(), jobInfo.expressionVec.end(), key)
else if (find(jobInfo.expressionVec.begin(), jobInfo.expressionVec.end(), key)
== jobInfo.expressionVec.end())
{
jobInfo.returnedExpressions.push_back(sjstep);
@ -887,7 +893,7 @@ const JobStepVector doAggProject(const CalpontSelectExecutionPlan* csep, JobInfo
AggregateColumn* aggc = dynamic_cast<AggregateColumn*>(srcp.get());
bool doDistinct = (csep->distinct() && csep->groupByCols().empty());
// Use this instead of the above line to mimic MariaDB's sql_mode = 'ONLY_FULL_GROUP_BY'
// bool doDistinct = (csep->distinct() &&
// bool doDistinct = (csep->distinct() &&
// csep->groupByCols().empty() &&
// !jobInfo.hasAggregation);
uint32_t tupleKey = -1;
@ -2346,3 +2352,6 @@ SJLP JobListFactory::makeJobList(
}
// vim:ts=4 sw=4:
#ifdef __clang__
#pragma clang diagnostic pop
#endif

View File

@ -147,7 +147,6 @@ pColScanStep::pColScanStep(
return;
int err, i, mask;
BRM::LBIDRange_v::iterator it;
finishedSending = false;
recvWaiting = 0;
@ -173,7 +172,7 @@ pColScanStep::pColScanStep(
fIsDict = true;
}
// MCOL-641 WIP
else if (fColType.colWidth > 8
else if (fColType.colWidth > 8
&& fColType.colDataType != CalpontSystemCatalog::DECIMAL
&& fColType.colDataType != CalpontSystemCatalog::UDECIMAL)
{

View File

@ -23,7 +23,7 @@
* @file
*/
#ifndef JOBLIST_RESOURCEDISTRIBUTER_H
#define JOBLIST_RESOURCEMANAGER_H
#define JOBLIST_RESOURCEDISTRIBUTER_H
#include <unistd.h>
#include <list>

View File

@ -153,7 +153,6 @@ uint32_t RowEstimator::estimateDistinctValues(const execplan::CalpontSystemCatal
{
switch (ct.colDataType)
{
case CalpontSystemCatalog::BIT:
return 2;

View File

@ -117,7 +117,8 @@ void VirtualTable::addColumn(const SRCP& column)
}
else // new column type has added, but this code is not updated.
{
oss << "not supported column type: " << typeid(*(column.get())).name();
auto & columnType = *(column.get());
oss << "not supported column type: " << typeid(columnType).name();
throw runtime_error(oss.str());
}

View File

@ -337,7 +337,7 @@ void WindowFunctionStep::AddSimplColumn(const vector<SimpleColumn*>& scs,
jobInfo.windowDels.push_back(SRCP((*i)->clone()));
// MCOL-3343 Enable this if we decide to allow Window Functions to run with
// aggregates with no group by. MariaDB allows this. Nobody else in the world does.
// There will be more work to get it to function if we try this.
// There will be more work to get it to function if we try this.
// jobInfo.windowSet.insert(getTupleKey(jobInfo, *i, true));
scProjected.insert(UniqId(*i));
}
@ -499,7 +499,7 @@ void WindowFunctionStep::checkWindowFunction(CalpontSelectExecutionPlan* csep, J
if (colSet.find(key) == colSet.end())
{
jobInfo.deliveredCols.push_back(*j);
// MCOL-3435 Allow Window Functions to run with aggregates with
// MCOL-3435 Allow Window Functions to run with aggregates with
// no group by by inserting a group by for window parameters.
if (hasAggregation)
{
@ -507,7 +507,7 @@ void WindowFunctionStep::checkWindowFunction(CalpontSelectExecutionPlan* csep, J
if (dynamic_cast<AggregateColumn*>(j->get()) == NULL)
{
bool bFound = false;
for (std::vector<SRCP>::iterator igpc = csep->groupByCols().begin();
for (std::vector<SRCP>::iterator igpc = csep->groupByCols().begin();
igpc < csep->groupByCols().end();
++igpc)
{

View File

@ -65,7 +65,7 @@ public:
/** @brief
The name that will be used for display purposes.
*/
const char* table_type() const
const char* table_type() const override
{
return "ColumnStore";
}
@ -85,7 +85,7 @@ public:
This is a list of flags that indicate what functionality the storage engine
implements. The current table flags are documented in handler.h
*/
ulonglong table_flags() const
ulonglong table_flags() const override
{
return int_table_flags;
}
@ -100,7 +100,7 @@ public:
If all_parts is set, MySQL wants to know the flags for the combined
index, up to and including 'part'.
*/
ulong index_flags(uint32_t inx, uint32_t part, bool all_parts) const
ulong index_flags(uint32_t inx, uint32_t part, bool all_parts) const override
{
return 0;
}
@ -113,7 +113,7 @@ public:
send. Return *real* limits of your storage engine here; MySQL will do
min(your_limits, MySQL_limits) automatically.
*/
uint32_t max_supported_record_length() const
uint32_t max_supported_record_length() const override
{
return HA_MAX_REC_LENGTH;
}
@ -121,7 +121,7 @@ public:
/** @brief
Called in test_quick_select to determine if indexes should be used.
*/
virtual double scan_time()
virtual double scan_time() override
{
return (double) (stats.records + stats.deleted) / 20.0 + 10;
}
@ -129,7 +129,7 @@ public:
/** @brief
Analyze table command.
*/
int analyze(THD* thd, HA_CHECK_OPT* check_opt);
int analyze(THD* thd, HA_CHECK_OPT* check_opt) override;
/*
Everything below are methods that we implement in ha_example.cc.
@ -141,7 +141,7 @@ public:
/** @brief
We implement this in ha_example.cc; it's a required method.
*/
int open(const char* name, int mode, uint32_t test_if_locked); // required
int open(const char* name, int mode, uint32_t test_if_locked) override; // required
// MCOL-4282 This function is called by open_tables in sql_base.cc.
// We mutate the optimizer flags here for prepared statements as this
@ -160,71 +160,71 @@ public:
/** @brief
We implement this in ha_example.cc; it's a required method.
*/
int close(void); // required
int close(void) override; // required
/** @brief
We implement this in ha_example.cc. It's not an obligatory method;
skip it and and MySQL will treat it as not implemented.
*/
int write_row(const uchar* buf);
int write_row(const uchar* buf) override;
/** @brief
We implement this in ha_example.cc. It's not an obligatory method;
skip it and and MySQL will treat it as not implemented.
*/
void start_bulk_insert(ha_rows rows, uint flags = 0) ;
void start_bulk_insert_from_cache(ha_rows rows, uint flags = 0) ;
void start_bulk_insert(ha_rows rows, uint flags = 0) override;
void start_bulk_insert_from_cache(ha_rows rows, uint flags = 0);
/**@bug 2461 - Overloaded end_bulk_insert. MariaDB uses the abort bool, mysql does not. */
int end_bulk_insert() ;
int end_bulk_insert() override;
/** @brief
We implement this in ha_example.cc. It's not an obligatory method;
skip it and and MySQL will treat it as not implemented.
*/
int update_row(const uchar* old_data, const uchar* new_data) override;
int direct_update_rows_init(List<Item> *update_fields);
int direct_update_rows_init(List<Item> *update_fields) override;
int direct_update_rows(ha_rows *update_rows);
int direct_update_rows(ha_rows *update_rows, ha_rows *found_rows);
int direct_update_rows(ha_rows *update_rows, ha_rows *found_rows) override;
/** @brief
We implement this in ha_example.cc. It's not an obligatory method;
skip it and and MySQL will treat it as not implemented.
*/
int delete_row(const uchar* buf);
int direct_delete_rows_init();
int direct_delete_rows(ha_rows *deleted_rows);
int delete_row(const uchar* buf) override;
int direct_delete_rows_init() override;
int direct_delete_rows(ha_rows *deleted_rows) override;
/** @brief
We implement this in ha_example.cc. It's not an obligatory method;
skip it and and MySQL will treat it as not implemented.
*/
int index_read_map(uchar* buf, const uchar* key,
key_part_map keypart_map, enum ha_rkey_function find_flag);
key_part_map keypart_map, enum ha_rkey_function find_flag) override;
/** @brief
We implement this in ha_example.cc. It's not an obligatory method;
skip it and and MySQL will treat it as not implemented.
*/
int index_next(uchar* buf);
int index_next(uchar* buf) override;
/** @brief
We implement this in ha_example.cc. It's not an obligatory method;
skip it and and MySQL will treat it as not implemented.
*/
int index_prev(uchar* buf);
int index_prev(uchar* buf) override;
/** @brief
We implement this in ha_example.cc. It's not an obligatory method;
skip it and and MySQL will treat it as not implemented.
*/
int index_first(uchar* buf);
int index_first(uchar* buf) override;
/** @brief
We implement this in ha_example.cc. It's not an obligatory method;
skip it and and MySQL will treat it as not implemented.
*/
int index_last(uchar* buf);
int index_last(uchar* buf) override;
/** @brief
Unlike index_init(), rnd_init() can be called two consecutive times
@ -234,34 +234,34 @@ public:
cursor to the start of the table; no need to deallocate and allocate
it again. This is a required method.
*/
int rnd_init(bool scan); //required
int rnd_end();
int rnd_next(uchar* buf); ///< required
int rnd_pos(uchar* buf, uchar* pos); ///< required
int rnd_init(bool scan) override; //required
int rnd_end() override;
int rnd_next(uchar* buf) override; ///< required
int rnd_pos(uchar* buf, uchar* pos) override; ///< required
int reset() override;
void position(const uchar* record); ///< required
int info(uint32_t); ///< required
int extra(enum ha_extra_function operation);
int external_lock(THD* thd, int lock_type); ///< required
int delete_all_rows(void);
void position(const uchar* record) override; ///< required
int info(uint32_t) override; ///< required
int extra(enum ha_extra_function operation) override;
int external_lock(THD* thd, int lock_type) override; ///< required
int delete_all_rows(void) override;
ha_rows records_in_range(uint32_t inx, const key_range* min_key,
const key_range* max_key, page_range* res) override;
int delete_table(const char* from);
int rename_table(const char* from, const char* to);
int delete_table(const char* from) override;
int rename_table(const char* from, const char* to) override;
int create(const char* name, TABLE* form,
HA_CREATE_INFO* create_info); ///< required
HA_CREATE_INFO* create_info) override; ///< required
THR_LOCK_DATA** store_lock(THD* thd, THR_LOCK_DATA** to,
enum thr_lock_type lock_type); ///< required
const COND* cond_push(const COND* cond);
enum thr_lock_type lock_type) override; ///< required
const COND* cond_push(const COND* cond) override;
void cond_pop() override;
uint8 table_cache_type()
uint8 table_cache_type() override
{
return HA_CACHE_TBL_NOCACHE;
}
int repair(THD* thd, HA_CHECK_OPT* check_opt);
bool is_crashed() const;
int repair(THD* thd, HA_CHECK_OPT* check_opt) override;
bool is_crashed() const override;
bool isReadOnly() const
{

View File

@ -32,9 +32,10 @@ class StoreFieldMariaDB: public StoreField
Field *m_field;
const CalpontSystemCatalog::ColType &m_type;
public:
StoreFieldMariaDB(Field *f, CalpontSystemCatalog::ColType &type)
StoreFieldMariaDB(Field *f, const CalpontSystemCatalog::ColType &type)
:m_field(f), m_type(type)
{ }
const CalpontSystemCatalog::ColType &type() const { return m_type; }
int32_t colWidth() const override { return m_type.colWidth; }
int32_t precision() const override { return m_type.precision; }

View File

@ -169,8 +169,6 @@ static const string interval_names[] =
"second_microsecond"
};
const unsigned NONSUPPORTED_ERR_THRESH = 2000;
// HDFS is never used nowadays, so don't bother
bool useHdfs = false; // ResourceManager::instance()->useHdfs();
@ -834,7 +832,7 @@ uint32_t doUpdateDelete(THD* thd, gp_walk_info& gwi, const std::vector<COND*>& c
if (isUpdateStatement(thd->lex->sql_command))
args.add("Update");
#if 0
else if (thd->rgi_slave && thd->rgi_slave->m_table_map.count() != 0)
else if (thd->rgi_slave && thd->rgi_slave->m_table_map.count() != 0)
args.add("Row based replication event");
#endif
else
@ -1816,7 +1814,7 @@ uint32_t doUpdateDelete(THD* thd, gp_walk_info& gwi, const std::vector<COND*>& c
errorMsg = "Unknown error caught";
b = 1;
}
// Clear tableOid for the next SQL statement
ci->tableOid = 0;
}
@ -1829,7 +1827,7 @@ uint32_t doUpdateDelete(THD* thd, gp_walk_info& gwi, const std::vector<COND*>& c
//@Bug 2540. Set error status instead of warning
thd->raise_error_printf(ER_INTERNAL_ERROR, errorMsg.c_str());
ci->rc = b;
rc = ER_INTERNAL_ERROR;
rc = ER_INTERNAL_ERROR;
}
if (b == dmlpackageprocessor::DMLPackageProcessor::IDBRANGE_WARNING)
@ -1840,7 +1838,7 @@ uint32_t doUpdateDelete(THD* thd, gp_walk_info& gwi, const std::vector<COND*>& c
ci->rc = b;
// Turn this on as MariaDB doesn't do it until the next phase
thd->abort_on_warning = thd->is_strict_mode();
rc = ER_INTERNAL_ERROR;
rc = ER_INTERNAL_ERROR;
}
else
{

View File

@ -118,7 +118,7 @@ public:
int init_scan() override;
int next_row() override;
int end_scan() override;
void print_error(int, unsigned long);
void print_error(int, unsigned long) override;
};
/*@brief select_handler class*/