1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-29 08:21:15 +03:00

chore(codestyle): mark virtual methods as override

This commit is contained in:
Aleksei Antipovskii
2024-09-12 12:27:02 +02:00
committed by Leonid Fedorov
parent ad80ab40aa
commit 0ab03c7258
303 changed files with 4085 additions and 4886 deletions

View File

@ -17,18 +17,11 @@
// $Id: framebound.cpp 3828 2013-05-22 17:58:14Z xlou $
//#define NDEBUG
#include <cassert>
// #define NDEBUG
#include <cmath>
#include <sstream>
#include <iomanip>
using namespace std;
#include "idberrorinfo.h"
#include "errorids.h"
#include "exceptclasses.h"
using namespace logging;
#include "idborderby.h"
using namespace ordering;

View File

@ -52,11 +52,11 @@ class FrameBound
/** @brief FrameBound constructor
* @param t, frame type
*/
FrameBound(int t = 0) : fBoundType(t), fStart(true){};
explicit FrameBound(int t = 0) : fBoundType(t), fStart(true){};
/** @brief FrameBound destructor
*/
virtual ~FrameBound(){};
virtual ~FrameBound() = default;
/** @brief clone
*/
@ -144,4 +144,3 @@ class FrameBound
extern std::map<int, std::string> colType2String;
} // namespace windowfunction

View File

@ -18,11 +18,9 @@
// $Id: frameboundrange.cpp 3932 2013-06-25 16:08:10Z xlou $
//#define NDEBUG
#include <cassert>
// #define NDEBUG
#include <cmath>
#include <sstream>
#include <iomanip>
using namespace std;
#include "idberrorinfo.h"

View File

@ -35,25 +35,25 @@ class FrameBoundRange : public FrameBound
* @param n, order by sort spec: null first | null last
* @param v, order by column data type
*/
FrameBoundRange(int t = 0, bool a = true, bool n = true)
explicit FrameBoundRange(int t = 0, bool a = true, bool n = true)
: FrameBound(t), fAsc(a), fNullFirst(n), fIsZero(false){};
/** @brief FrameBoundRange destructor
*/
virtual ~FrameBoundRange(){};
~FrameBoundRange() override = default;
/** @brief clone
*/
virtual FrameBound* clone()
FrameBound* clone() override
{
return NULL; // abstract class
return nullptr; // abstract class
}
/** @brief virtual void getBound
*/
int64_t getBound(int64_t, int64_t, int64_t);
int64_t getBound(int64_t, int64_t, int64_t) override;
const std::string toString() const;
const std::string toString() const override;
void setTupleId(std::vector<uint64_t> ids)
{
@ -125,9 +125,10 @@ class FrameBoundConstantRange : public FrameBoundRange
* @param n, order by sort spec: null first | null last
* @param c, constant value. !! caller need to check NULL or negative value !!
*/
FrameBoundConstantRange(int t = 0, bool a = true, bool n = true, void* c = NULL) : FrameBoundRange(t, a, n)
explicit FrameBoundConstantRange(int t = 0, bool a = true, bool n = true, void* c = nullptr)
: FrameBoundRange(t, a, n)
{
fValue.fIsNull = (c == NULL);
fValue.fIsNull = (c == nullptr);
if (!fValue.fIsNull)
fValue.fValue = *((T*)c);
@ -135,20 +136,20 @@ class FrameBoundConstantRange : public FrameBoundRange
/** @brief FrameBoundConstantRange destructor
*/
virtual ~FrameBoundConstantRange(){};
~FrameBoundConstantRange() override = default;
/** @brief clone
*/
virtual FrameBound* clone()
FrameBound* clone() override
{
return new FrameBoundConstantRange(*this);
}
/** @brief virtual void getBound
*/
int64_t getBound(int64_t, int64_t, int64_t);
int64_t getBound(int64_t, int64_t, int64_t) override;
const std::string toString() const;
const std::string toString() const override;
protected:
// find the range offset
@ -183,15 +184,16 @@ class FrameBoundExpressionRange : public FrameBoundConstantRange<T>
* @param a, order by sort spec: asc | desc
* @param n, order by sort spec: null first | null last
*/
FrameBoundExpressionRange(int t = 0, bool a = true, bool n = true) : FrameBoundConstantRange<T>(t, a, n){};
explicit FrameBoundExpressionRange(int t = 0, bool a = true, bool n = true)
: FrameBoundConstantRange<T>(t, a, n){};
/** @brief FrameBoundExpressionRange destructor
*/
virtual ~FrameBoundExpressionRange(){};
~FrameBoundExpressionRange() override = default;
/** @brief clone
*/
virtual FrameBound* clone()
FrameBound* clone() override
{
return new FrameBoundExpressionRange(*this);
}
@ -200,16 +202,15 @@ class FrameBoundExpressionRange : public FrameBoundConstantRange<T>
*/
// int64_t getBound(int64_t, int64_t, int64_t);
const std::string toString() const;
const std::string toString() const override;
protected:
// virtual in FrameBoundRange
int64_t getPrecedingOffset(int64_t j, int64_t i);
int64_t getFollowingOffset(int64_t j, int64_t k);
int64_t getPrecedingOffset(int64_t j, int64_t i) override;
int64_t getFollowingOffset(int64_t j, int64_t k) override;
// validate the expression is not negative
void validate();
void validate() override;
};
} // namespace windowfunction

View File

@ -17,11 +17,9 @@
// $Id: frameboundrow.cpp 3932 2013-06-25 16:08:10Z xlou $
//#define NDEBUG
#include <cassert>
// #define NDEBUG
#include <cmath>
#include <sstream>
#include <iomanip>
using namespace std;
#include "idberrorinfo.h"
@ -32,7 +30,6 @@ using namespace logging;
#include "idborderby.h"
using namespace ordering;
#include "treenode.h"
#include "frameboundrow.h"
namespace windowfunction

View File

@ -32,24 +32,24 @@ class FrameBoundRow : public FrameBound
/** @brief FrameBoundRow constructor
* @param t, frame type
*/
FrameBoundRow(int t = 0) : FrameBound(t){};
explicit FrameBoundRow(int t = 0) : FrameBound(t){};
/** @brief FrameBoundRow destructor
*/
virtual ~FrameBoundRow(){};
~FrameBoundRow() override = default;
/** @brief clone
*/
virtual FrameBound* clone()
FrameBound* clone() override
{
return new FrameBoundRow(*this);
}
/** @brief virtual void getBound
*/
int64_t getBound(int64_t, int64_t, int64_t);
int64_t getBound(int64_t, int64_t, int64_t) override;
const std::string toString() const;
const std::string toString() const override;
protected:
};
@ -64,24 +64,24 @@ class FrameBoundConstantRow : public FrameBoundRow
* @param t, frame type
* @param c, constant value. !! caller need to check NULL or negative value !!
*/
FrameBoundConstantRow(int t = 0, int c = 0) : FrameBoundRow(t), fOffset(c){};
explicit FrameBoundConstantRow(int t = 0, int c = 0) : FrameBoundRow(t), fOffset(c){};
/** @brief FrameBoundConstantRow destructor
*/
virtual ~FrameBoundConstantRow(){};
~FrameBoundConstantRow() override = default;
/** @brief clone
*/
virtual FrameBound* clone()
FrameBound* clone() override
{
return new FrameBoundConstantRow(*this);
}
/** @brief virtual void getBound
*/
int64_t getBound(int64_t, int64_t, int64_t);
int64_t getBound(int64_t, int64_t, int64_t) override;
const std::string toString() const;
const std::string toString() const override;
protected:
// constant offset
@ -98,25 +98,25 @@ class FrameBoundExpressionRow : public FrameBoundConstantRow
/** @brief FrameBoundExpressionRow constructor
* @param t, frame type
*/
FrameBoundExpressionRow(int t, uint64_t id = -1, int idx = -1)
explicit FrameBoundExpressionRow(int t, uint64_t id = -1, int idx = -1)
: FrameBoundConstantRow(t), fExprTupleId(id), fExprIdx(idx){};
/** @brief FrameBoundExpressionRow destructor
*/
virtual ~FrameBoundExpressionRow(){};
~FrameBoundExpressionRow() override = default;
/** @brief clone
*/
virtual FrameBound* clone()
FrameBound* clone() override
{
return new FrameBoundExpressionRow<T>(*this);
}
/** @brief virtual void getBound
*/
int64_t getBound(int64_t, int64_t, int64_t);
int64_t getBound(int64_t, int64_t, int64_t) override;
const std::string toString() const;
const std::string toString() const override;
void setExprTupleId(int id)
{
@ -145,4 +145,3 @@ class FrameBoundExpressionRow : public FrameBoundConstantRow
};
} // namespace windowfunction

View File

@ -19,7 +19,6 @@
// $Id: idborderby.cpp 3932 2013-06-25 16:08:10Z xlou $
#include <iostream>
#include <cassert>
#include <string>
#include <stack>
using namespace std;
@ -28,7 +27,6 @@ using namespace std;
#include "calpontselectexecutionplan.h"
#include "rowgroup.h"
using namespace boost;
#include "errorids.h"
@ -41,7 +39,6 @@ using namespace execplan;
#include "resourcemanager.h"
using namespace joblist;
#include "rowgroup.h"
using namespace rowgroup;
#include "idborderby.h"
@ -531,9 +528,9 @@ int TimeCompare::operator()(IdbCompare* l, Row::Pointer r1, Row::Pointer r2)
bool CompareRule::less(Row::Pointer r1, Row::Pointer r2)
{
for (vector<Compare*>::iterator i = fCompares.begin(); i != fCompares.end(); i++)
for (auto& compare : fCompares)
{
int c = ((*(*i))(fIdbCompare, r1, r2));
int c = ((*compare)(fIdbCompare, r1, r2));
if (c < 0)
return true;
@ -546,7 +543,7 @@ bool CompareRule::less(Row::Pointer r1, Row::Pointer r2)
void CompareRule::revertRules()
{
std::vector<Compare*>::iterator fCompareIter = fCompares.begin();
auto fCompareIter = fCompares.begin();
for (; fCompareIter != fCompares.end(); fCompareIter++)
{
(*fCompareIter)->revertSortSpec();
@ -558,32 +555,32 @@ void CompareRule::compileRules(const std::vector<IdbSortSpec>& spec, const rowgr
const vector<CalpontSystemCatalog::ColDataType>& types = rg.getColTypes();
const auto& offsets = rg.getOffsets();
for (vector<IdbSortSpec>::const_iterator i = spec.begin(); i != spec.end(); i++)
for (auto spec_el : spec)
{
switch (types[i->fIndex])
switch (types[spec_el.fIndex])
{
case CalpontSystemCatalog::TINYINT:
{
Compare* c = new TinyIntCompare(*i);
Compare* c = new TinyIntCompare(spec_el);
fCompares.push_back(c);
break;
}
case CalpontSystemCatalog::SMALLINT:
{
Compare* c = new SmallIntCompare(*i);
Compare* c = new SmallIntCompare(spec_el);
fCompares.push_back(c);
break;
}
case CalpontSystemCatalog::MEDINT:
case CalpontSystemCatalog::INT:
{
Compare* c = new IntCompare(*i);
Compare* c = new IntCompare(spec_el);
fCompares.push_back(c);
break;
}
case CalpontSystemCatalog::BIGINT:
{
Compare* c = new BigIntCompare(*i);
Compare* c = new BigIntCompare(spec_el);
fCompares.push_back(c);
break;
}
@ -591,14 +588,16 @@ void CompareRule::compileRules(const std::vector<IdbSortSpec>& spec, const rowgr
case CalpontSystemCatalog::UDECIMAL:
{
Compare* c;
uint32_t len = rg.getColumnWidth(i->fIndex);
uint32_t len = rg.getColumnWidth(spec_el.fIndex);
switch (len)
{
case datatypes::MAXDECIMALWIDTH: c = new WideDecimalCompare(*i, offsets[i->fIndex]); break;
case datatypes::MAXLEGACYWIDTH: c = new BigIntCompare(*i); break;
case 1: c = new TinyIntCompare(*i); break;
case 2: c = new SmallIntCompare(*i); break;
case 4: c = new IntCompare(*i); break;
case datatypes::MAXDECIMALWIDTH:
c = new WideDecimalCompare(spec_el, offsets[spec_el.fIndex]);
break;
case datatypes::MAXLEGACYWIDTH: c = new BigIntCompare(spec_el); break;
case 1: c = new TinyIntCompare(spec_el); break;
case 2: c = new SmallIntCompare(spec_el); break;
case 4: c = new IntCompare(spec_el); break;
}
fCompares.push_back(c);
@ -607,26 +606,26 @@ void CompareRule::compileRules(const std::vector<IdbSortSpec>& spec, const rowgr
case CalpontSystemCatalog::UTINYINT:
{
Compare* c = new UTinyIntCompare(*i);
Compare* c = new UTinyIntCompare(spec_el);
fCompares.push_back(c);
break;
}
case CalpontSystemCatalog::USMALLINT:
{
Compare* c = new USmallIntCompare(*i);
Compare* c = new USmallIntCompare(spec_el);
fCompares.push_back(c);
break;
}
case CalpontSystemCatalog::UMEDINT:
case CalpontSystemCatalog::UINT:
{
Compare* c = new UIntCompare(*i);
Compare* c = new UIntCompare(spec_el);
fCompares.push_back(c);
break;
}
case CalpontSystemCatalog::UBIGINT:
{
Compare* c = new UBigIntCompare(*i);
Compare* c = new UBigIntCompare(spec_el);
fCompares.push_back(c);
break;
}
@ -635,7 +634,7 @@ void CompareRule::compileRules(const std::vector<IdbSortSpec>& spec, const rowgr
case CalpontSystemCatalog::VARCHAR:
case CalpontSystemCatalog::TEXT:
{
Compare* c = new StringCompare(*i);
Compare* c = new StringCompare(spec_el);
fCompares.push_back(c);
break;
}
@ -643,7 +642,7 @@ void CompareRule::compileRules(const std::vector<IdbSortSpec>& spec, const rowgr
case CalpontSystemCatalog::DOUBLE:
case CalpontSystemCatalog::UDOUBLE:
{
Compare* c = new DoubleCompare(*i);
Compare* c = new DoubleCompare(spec_el);
fCompares.push_back(c);
break;
}
@ -651,34 +650,34 @@ void CompareRule::compileRules(const std::vector<IdbSortSpec>& spec, const rowgr
case CalpontSystemCatalog::FLOAT:
case CalpontSystemCatalog::UFLOAT:
{
Compare* c = new FloatCompare(*i);
Compare* c = new FloatCompare(spec_el);
fCompares.push_back(c);
break;
}
case CalpontSystemCatalog::LONGDOUBLE:
{
Compare* c = new LongDoubleCompare(*i);
Compare* c = new LongDoubleCompare(spec_el);
fCompares.push_back(c);
break;
}
case CalpontSystemCatalog::DATE:
{
Compare* c = new DateCompare(*i);
Compare* c = new DateCompare(spec_el);
fCompares.push_back(c);
break;
}
case CalpontSystemCatalog::DATETIME:
case CalpontSystemCatalog::TIMESTAMP:
{
Compare* c = new DatetimeCompare(*i);
Compare* c = new DatetimeCompare(spec_el);
fCompares.push_back(c);
break;
}
case CalpontSystemCatalog::TIME:
{
Compare* c = new TimeCompare(*i);
Compare* c = new TimeCompare(spec_el);
fCompares.push_back(c);
break;
}
@ -717,7 +716,7 @@ OrderByData::OrderByData(const std::vector<IdbSortSpec>& spec, const rowgroup::R
OrderByData::~OrderByData()
{
// delete compare objects
vector<Compare*>::iterator i = fRule.fCompares.begin();
auto i = fRule.fCompares.begin();
while (i != fRule.fCompares.end())
{
@ -732,7 +731,7 @@ OrderByData::~OrderByData()
// IdbOrderBy class implementation
IdbOrderBy::IdbOrderBy()
: fDistinct(false), fMemSize(0), fRowsPerRG(rowgroup::rgCommonSize), fErrorCode(0), fRm(NULL)
: fDistinct(false), fMemSize(0), fRowsPerRG(rowgroup::rgCommonSize), fErrorCode(0), fRm(nullptr)
{
}

View File

@ -49,7 +49,7 @@ class reservablePQ : private std::priority_queue<_Tp, _Sequence, _Compare>
{
public:
typedef typename std::priority_queue<_Tp, _Sequence, _Compare>::size_type size_type;
reservablePQ(size_type capacity = 0)
explicit reservablePQ(size_type capacity = 0)
{
reserve(capacity);
};
@ -98,12 +98,10 @@ struct IdbSortSpec
class Compare
{
public:
Compare(const IdbSortSpec& spec) : fSpec(spec)
{
}
virtual ~Compare()
explicit Compare(const IdbSortSpec& spec) : fSpec(spec)
{
}
virtual ~Compare() = default;
virtual int operator()(IdbCompare*, rowgroup::Row::Pointer, rowgroup::Row::Pointer) = 0;
void revertSortSpec()
@ -121,41 +119,41 @@ class Compare
class TinyIntCompare : public Compare
{
public:
TinyIntCompare(const IdbSortSpec& spec) : Compare(spec)
explicit TinyIntCompare(const IdbSortSpec& spec) : Compare(spec)
{
}
int operator()(IdbCompare*, rowgroup::Row::Pointer, rowgroup::Row::Pointer);
int operator()(IdbCompare*, rowgroup::Row::Pointer, rowgroup::Row::Pointer) override;
};
class SmallIntCompare : public Compare
{
public:
SmallIntCompare(const IdbSortSpec& spec) : Compare(spec)
explicit SmallIntCompare(const IdbSortSpec& spec) : Compare(spec)
{
}
int operator()(IdbCompare*, rowgroup::Row::Pointer, rowgroup::Row::Pointer);
int operator()(IdbCompare*, rowgroup::Row::Pointer, rowgroup::Row::Pointer) override;
};
class IntCompare : public Compare
{
public:
IntCompare(const IdbSortSpec& spec) : Compare(spec)
explicit IntCompare(const IdbSortSpec& spec) : Compare(spec)
{
}
int operator()(IdbCompare*, rowgroup::Row::Pointer, rowgroup::Row::Pointer);
int operator()(IdbCompare*, rowgroup::Row::Pointer, rowgroup::Row::Pointer) override;
};
class BigIntCompare : public Compare
{
public:
BigIntCompare(const IdbSortSpec& spec) : Compare(spec)
explicit BigIntCompare(const IdbSortSpec& spec) : Compare(spec)
{
}
int operator()(IdbCompare*, rowgroup::Row::Pointer, rowgroup::Row::Pointer);
int operator()(IdbCompare*, rowgroup::Row::Pointer, rowgroup::Row::Pointer) override;
};
class WideDecimalCompare : public Compare
@ -167,7 +165,7 @@ class WideDecimalCompare : public Compare
{
}
int operator()(IdbCompare*, rowgroup::Row::Pointer, rowgroup::Row::Pointer);
int operator()(IdbCompare*, rowgroup::Row::Pointer, rowgroup::Row::Pointer) override;
};
// End of comparators for signed types
@ -176,41 +174,41 @@ class WideDecimalCompare : public Compare
class UTinyIntCompare : public Compare
{
public:
UTinyIntCompare(const IdbSortSpec& spec) : Compare(spec)
explicit UTinyIntCompare(const IdbSortSpec& spec) : Compare(spec)
{
}
int operator()(IdbCompare*, rowgroup::Row::Pointer, rowgroup::Row::Pointer);
int operator()(IdbCompare*, rowgroup::Row::Pointer, rowgroup::Row::Pointer) override;
};
class USmallIntCompare : public Compare
{
public:
USmallIntCompare(const IdbSortSpec& spec) : Compare(spec)
explicit USmallIntCompare(const IdbSortSpec& spec) : Compare(spec)
{
}
int operator()(IdbCompare*, rowgroup::Row::Pointer, rowgroup::Row::Pointer);
int operator()(IdbCompare*, rowgroup::Row::Pointer, rowgroup::Row::Pointer) override;
};
class UIntCompare : public Compare
{
public:
UIntCompare(const IdbSortSpec& spec) : Compare(spec)
explicit UIntCompare(const IdbSortSpec& spec) : Compare(spec)
{
}
int operator()(IdbCompare*, rowgroup::Row::Pointer, rowgroup::Row::Pointer);
int operator()(IdbCompare*, rowgroup::Row::Pointer, rowgroup::Row::Pointer) override;
};
class UBigIntCompare : public Compare
{
public:
UBigIntCompare(const IdbSortSpec& spec) : Compare(spec)
explicit UBigIntCompare(const IdbSortSpec& spec) : Compare(spec)
{
}
int operator()(IdbCompare*, rowgroup::Row::Pointer, rowgroup::Row::Pointer);
int operator()(IdbCompare*, rowgroup::Row::Pointer, rowgroup::Row::Pointer) override;
};
// end of comparators for unsigned types
@ -220,31 +218,31 @@ class UBigIntCompare : public Compare
class DoubleCompare : public Compare
{
public:
DoubleCompare(const IdbSortSpec& spec) : Compare(spec)
explicit DoubleCompare(const IdbSortSpec& spec) : Compare(spec)
{
}
int operator()(IdbCompare*, rowgroup::Row::Pointer, rowgroup::Row::Pointer);
int operator()(IdbCompare*, rowgroup::Row::Pointer, rowgroup::Row::Pointer) override;
};
class LongDoubleCompare : public Compare
{
public:
LongDoubleCompare(const IdbSortSpec& spec) : Compare(spec)
explicit LongDoubleCompare(const IdbSortSpec& spec) : Compare(spec)
{
}
int operator()(IdbCompare*, rowgroup::Row::Pointer, rowgroup::Row::Pointer);
int operator()(IdbCompare*, rowgroup::Row::Pointer, rowgroup::Row::Pointer) override;
};
class FloatCompare : public Compare
{
public:
FloatCompare(const IdbSortSpec& spec) : Compare(spec)
explicit FloatCompare(const IdbSortSpec& spec) : Compare(spec)
{
}
int operator()(IdbCompare*, rowgroup::Row::Pointer, rowgroup::Row::Pointer);
int operator()(IdbCompare*, rowgroup::Row::Pointer, rowgroup::Row::Pointer) override;
};
// End of comparators for float types
@ -253,31 +251,31 @@ class FloatCompare : public Compare
class DateCompare : public Compare
{
public:
DateCompare(const IdbSortSpec& spec) : Compare(spec)
explicit DateCompare(const IdbSortSpec& spec) : Compare(spec)
{
}
int operator()(IdbCompare*, rowgroup::Row::Pointer, rowgroup::Row::Pointer);
int operator()(IdbCompare*, rowgroup::Row::Pointer, rowgroup::Row::Pointer) override;
};
class DatetimeCompare : public Compare
{
public:
DatetimeCompare(const IdbSortSpec& spec) : Compare(spec)
explicit DatetimeCompare(const IdbSortSpec& spec) : Compare(spec)
{
}
int operator()(IdbCompare*, rowgroup::Row::Pointer, rowgroup::Row::Pointer);
int operator()(IdbCompare*, rowgroup::Row::Pointer, rowgroup::Row::Pointer) override;
};
class TimeCompare : public Compare
{
public:
TimeCompare(const IdbSortSpec& spec) : Compare(spec)
explicit TimeCompare(const IdbSortSpec& spec) : Compare(spec)
{
}
int operator()(IdbCompare*, rowgroup::Row::Pointer, rowgroup::Row::Pointer);
int operator()(IdbCompare*, rowgroup::Row::Pointer, rowgroup::Row::Pointer) override;
};
// End of comparators for temporal types
@ -287,11 +285,11 @@ class TimeCompare : public Compare
class StringCompare : public Compare
{
public:
StringCompare(const IdbSortSpec& spec) : Compare(spec), cs(NULL)
explicit StringCompare(const IdbSortSpec& spec) : Compare(spec), cs(nullptr)
{
}
int operator()(IdbCompare*, rowgroup::Row::Pointer, rowgroup::Row::Pointer);
int operator()(IdbCompare*, rowgroup::Row::Pointer, rowgroup::Row::Pointer) override;
CHARSET_INFO* cs;
};
@ -301,7 +299,7 @@ class StringCompare : public Compare
class CompareRule
{
public:
CompareRule(IdbCompare* c = NULL) : fIdbCompare(c)
explicit CompareRule(IdbCompare* c = nullptr) : fIdbCompare(c)
{
}
@ -317,8 +315,8 @@ class CompareRule
class IdbCompare
{
public:
IdbCompare(){};
virtual ~IdbCompare(){};
IdbCompare() = default;
virtual ~IdbCompare() = default;
virtual void initialize(const rowgroup::RowGroup&);
void setStringTable(bool b);
@ -362,7 +360,7 @@ class OrderByRow
class EqualCompData : public IdbCompare
{
public:
EqualCompData(std::vector<uint64_t>& v) : fIndex(v)
explicit EqualCompData(std::vector<uint64_t>& v) : fIndex(v)
{
}
EqualCompData(std::vector<uint64_t>& v, const rowgroup::RowGroup& rg) : fIndex(v)
@ -370,7 +368,7 @@ class EqualCompData : public IdbCompare
initialize(rg);
}
~EqualCompData(){};
~EqualCompData() override = default;
bool operator()(rowgroup::Row::Pointer, rowgroup::Row::Pointer);
@ -381,7 +379,7 @@ class OrderByData : public IdbCompare
{
public:
OrderByData(const std::vector<IdbSortSpec>&, const rowgroup::RowGroup&);
virtual ~OrderByData();
~OrderByData() override;
bool operator()(rowgroup::Row::Pointer p1, rowgroup::Row::Pointer p2)
{
@ -401,9 +399,9 @@ class IdbOrderBy : public IdbCompare
{
public:
IdbOrderBy();
virtual ~IdbOrderBy();
~IdbOrderBy() override;
virtual void initialize(const rowgroup::RowGroup&);
void initialize(const rowgroup::RowGroup&) override;
virtual void processRow(const rowgroup::Row&) = 0;
virtual uint64_t getKeyLength() const = 0;
virtual const std::string toString() const = 0;

View File

@ -17,29 +17,19 @@
// $Id: wf_count.cpp 3932 2013-06-25 16:08:10Z xlou $
//#define NDEBUG
#include <iostream>
#include <cassert>
// #define NDEBUG
#include <cmath>
#include <sstream>
#include <iomanip>
using namespace std;
#include <boost/shared_ptr.hpp>
using namespace boost;
#include "loggingid.h"
#include "errorcodes.h"
#include "idberrorinfo.h"
using namespace logging;
#include "rowgroup.h"
using namespace rowgroup;
#include "idborderby.h"
using namespace ordering;
#include "joblisttypes.h"
#include "calpontsystemcatalog.h"
using namespace execplan;

View File

@ -34,9 +34,9 @@ class WF_count : public WindowFunctionType
}
// pure virtual in base
void operator()(int64_t b, int64_t e, int64_t c);
WindowFunctionType* clone() const;
void resetData();
void operator()(int64_t b, int64_t e, int64_t c) override;
WindowFunctionType* clone() const override;
void resetData() override;
static boost::shared_ptr<WindowFunctionType> makeFunction(int, const string&, int, WindowFunctionColumn*);
@ -46,4 +46,3 @@ class WF_count : public WindowFunctionType
};
} // namespace windowfunction

View File

@ -18,7 +18,7 @@
// $Id: wf_lead_lag.cpp 3932 2013-06-25 16:08:10Z xlou $
//#define NDEBUG
// #define NDEBUG
#include <cassert>
#include <cmath>
#include <sstream>
@ -159,7 +159,7 @@ void WF_lead_lag<T>::parseParms(const std::vector<execplan::SRCP>& parms)
// parms[1]: offset
ConstantColumn* cc = dynamic_cast<ConstantColumn*>(parms[1].get());
if (cc != NULL)
if (cc != nullptr)
{
fOffsetNull = false;
fOffset = cc->getIntVal(fRow, fOffsetNull) * fLead; // row not used, no need to setData.
@ -168,7 +168,7 @@ void WF_lead_lag<T>::parseParms(const std::vector<execplan::SRCP>& parms)
// parms[2]: default value
cc = dynamic_cast<ConstantColumn*>(parms[2].get());
if (cc != NULL)
if (cc != nullptr)
{
fDefNull = false;
getConstValue(cc, fDefault, fDefNull);
@ -176,7 +176,7 @@ void WF_lead_lag<T>::parseParms(const std::vector<execplan::SRCP>& parms)
// parms[3]: respect null | ignore null
cc = dynamic_cast<ConstantColumn*>(parms[3].get());
if (cc != NULL)
if (cc != nullptr)
{
bool isNull = false; // dummy. Return not used
fRespectNulls = (cc->getIntVal(fRow, isNull) > 0);

View File

@ -33,10 +33,10 @@ class WF_lead_lag : public WindowFunctionType
}
// pure virtual in base
void operator()(int64_t b, int64_t e, int64_t c);
WindowFunctionType* clone() const;
void resetData();
void parseParms(const std::vector<execplan::SRCP>&);
void operator()(int64_t b, int64_t e, int64_t c) override;
WindowFunctionType* clone() const override;
void resetData() override;
void parseParms(const std::vector<execplan::SRCP>&) override;
static boost::shared_ptr<WindowFunctionType> makeFunction(int, const string&, int, WindowFunctionColumn*);
@ -51,4 +51,3 @@ class WF_lead_lag : public WindowFunctionType
};
} // namespace windowfunction

View File

@ -18,11 +18,8 @@
// $Id: wf_min_max.cpp 3932 2013-06-25 16:08:10Z xlou $
//#define NDEBUG
#include <cassert>
// #define NDEBUG
#include <cmath>
#include <sstream>
#include <iomanip>
using namespace std;
#include <boost/shared_ptr.hpp>
@ -30,13 +27,8 @@ using namespace boost;
#include "loggingid.h"
#include "errorcodes.h"
#include "idberrorinfo.h"
using namespace logging;
#include "rowgroup.h"
using namespace rowgroup;
#include "joblisttypes.h"
#include "calpontsystemcatalog.h"
using namespace execplan;

View File

@ -33,9 +33,9 @@ class WF_min_max : public WindowFunctionType
}
// pure virtual in base
void operator()(int64_t b, int64_t e, int64_t c);
WindowFunctionType* clone() const;
void resetData();
void operator()(int64_t b, int64_t e, int64_t c) override;
WindowFunctionType* clone() const override;
void resetData() override;
static boost::shared_ptr<WindowFunctionType> makeFunction(int, const string&, int, WindowFunctionColumn*);
@ -45,4 +45,3 @@ class WF_min_max : public WindowFunctionType
};
} // namespace windowfunction

View File

@ -18,7 +18,7 @@
// $Id: wf_nth_value.cpp 3932 2013-06-25 16:08:10Z xlou $
//#define NDEBUG
// #define NDEBUG
#include <cassert>
#include <cmath>
#include <sstream>
@ -149,7 +149,7 @@ void WF_nth_value<T>::parseParms(const std::vector<execplan::SRCP>& parms)
// parms[1]: nth value
ConstantColumn* cc = dynamic_cast<ConstantColumn*>(parms[1].get());
if (cc != NULL)
if (cc != nullptr)
{
fNthNull = false;
fNth = cc->getIntVal(fRow, fNthNull); // row not used, no need to setData.
@ -166,12 +166,12 @@ void WF_nth_value<T>::parseParms(const std::vector<execplan::SRCP>& parms)
// parms[2]: from first | from last
bool isNull = false;
cc = dynamic_cast<ConstantColumn*>(parms[2].get());
idbassert(cc != NULL);
idbassert(cc != nullptr);
fFromFirst = (cc->getIntVal(fRow, isNull) > 0);
// parms[3]: respect null | ignore null
cc = dynamic_cast<ConstantColumn*>(parms[3].get());
idbassert(cc != NULL);
idbassert(cc != nullptr);
fRespectNulls = (cc->getIntVal(fRow, isNull) > 0);
}

View File

@ -33,10 +33,10 @@ class WF_nth_value : public WindowFunctionType
}
// pure virtual in base
void operator()(int64_t b, int64_t e, int64_t c);
WindowFunctionType* clone() const;
void resetData();
void parseParms(const std::vector<execplan::SRCP>&);
void operator()(int64_t b, int64_t e, int64_t c) override;
WindowFunctionType* clone() const override;
void resetData() override;
void parseParms(const std::vector<execplan::SRCP>&) override;
static boost::shared_ptr<WindowFunctionType> makeFunction(int, const string&, int, WindowFunctionColumn*);
@ -49,4 +49,3 @@ class WF_nth_value : public WindowFunctionType
};
} // namespace windowfunction

View File

@ -17,24 +17,18 @@
// $Id: wf_ntile.cpp 3932 2013-06-25 16:08:10Z xlou $
//#define NDEBUG
#include <cassert>
// #define NDEBUG
#include <cmath>
#include <sstream>
#include <iomanip>
using namespace std;
#include <boost/shared_ptr.hpp>
using namespace boost;
#include "loggingid.h"
#include "errorcodes.h"
#include "idberrorinfo.h"
using namespace logging;
#include "rowgroup.h"
using namespace rowgroup;
#include "idborderby.h"
using namespace ordering;
@ -50,8 +44,8 @@ using namespace joblist;
namespace windowfunction
{
boost::shared_ptr<WindowFunctionType> WF_ntile::makeFunction(int id, const string& name, int ct,
WindowFunctionColumn* wc)
boost::shared_ptr<WindowFunctionType> WF_ntile::makeFunction(int id, const string& name, int,
WindowFunctionColumn*)
{
boost::shared_ptr<WindowFunctionType> func(new WF_ntile(id, name));
return func;
@ -70,9 +64,9 @@ void WF_ntile::resetData()
void WF_ntile::parseParms(const std::vector<execplan::SRCP>& parms)
{
// parms[0]: nt
ConstantColumn* cc = dynamic_cast<ConstantColumn*>(parms[0].get());
auto* cc = dynamic_cast<ConstantColumn*>(parms[0].get());
if (cc != NULL)
if (cc != nullptr)
{
fNtileNull = false;
fNtile = cc->getIntVal(fRow, fNtileNull); // row not used, no need to setData.

View File

@ -33,10 +33,10 @@ class WF_ntile : public WindowFunctionType
}
// pure virtual in base
void operator()(int64_t b, int64_t e, int64_t c);
WindowFunctionType* clone() const;
void resetData();
void parseParms(const std::vector<execplan::SRCP>&);
void operator()(int64_t b, int64_t e, int64_t c) override;
WindowFunctionType* clone() const override;
void resetData() override;
void parseParms(const std::vector<execplan::SRCP>&) override;
static boost::shared_ptr<WindowFunctionType> makeFunction(int, const string&, int, WindowFunctionColumn*);
@ -46,4 +46,3 @@ class WF_ntile : public WindowFunctionType
};
} // namespace windowfunction

View File

@ -18,11 +18,10 @@
// $Id: wf_percentile.cpp 3932 2013-06-25 16:08:10Z xlou $
//#define NDEBUG
// #define NDEBUG
#include <cassert>
#include <cmath>
#include <sstream>
#include <iomanip>
using namespace std;
#include <boost/shared_ptr.hpp>
@ -34,13 +33,9 @@ using namespace boost;
#include "idberrorinfo.h"
using namespace logging;
#include "rowgroup.h"
using namespace rowgroup;
#include "idborderby.h"
using namespace ordering;
#include "joblisttypes.h"
#include "calpontsystemcatalog.h"
#include "constantcolumn.h"
using namespace execplan;
@ -206,7 +201,7 @@ void WF_percentile<T>::parseParms(const std::vector<execplan::SRCP>& parms)
// parms[0]: nve
ConstantColumn* cc = dynamic_cast<ConstantColumn*>(parms[0].get());
if (cc != NULL)
if (cc != nullptr)
{
fNveNull = false;
fNve = cc->getDoubleVal(fRow, fNveNull); // row not used, no need to setData.
@ -339,7 +334,7 @@ void WF_percentile<T>::operator()(int64_t b, int64_t e, int64_t c)
tempvd[1] = 0;
v = *(reinterpret_cast<T*>(&tempvd[0]));
//v = *(reinterpret_cast<T*>(&vd)); // XXX old code that produced out-of-bounds difference.
// v = *(reinterpret_cast<T*>(&vd)); // XXX old code that produced out-of-bounds difference.
p = &v;
}
else // (fFunctionId == WF__PERCENTILE_DISC)

View File

@ -34,10 +34,10 @@ class WF_percentile : public WindowFunctionType
}
// pure virtual in base
void operator()(int64_t b, int64_t e, int64_t c);
WindowFunctionType* clone() const;
void resetData();
void parseParms(const std::vector<execplan::SRCP>&);
void operator()(int64_t b, int64_t e, int64_t c) override;
WindowFunctionType* clone() const override;
void resetData() override;
void parseParms(const std::vector<execplan::SRCP>&) override;
static boost::shared_ptr<WindowFunctionType> makeFunction(int, const string&, int, WindowFunctionColumn*);
@ -47,4 +47,3 @@ class WF_percentile : public WindowFunctionType
};
} // namespace windowfunction

View File

@ -17,29 +17,19 @@
// $Id: wf_ranking.cpp 3932 2013-06-25 16:08:10Z xlou $
//#define NDEBUG
#include <cassert>
// #define NDEBUG
#include <cmath>
#include <sstream>
#include <iomanip>
using namespace std;
#include <boost/shared_ptr.hpp>
using namespace boost;
#include "loggingid.h"
#include "errorcodes.h"
#include "idberrorinfo.h"
using namespace logging;
#include "rowgroup.h"
using namespace rowgroup;
#include "idborderby.h"
using namespace ordering;
#include "joblisttypes.h"
#include "calpontsystemcatalog.h"
using namespace execplan;
#include "windowfunctionstep.h"

View File

@ -33,9 +33,9 @@ class WF_ranking : public WindowFunctionType
}
// pure virtual in base
void operator()(int64_t b, int64_t e, int64_t c);
WindowFunctionType* clone() const;
void resetData();
void operator()(int64_t b, int64_t e, int64_t c) override;
WindowFunctionType* clone() const override;
void resetData() override;
static boost::shared_ptr<WindowFunctionType> makeFunction(int, const string&, int, WindowFunctionColumn*);
@ -45,4 +45,3 @@ class WF_ranking : public WindowFunctionType
};
} // namespace windowfunction

View File

@ -17,29 +17,19 @@
// $Id: wf_row_number.cpp 3932 2013-06-25 16:08:10Z xlou $
//#define NDEBUG
#include <cassert>
// #define NDEBUG
#include <cmath>
#include <sstream>
#include <iomanip>
using namespace std;
#include <boost/shared_ptr.hpp>
using namespace boost;
#include "loggingid.h"
#include "errorcodes.h"
#include "idberrorinfo.h"
using namespace logging;
#include "rowgroup.h"
using namespace rowgroup;
#include "idborderby.h"
using namespace ordering;
#include "joblisttypes.h"
#include "calpontsystemcatalog.h"
using namespace execplan;
#include "windowfunctionstep.h"
@ -49,8 +39,8 @@ using namespace joblist;
namespace windowfunction
{
boost::shared_ptr<WindowFunctionType> WF_row_number::makeFunction(int id, const string& name, int ct,
WindowFunctionColumn* wc)
boost::shared_ptr<WindowFunctionType> WF_row_number::makeFunction(int id, const string& name, int,
WindowFunctionColumn*)
{
boost::shared_ptr<WindowFunctionType> func(new WF_row_number(id, name));
return func;

View File

@ -33,9 +33,9 @@ class WF_row_number : public WindowFunctionType
}
// pure virtual in base
void operator()(int64_t b, int64_t e, int64_t c);
WindowFunctionType* clone() const;
void resetData();
void operator()(int64_t b, int64_t e, int64_t c) override;
WindowFunctionType* clone() const override;
void resetData() override;
static boost::shared_ptr<WindowFunctionType> makeFunction(int, const string&, int, WindowFunctionColumn*);
@ -44,4 +44,3 @@ class WF_row_number : public WindowFunctionType
};
} // namespace windowfunction

View File

@ -18,11 +18,9 @@
// $Id: wf_stats.cpp 3932 2013-06-25 16:08:10Z xlou $
//#define NDEBUG
#include <cassert>
// #define NDEBUG
#include <cmath>
#include <sstream>
#include <iomanip>
using namespace std;
#include <boost/shared_ptr.hpp>
@ -33,13 +31,9 @@ using namespace boost;
#include "idberrorinfo.h"
using namespace logging;
#include "rowgroup.h"
using namespace rowgroup;
#include "idborderby.h"
using namespace ordering;
#include "joblisttypes.h"
#include "calpontsystemcatalog.h"
using namespace execplan;
@ -177,7 +171,7 @@ void WF_stats<T>::operator()(int64_t b, int64_t e, int64_t c)
long double val = (long double)valIn;
count_++;
long double delta = val - mean_;
mean_ += delta/count_;
mean_ += delta / count_;
scaledMomentum2_ += delta * (val - mean_);
}
@ -208,13 +202,13 @@ void WF_stats<T>::operator()(int64_t b, int64_t e, int64_t c)
if (count_ == 0)
{
setValue(CalpontSystemCatalog::DOUBLE, b, e, c, (double*)NULL);
setValue(CalpontSystemCatalog::DOUBLE, b, e, c, (double*)nullptr);
}
else if (count_ == 1)
{
if (fFunctionId == WF__STDDEV_SAMP || fFunctionId == WF__VAR_SAMP)
{
setValue(CalpontSystemCatalog::DOUBLE, b, e, c, (double*)NULL);
setValue(CalpontSystemCatalog::DOUBLE, b, e, c, (double*)nullptr);
}
else // fFunctionId == WF__STDDEV_POP || fFunctionId == WF__VAR_POP
{

View File

@ -33,9 +33,9 @@ class WF_stats : public WindowFunctionType
}
// pure virtual in base
void operator()(int64_t b, int64_t e, int64_t c);
WindowFunctionType* clone() const;
void resetData();
void operator()(int64_t b, int64_t e, int64_t c) override;
WindowFunctionType* clone() const override;
void resetData() override;
static boost::shared_ptr<WindowFunctionType> makeFunction(int, const string&, int, WindowFunctionColumn*);
@ -47,4 +47,3 @@ class WF_stats : public WindowFunctionType
};
} // namespace windowfunction

View File

@ -38,9 +38,9 @@ class WF_sum_avg : public WindowFunctionType
}
// pure virtual in base
void operator()(int64_t b, int64_t e, int64_t c);
WindowFunctionType* clone() const;
void resetData();
void operator()(int64_t b, int64_t e, int64_t c) override;
WindowFunctionType* clone() const override;
void resetData() override;
static boost::shared_ptr<WindowFunctionType> makeFunction(int, const string&, int, WindowFunctionColumn*);
@ -59,4 +59,3 @@ class WF_sum_avg : public WindowFunctionType
};
} // namespace windowfunction

View File

@ -55,18 +55,18 @@ class WF_udaf : public WindowFunctionType
}
WF_udaf(WF_udaf& rhs);
// pure virtual in base
void operator()(int64_t b, int64_t e, int64_t c);
WindowFunctionType* clone() const;
void resetData();
void parseParms(const std::vector<execplan::SRCP>&);
virtual bool dropValues(int64_t, int64_t);
void operator()(int64_t b, int64_t e, int64_t c) override;
WindowFunctionType* clone() const override;
void resetData() override;
void parseParms(const std::vector<execplan::SRCP>&) override;
bool dropValues(int64_t, int64_t) override;
mcsv1sdk::mcsv1Context& getContext()
{
return fUDAFContext;
}
bool getInterrupted()
bool getInterrupted() const
{
return bInterrupted;
}
@ -76,7 +76,7 @@ class WF_udaf : public WindowFunctionType
return &bInterrupted;
}
bool getDistinct()
bool getDistinct() const
{
return fDistinct;
}
@ -107,4 +107,3 @@ class WF_udaf : public WindowFunctionType
};
} // namespace windowfunction

View File

@ -50,7 +50,7 @@ class WindowFrame
/** @brief WindowFrame destructor
*/
virtual ~WindowFrame(){};
virtual ~WindowFrame() = default;
/** @brief clone
*/
@ -118,4 +118,3 @@ class WindowFrame
};
} // namespace windowfunction

View File

@ -109,14 +109,14 @@ class WindowFunctionType
{
public:
// @brief WindowFunctionType constructor
WindowFunctionType(int id = 0, const std::string& name = "")
explicit WindowFunctionType(int id = 0, const std::string& name = "")
: fFunctionId(id), fFunctionName(name), fFrameUnit(0){};
// use default copy construct
// WindowFunctionType(const WindowFunctionType&);
// @brief WindowFunctionType destructor
virtual ~WindowFunctionType(){};
virtual ~WindowFunctionType() = default;
// @brief virtual operator(begin, end, current, data, row)
virtual void operator()(int64_t, int64_t, int64_t) = 0;
@ -216,7 +216,7 @@ class WindowFunctionType
// utility methods
template <typename T>
void getValue(uint64_t, T&, CDT* cdt = NULL);
void getValue(uint64_t, T&, CDT* cdt = nullptr);
template <typename T>
void setValue(int, int64_t, int64_t, int64_t, T* = NULL);
template <typename T>
@ -303,4 +303,3 @@ class WindowFunctionType
extern std::map<int, std::string> colType2String;
} // namespace windowfunction