You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-08-01 06:46:55 +03:00
feat(PrimProc): MCOL-5852 disk-based GROUP_CONCAT & JSON_ARRAYAGG
* move GROUP_CONCAT/JSON_ARRAYAGG storage to the RowGroup from the RowAggregation* * internal data structures (de)serialization * get rid of a specialized classes for processing JSON_ARRAYAGG * move the memory accounting to disk-based aggregation classes * allow aggregation generations to be used for queries with GROUP_CONCAT/JSON_ARRAYAGG * Remove the thread id from the error message as it interferes with the mtr
This commit is contained in:
committed by
Alexey Antipovsky
parent
87d47fd7ae
commit
4bea7e59a0
@ -327,7 +327,7 @@ struct ConstantAggData
|
||||
typedef boost::shared_ptr<RowAggGroupByCol> SP_ROWAGG_GRPBY_t;
|
||||
typedef boost::shared_ptr<RowAggFunctionCol> SP_ROWAGG_FUNC_t;
|
||||
|
||||
struct GroupConcat
|
||||
struct GroupConcat : public messageqcpp::Serializeable
|
||||
{
|
||||
// GROUP_CONCAT(DISTINCT col1, 'const', col2 ORDER BY col3 desc SEPARATOR 'sep')
|
||||
std::vector<std::pair<uint32_t, uint32_t>> fGroupCols; // columns to concatenate, and position
|
||||
@ -340,38 +340,26 @@ struct GroupConcat
|
||||
RowGroup fRowGroup;
|
||||
std::shared_ptr<int[]> fMapping;
|
||||
std::vector<std::pair<int, bool>> fOrderCond; // position to order by [asc/desc]
|
||||
joblist::ResourceManager* fRm; // resource manager
|
||||
boost::shared_ptr<int64_t> fSessionMemLimit;
|
||||
long fTimeZone;
|
||||
uint32_t id;
|
||||
|
||||
GroupConcat() : fRm(nullptr)
|
||||
GroupConcat() = default;
|
||||
GroupConcat(joblist::ResourceManager* rm, boost::shared_ptr<int64_t> sessLimit)
|
||||
: fRm(rm)
|
||||
, fSessionMemLimit(sessLimit)
|
||||
{
|
||||
}
|
||||
|
||||
void serialize(messageqcpp::ByteStream& bs) const override;
|
||||
void deserialize(messageqcpp::ByteStream& bs) override;
|
||||
RGDataSizeType getDataSize() const;
|
||||
|
||||
joblist::ResourceManager* fRm{nullptr};
|
||||
boost::shared_ptr<int64_t> fSessionMemLimit;
|
||||
};
|
||||
|
||||
typedef boost::shared_ptr<GroupConcat> SP_GroupConcat;
|
||||
|
||||
class GroupConcatAg
|
||||
{
|
||||
public:
|
||||
explicit GroupConcatAg(SP_GroupConcat&);
|
||||
virtual ~GroupConcatAg();
|
||||
|
||||
virtual void initialize() {};
|
||||
virtual void processRow(const rowgroup::Row&) {};
|
||||
virtual void merge(const rowgroup::Row&, uint64_t) {};
|
||||
|
||||
virtual uint8_t* getResult()
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
protected:
|
||||
rowgroup::SP_GroupConcat fGroupConcat;
|
||||
};
|
||||
|
||||
typedef boost::shared_ptr<GroupConcatAg> SP_GroupConcatAg;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/** @brief Class that aggregates RowGroups.
|
||||
*/
|
||||
@ -555,6 +543,8 @@ class RowAggregation : public messageqcpp::Serializeable
|
||||
virtual void doAvg(const Row&, int64_t, int64_t, int64_t, bool merge = false);
|
||||
virtual void doStatistics(const Row&, int64_t, int64_t, int64_t);
|
||||
void mergeStatistics(const Row&, uint64_t colOut, uint64_t colAux);
|
||||
void mergeGroupConcat(const Row& rowIn, uint64_t colOut);
|
||||
|
||||
virtual void doBitOp(const Row&, int64_t, int64_t, int);
|
||||
virtual void doUDAF(const Row&, int64_t, int64_t, int64_t, uint64_t& funcColsIdx,
|
||||
std::vector<mcsv1sdk::mcsv1Context>* rgContextColl = nullptr);
|
||||
@ -650,6 +640,8 @@ class RowAggregation : public messageqcpp::Serializeable
|
||||
std::string fTmpDir =
|
||||
config::Config::makeConfig()->getTempFileDir(config::Config::TempDirPurpose::Aggregates);
|
||||
std::string fCompStr = config::Config::makeConfig()->getConfig("RowAggregation", "Compression");
|
||||
|
||||
std::vector<SP_GroupConcat> fGroupConcat;
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
@ -794,7 +786,6 @@ class RowAggregationUM : public RowAggregation
|
||||
|
||||
// @bug3362, group_concat
|
||||
virtual void doGroupConcat(const Row&, int64_t, int64_t);
|
||||
virtual void doJsonAgg(const Row&, int64_t, int64_t);
|
||||
virtual void setGroupConcatString();
|
||||
|
||||
bool fHasAvg;
|
||||
@ -814,8 +805,6 @@ class RowAggregationUM : public RowAggregation
|
||||
std::vector<ConstantAggData> fConstantAggregate;
|
||||
|
||||
// @bug3362, group_concat
|
||||
std::vector<SP_GroupConcat> fGroupConcat;
|
||||
std::vector<SP_GroupConcatAg> fGroupConcatAg;
|
||||
std::vector<SP_ROWAGG_FUNC_t> fFunctionColGc;
|
||||
|
||||
private:
|
||||
@ -856,7 +845,6 @@ class RowAggregationUMP2 : public RowAggregationUM
|
||||
void doAvg(const Row&, int64_t, int64_t, int64_t, bool merge = false) override;
|
||||
void doStatistics(const Row&, int64_t, int64_t, int64_t) override;
|
||||
void doGroupConcat(const Row&, int64_t, int64_t) override;
|
||||
void doJsonAgg(const Row&, int64_t, int64_t) override;
|
||||
void doBitOp(const Row&, int64_t, int64_t, int) override;
|
||||
void doUDAF(const Row&, int64_t, int64_t, int64_t, uint64_t& funcColsIdx,
|
||||
std::vector<mcsv1sdk::mcsv1Context>* rgContextColl = nullptr) override;
|
||||
@ -964,7 +952,6 @@ class RowAggregationSubDistinct : public RowAggregationUM
|
||||
protected:
|
||||
// virtual methods from RowAggregationUM
|
||||
void doGroupConcat(const Row&, int64_t, int64_t) override;
|
||||
void doJsonAgg(const Row&, int64_t, int64_t) override;
|
||||
// for groupby columns and the aggregated distinct column
|
||||
Row fDistRow;
|
||||
boost::scoped_array<uint8_t> fDistRowData;
|
||||
|
Reference in New Issue
Block a user