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

Minor fixes

This commit is contained in:
mariadb-AndreyPiskunov
2022-10-24 16:08:55 +03:00
parent 315e4be2d8
commit b57d2c30fe
5 changed files with 14 additions and 53 deletions

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2014 InfiniDB, Inc. /* Copyright (C) 2022 MariaDB Corporation
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2014 InfiniDB, Inc. /* Copyright (C) 2022 MariaDB Corporation
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License

View File

@ -1,5 +1,4 @@
/* Copyright (C) 2014 InfiniDB, Inc. /* Copyright (C) 2022 MariaDB Corporation
Copyright (C) 2019 MariaDB Corporation
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -64,15 +63,6 @@ using namespace nlohmann;
namespace joblist namespace joblist
{ {
// GroupConcatInfo class implementation
JsonArrayInfo::JsonArrayInfo()
{
}
JsonArrayInfo::~JsonArrayInfo()
{
}
void JsonArrayInfo::prepJsonArray(JobInfo& jobInfo) void JsonArrayInfo::prepJsonArray(JobInfo& jobInfo)
{ {
RetColsVector::iterator i = jobInfo.groupConcatCols.begin(); RetColsVector::iterator i = jobInfo.groupConcatCols.begin();
@ -483,17 +473,16 @@ void JsonArrayAggregator::outputRow(std::ostringstream& oss, const rowgroup::Row
case CalpontSystemCatalog::TEXT: case CalpontSystemCatalog::TEXT:
{ {
std::string maybeJson = row.getStringField(*i); std::string maybeJson = row.getStringField(*i);
try [[maybe_unused]] const auto j = json::parse(maybeJson, nullptr, false);
{ if (j.is_discarded())
[[maybe_unused]] json j = json::parse(maybeJson);
oss << maybeJson.c_str();
break;
}
catch (const json::parse_error& e)
{ {
oss << std::quoted(maybeJson.c_str()); oss << std::quoted(maybeJson.c_str());
break;
} }
else
{
oss << maybeJson.c_str();
}
break;
} }
case CalpontSystemCatalog::DOUBLE: case CalpontSystemCatalog::DOUBLE:
@ -716,7 +705,7 @@ const string JsonArrayAggregator::toString() const
} }
// GroupConcatOrderBy class implementation
JsonArrayAggOrderBy::JsonArrayAggOrderBy() JsonArrayAggOrderBy::JsonArrayAggOrderBy()
{ {
fRule.fIdbCompare = this; fRule.fIdbCompare = this;
@ -941,7 +930,6 @@ const string JsonArrayAggOrderBy::toString() const
} }
// GroupConcatNoOrder class implementation
JsonArrayAggNoOrder::JsonArrayAggNoOrder() JsonArrayAggNoOrder::JsonArrayAggNoOrder()
: fRowsPerRG(128), fErrorCode(ERR_AGGREGATION_TOO_BIG), fMemSize(0), fRm(NULL) : fRowsPerRG(128), fErrorCode(ERR_AGGREGATION_TOO_BIG), fMemSize(0), fRm(NULL)
{ {

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2014 InfiniDB, Inc. /* Copyright (C) 2022 MariaDB Corporation
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -37,37 +37,22 @@
namespace joblist namespace joblist
{ {
// forward reference // forward reference
struct JobInfo;
class JsonArrayAggregator; class JsonArrayAggregator;
class ResourceManager; class ResourceManager;
class JsonArrayInfo class JsonArrayInfo : public GroupConcatInfo
{ {
public: public:
JsonArrayInfo();
virtual ~JsonArrayInfo();
void prepJsonArray(JobInfo&); void prepJsonArray(JobInfo&);
void mapColumns(const rowgroup::RowGroup&); void mapColumns(const rowgroup::RowGroup&);
std::set<uint32_t>& columns()
{
return fColumns;
}
std::vector<rowgroup::SP_GroupConcat>& groupConcat()
{
return fGroupConcat;
}
const std::string toString() const; const std::string toString() const;
protected: protected:
uint32_t getColumnKey(const execplan::SRCP& srcp, JobInfo& jobInfo); uint32_t getColumnKey(const execplan::SRCP& srcp, JobInfo& jobInfo);
boost::shared_array<int> makeMapping(const rowgroup::RowGroup&, const rowgroup::RowGroup&); boost::shared_array<int> makeMapping(const rowgroup::RowGroup&, const rowgroup::RowGroup&);
std::set<uint32_t> fColumns;
std::vector<rowgroup::SP_GroupConcat> fGroupConcat;
}; };
@ -81,23 +66,12 @@ class JsonArrayAggregatAgUM : public GroupConcatAgUM
void initialize(); void initialize();
void processRow(const rowgroup::Row&); void processRow(const rowgroup::Row&);
EXPORT void merge(const rowgroup::Row&, int64_t); EXPORT void merge(const rowgroup::Row&, int64_t);
/*boost::scoped_ptr<JsonArrayAggregator>& concator()
{
return fConcator;
}
*/
EXPORT void getResult(uint8_t*); EXPORT void getResult(uint8_t*);
EXPORT uint8_t* getResult(); EXPORT uint8_t* getResult();
protected: protected:
void applyMapping(const boost::shared_array<int>&, const rowgroup::Row&); void applyMapping(const boost::shared_array<int>&, const rowgroup::Row&);
/*
boost::scoped_ptr<JsonArrayAggregator> fConcator;
boost::scoped_array<uint8_t> fData;
rowgroup::Row fRow;
bool fNoOrder;
*/
}; };
// JSON_ARRAYAGG base // JSON_ARRAYAGG base

View File

@ -4023,7 +4023,6 @@ void RowAggregationUM::setGroupConcatString()
joblist::JsonArrayAggregatAgUM* gccAg = *((joblist::JsonArrayAggregatAgUM**)buff); joblist::JsonArrayAggregatAgUM* gccAg = *((joblist::JsonArrayAggregatAgUM**)buff);
gcString = gccAg->getResult(); gcString = gccAg->getResult();
fRow.setStringField((char*)gcString, fFunctionCols[j]->fOutputColumnIndex); fRow.setStringField((char*)gcString, fFunctionCols[j]->fOutputColumnIndex);
// gccAg->getResult(buff);
} }
} }
} }