You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-07-30 19:23:07 +03:00
Reformat all code to coding standard
This commit is contained in:
@ -58,13 +58,13 @@ class IdbCompare;
|
||||
// order by specification
|
||||
struct IdbSortSpec
|
||||
{
|
||||
int fIndex;
|
||||
int fAsc; // <ordering specification> ::= ASC | DESC
|
||||
int fNf; // <null ordering> ::= NULLS FIRST | NULLS LAST
|
||||
int fIndex;
|
||||
int fAsc; // <ordering specification> ::= ASC | DESC
|
||||
int fNf; // <null ordering> ::= NULLS FIRST | NULLS LAST
|
||||
|
||||
IdbSortSpec() : fIndex(-1), fAsc(1), fNf(1) {}
|
||||
IdbSortSpec(int i, bool b) : fIndex(i), fAsc(b ? 1 : -1), fNf(fAsc) {}
|
||||
IdbSortSpec(int i, bool b, bool n) : fIndex(i), fAsc(b ? 1 : -1), fNf(n ? 1 : -1) {}
|
||||
IdbSortSpec() : fIndex(-1), fAsc(1), fNf(1) {}
|
||||
IdbSortSpec(int i, bool b) : fIndex(i), fAsc(b ? 1 : -1), fNf(fAsc) {}
|
||||
IdbSortSpec(int i, bool b, bool n) : fIndex(i), fAsc(b ? 1 : -1), fNf(n ? 1 : -1) {}
|
||||
};
|
||||
|
||||
|
||||
@ -73,134 +73,152 @@ struct IdbSortSpec
|
||||
class Compare
|
||||
{
|
||||
public:
|
||||
Compare(const IdbSortSpec& spec) : fSpec(spec) {}
|
||||
virtual ~Compare() {}
|
||||
Compare(const IdbSortSpec& spec) : fSpec(spec) {}
|
||||
virtual ~Compare() {}
|
||||
|
||||
virtual int operator()(IdbCompare*, rowgroup::Row::Pointer, rowgroup::Row::Pointer) = 0;
|
||||
virtual int operator()(IdbCompare*, rowgroup::Row::Pointer, rowgroup::Row::Pointer) = 0;
|
||||
|
||||
protected:
|
||||
IdbSortSpec fSpec;
|
||||
IdbSortSpec fSpec;
|
||||
};
|
||||
|
||||
|
||||
class IntCompare : public Compare
|
||||
{
|
||||
public:
|
||||
IntCompare(const IdbSortSpec& spec) : Compare(spec) {}
|
||||
IntCompare(const IdbSortSpec& spec) : Compare(spec) {}
|
||||
|
||||
int operator()(IdbCompare*, rowgroup::Row::Pointer, rowgroup::Row::Pointer);
|
||||
int operator()(IdbCompare*, rowgroup::Row::Pointer, rowgroup::Row::Pointer);
|
||||
};
|
||||
|
||||
|
||||
class UintCompare : public Compare
|
||||
{
|
||||
public:
|
||||
UintCompare(const IdbSortSpec& spec) : Compare(spec) {}
|
||||
UintCompare(const IdbSortSpec& spec) : Compare(spec) {}
|
||||
|
||||
int operator()(IdbCompare*, rowgroup::Row::Pointer, rowgroup::Row::Pointer);
|
||||
int operator()(IdbCompare*, rowgroup::Row::Pointer, rowgroup::Row::Pointer);
|
||||
};
|
||||
|
||||
|
||||
class StringCompare : public Compare
|
||||
{
|
||||
public:
|
||||
StringCompare(const IdbSortSpec& spec) : Compare(spec) {}
|
||||
StringCompare(const IdbSortSpec& spec) : Compare(spec) {}
|
||||
|
||||
int operator()(IdbCompare*, rowgroup::Row::Pointer, rowgroup::Row::Pointer);
|
||||
int operator()(IdbCompare*, rowgroup::Row::Pointer, rowgroup::Row::Pointer);
|
||||
};
|
||||
|
||||
|
||||
class DoubleCompare : public Compare
|
||||
{
|
||||
public:
|
||||
DoubleCompare(const IdbSortSpec& spec) : Compare(spec) {}
|
||||
DoubleCompare(const IdbSortSpec& spec) : Compare(spec) {}
|
||||
|
||||
int operator()(IdbCompare*, rowgroup::Row::Pointer, rowgroup::Row::Pointer);
|
||||
int operator()(IdbCompare*, rowgroup::Row::Pointer, rowgroup::Row::Pointer);
|
||||
};
|
||||
|
||||
|
||||
class FloatCompare : public Compare
|
||||
{
|
||||
public:
|
||||
FloatCompare(const IdbSortSpec& spec) : Compare(spec) {}
|
||||
FloatCompare(const IdbSortSpec& spec) : Compare(spec) {}
|
||||
|
||||
int operator()(IdbCompare*, rowgroup::Row::Pointer, rowgroup::Row::Pointer);
|
||||
int operator()(IdbCompare*, rowgroup::Row::Pointer, rowgroup::Row::Pointer);
|
||||
};
|
||||
|
||||
|
||||
class CompareRule
|
||||
{
|
||||
public:
|
||||
CompareRule(IdbCompare* c = NULL) : fIdbCompare(c) {}
|
||||
CompareRule(IdbCompare* c = NULL) : fIdbCompare(c) {}
|
||||
|
||||
|
||||
bool less(rowgroup::Row::Pointer r1, rowgroup::Row::Pointer r2);
|
||||
bool less(rowgroup::Row::Pointer r1, rowgroup::Row::Pointer r2);
|
||||
|
||||
void compileRules(const std::vector<IdbSortSpec>&, const rowgroup::RowGroup&);
|
||||
void compileRules(const std::vector<IdbSortSpec>&, const rowgroup::RowGroup&);
|
||||
|
||||
std::vector<Compare*> fCompares;
|
||||
IdbCompare* fIdbCompare;
|
||||
std::vector<Compare*> fCompares;
|
||||
IdbCompare* fIdbCompare;
|
||||
};
|
||||
|
||||
|
||||
class IdbCompare
|
||||
{
|
||||
public:
|
||||
IdbCompare() {};
|
||||
virtual ~IdbCompare() {};
|
||||
IdbCompare() {};
|
||||
virtual ~IdbCompare() {};
|
||||
|
||||
virtual void initialize(const rowgroup::RowGroup&);
|
||||
void setStringTable(bool b);
|
||||
virtual void initialize(const rowgroup::RowGroup&);
|
||||
void setStringTable(bool b);
|
||||
|
||||
rowgroup::Row& row1() { return fRow1; }
|
||||
rowgroup::Row& row2() { return fRow2; }
|
||||
rowgroup::Row& row1()
|
||||
{
|
||||
return fRow1;
|
||||
}
|
||||
rowgroup::Row& row2()
|
||||
{
|
||||
return fRow2;
|
||||
}
|
||||
|
||||
protected:
|
||||
rowgroup::RowGroup fRowGroup;
|
||||
rowgroup::Row fRow1;
|
||||
rowgroup::Row fRow2;
|
||||
rowgroup::RowGroup fRowGroup;
|
||||
rowgroup::Row fRow1;
|
||||
rowgroup::Row fRow2;
|
||||
};
|
||||
|
||||
|
||||
class OrderByRow
|
||||
{
|
||||
public:
|
||||
OrderByRow(const rowgroup::Row& r, CompareRule& c) : fData(r.getPointer()), fRule(&c) {}
|
||||
OrderByRow(const rowgroup::Row& r, CompareRule& c) : fData(r.getPointer()), fRule(&c) {}
|
||||
|
||||
bool operator < (const OrderByRow& rhs) const { return fRule->less(fData, rhs.fData); }
|
||||
bool operator < (const OrderByRow& rhs) const
|
||||
{
|
||||
return fRule->less(fData, rhs.fData);
|
||||
}
|
||||
|
||||
rowgroup::Row::Pointer fData;
|
||||
CompareRule* fRule;
|
||||
rowgroup::Row::Pointer fData;
|
||||
CompareRule* fRule;
|
||||
};
|
||||
|
||||
|
||||
class EqualCompData : public IdbCompare
|
||||
{
|
||||
public:
|
||||
EqualCompData(std::vector<uint64_t>& v) : fIndex(v) {}
|
||||
EqualCompData(std::vector<uint64_t>& v, const rowgroup::RowGroup& rg) :
|
||||
fIndex(v) { initialize(rg); }
|
||||
EqualCompData(std::vector<uint64_t>& v) : fIndex(v) {}
|
||||
EqualCompData(std::vector<uint64_t>& v, const rowgroup::RowGroup& rg) :
|
||||
fIndex(v)
|
||||
{
|
||||
initialize(rg);
|
||||
}
|
||||
|
||||
~EqualCompData() {};
|
||||
~EqualCompData() {};
|
||||
|
||||
bool operator()(rowgroup::Row::Pointer, rowgroup::Row::Pointer);
|
||||
bool operator()(rowgroup::Row::Pointer, rowgroup::Row::Pointer);
|
||||
|
||||
//protected:
|
||||
std::vector<uint64_t> fIndex;
|
||||
std::vector<uint64_t> fIndex;
|
||||
};
|
||||
|
||||
|
||||
class OrderByData : public IdbCompare
|
||||
{
|
||||
public:
|
||||
OrderByData(const std::vector<IdbSortSpec>&, const rowgroup::RowGroup&);
|
||||
virtual ~OrderByData() {};
|
||||
OrderByData(const std::vector<IdbSortSpec>&, const rowgroup::RowGroup&);
|
||||
virtual ~OrderByData() {};
|
||||
|
||||
bool operator() (rowgroup::Row::Pointer p1, rowgroup::Row::Pointer p2) { return fRule.less(p1, p2); }
|
||||
const CompareRule& rule() const { return fRule; }
|
||||
bool operator() (rowgroup::Row::Pointer p1, rowgroup::Row::Pointer p2)
|
||||
{
|
||||
return fRule.less(p1, p2);
|
||||
}
|
||||
const CompareRule& rule() const
|
||||
{
|
||||
return fRule;
|
||||
}
|
||||
|
||||
protected:
|
||||
CompareRule fRule;
|
||||
CompareRule fRule;
|
||||
};
|
||||
|
||||
|
||||
@ -208,53 +226,61 @@ protected:
|
||||
class IdbOrderBy : public IdbCompare
|
||||
{
|
||||
public:
|
||||
IdbOrderBy();
|
||||
virtual ~IdbOrderBy();
|
||||
IdbOrderBy();
|
||||
virtual ~IdbOrderBy();
|
||||
|
||||
virtual void initialize(const rowgroup::RowGroup&);
|
||||
virtual void processRow(const rowgroup::Row&) = 0;
|
||||
virtual uint64_t getKeyLength() const = 0;
|
||||
virtual const std::string toString() const = 0;
|
||||
virtual void initialize(const rowgroup::RowGroup&);
|
||||
virtual void processRow(const rowgroup::Row&) = 0;
|
||||
virtual uint64_t getKeyLength() const = 0;
|
||||
virtual const std::string toString() const = 0;
|
||||
|
||||
bool getData(rowgroup::RGData& data);
|
||||
bool getData(rowgroup::RGData& data);
|
||||
|
||||
void distinct(bool b) { fDistinct = b; }
|
||||
bool distinct() const { return fDistinct; }
|
||||
void distinct(bool b)
|
||||
{
|
||||
fDistinct = b;
|
||||
}
|
||||
bool distinct() const
|
||||
{
|
||||
return fDistinct;
|
||||
}
|
||||
|
||||
protected:
|
||||
std::vector<IdbSortSpec> fOrderByCond;
|
||||
std::priority_queue<OrderByRow> fOrderByQueue;
|
||||
rowgroup::Row fRow0;
|
||||
CompareRule fRule;
|
||||
std::vector<IdbSortSpec> fOrderByCond;
|
||||
std::priority_queue<OrderByRow> fOrderByQueue;
|
||||
rowgroup::Row fRow0;
|
||||
CompareRule fRule;
|
||||
|
||||
rowgroup::RGData fData;
|
||||
std::queue<rowgroup::RGData> fDataQueue;
|
||||
rowgroup::RGData fData;
|
||||
std::queue<rowgroup::RGData> fDataQueue;
|
||||
|
||||
struct Hasher {
|
||||
IdbOrderBy *ts;
|
||||
utils::Hasher_r h;
|
||||
uint32_t colCount;
|
||||
Hasher(IdbOrderBy *t, uint32_t c) : ts(t), colCount(c) { }
|
||||
uint64_t operator()(const rowgroup::Row::Pointer &) const;
|
||||
};
|
||||
struct Eq {
|
||||
IdbOrderBy *ts;
|
||||
uint32_t colCount;
|
||||
Eq(IdbOrderBy *t, uint32_t c) : ts(t), colCount(c) { }
|
||||
bool operator()(const rowgroup::Row::Pointer &, const rowgroup::Row::Pointer &) const;
|
||||
};
|
||||
struct Hasher
|
||||
{
|
||||
IdbOrderBy* ts;
|
||||
utils::Hasher_r h;
|
||||
uint32_t colCount;
|
||||
Hasher(IdbOrderBy* t, uint32_t c) : ts(t), colCount(c) { }
|
||||
uint64_t operator()(const rowgroup::Row::Pointer&) const;
|
||||
};
|
||||
struct Eq
|
||||
{
|
||||
IdbOrderBy* ts;
|
||||
uint32_t colCount;
|
||||
Eq(IdbOrderBy* t, uint32_t c) : ts(t), colCount(c) { }
|
||||
bool operator()(const rowgroup::Row::Pointer&, const rowgroup::Row::Pointer&) const;
|
||||
};
|
||||
|
||||
typedef std::tr1::unordered_set<rowgroup::Row::Pointer, Hasher, Eq,
|
||||
utils::STLPoolAllocator<rowgroup::Row::Pointer> > DistinctMap_t;
|
||||
boost::scoped_ptr<DistinctMap_t> fDistinctMap;
|
||||
rowgroup::Row row1, row2; // scratch space for Hasher & Eq
|
||||
typedef std::tr1::unordered_set<rowgroup::Row::Pointer, Hasher, Eq,
|
||||
utils::STLPoolAllocator<rowgroup::Row::Pointer> > DistinctMap_t;
|
||||
boost::scoped_ptr<DistinctMap_t> fDistinctMap;
|
||||
rowgroup::Row row1, row2; // scratch space for Hasher & Eq
|
||||
|
||||
bool fDistinct;
|
||||
uint64_t fMemSize;
|
||||
uint64_t fRowsPerRG;
|
||||
uint64_t fErrorCode;
|
||||
joblist::ResourceManager* fRm;
|
||||
boost::shared_ptr<int64_t> fSessionMemLimit;
|
||||
bool fDistinct;
|
||||
uint64_t fMemSize;
|
||||
uint64_t fRowsPerRG;
|
||||
uint64_t fErrorCode;
|
||||
joblist::ResourceManager* fRm;
|
||||
boost::shared_ptr<int64_t> fSessionMemLimit;
|
||||
};
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user