1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-08-01 06:46:55 +03:00

[MCOL-4699] Add support for circular outer joins.

This commit is contained in:
Denis Khalikov
2022-04-01 19:40:50 +03:00
parent ef8337fd60
commit 636e60b5f9
7 changed files with 971 additions and 183 deletions

View File

@ -28,6 +28,7 @@
#include <stack>
#include <string>
#include <vector>
#include <unordered_map>
#include <boost/shared_ptr.hpp>
#include <boost/uuid/uuid.hpp>
@ -365,6 +366,10 @@ struct JobInfo
std::vector<execplan::ParseTree*> dynamicParseTreeVec;
PrimitiveServerThreadPools primitiveServerThreadPools;
// Represents a `join edges` and `join id` to be restored in `join order` part.
std::map<std::pair<uint32_t, uint32_t>, uint32_t> joinEdgesToRestore;
// Represents a pair of `table` to be on a large side and weight associated with that table.
std::unordered_map<uint32_t, uint32_t> tablesForLargeSide;
private:
// defaults okay

File diff suppressed because it is too large Load Diff

View File

@ -128,19 +128,31 @@ void orExpresssion(const execplan::Operator* op, JobInfo& jobInfo);
// union the queries and return the tuple union step
SJSTEP unionQueries(JobStepVector& queries, uint64_t distinctUnionNum, JobInfo& jobInfo);
// Used for join graph analysis.
// WHITE - node is not processed.
// GREY - node is in process.
// BLACK - node is done.
enum class JoinTableColor
{
WHITE,
GREY,
BLACK
};
struct JoinTableNode
{
bool fVisited;
JoinTableColor fTableColor;
uint32_t fParent;
std::vector<uint32_t> fAdjacentList;
JoinTableNode() : fVisited(false), fParent(-1)
JoinTableNode() : fTableColor(JoinTableColor::WHITE), fParent(UINT_MAX)
{
}
};
using JoinGraph = std::map<uint32_t, JoinTableNode>;
using JoinEdges = std::set<pair<uint32_t, uint32_t>>;
using Cycles = std::vector<std::vector<std::pair<uint32_t, uint32_t>>>;
using Cycle = std::vector<std::pair<uint32_t, uint32_t>>;
using PostJoinFilterKeys = std::vector<std::pair<std::pair<uint32_t, uint32_t>, std::vector<uint32_t>>>;
using JoinEdge = std::pair<uint32_t, uint32_t>;
using JoinEdges = std::set<JoinEdge>;
using Cycle = std::vector<JoinEdge>;
using Cycles = std::vector<std::vector<JoinEdge>>;
using PostJoinFilterKeys = std::vector<std::pair<JoinEdge, std::vector<uint32_t>>>;
} // namespace joblist

View File

@ -1092,7 +1092,8 @@ const string TupleHashJoinStep::toString() const
{
ostringstream oss;
size_t idlsz = fInputJobStepAssociation.outSize();
idbassert(idlsz > 1);
// Avoid assertion on empty `TupleHashJoinStep`.
idbassert(idlsz > 1 || idlsz == 0);
oss << "TupleHashJoinStep ses:" << fSessionId << " st:" << fStepId;
oss << omitOidInDL;
@ -1184,6 +1185,7 @@ void TupleHashJoinStep::configJoinKeyIndex(const vector<JoinType>& jt, const vec
{
joinTypes.insert(joinTypes.begin(), jt.begin(), jt.end());
typelessJoin.insert(typelessJoin.begin(), typeless.begin(), typeless.end());
smallSideKeys.insert(smallSideKeys.begin(), smallkey.begin(), smallkey.end());
largeSideKeys.insert(largeSideKeys.begin(), largekey.begin(), largekey.end());
#ifdef JLF_DEBUG