-
Notifications
You must be signed in to change notification settings - Fork 1
/
LogicalEquiJoin.cpp
152 lines (142 loc) · 6.03 KB
/
LogicalEquiJoin.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
/*
**
* BEGIN_COPYRIGHT
*
* Copyright (C) 2008-2016 SciDB, Inc.
* All Rights Reserved.
*
* equi_join is a plugin for SciDB, an Open Source Array DBMS maintained
* by Paradigm4. See http://www.paradigm4.com/
*
* equi_join is free software: you can redistribute it and/or modify
* it under the terms of the AFFERO GNU General Public License as published by
* the Free Software Foundation.
*
* equi_join is distributed "AS-IS" AND WITHOUT ANY WARRANTY OF ANY KIND,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY,
* NON-INFRINGEMENT, OR FITNESS FOR A PARTICULAR PURPOSE. See
* the AFFERO GNU General Public License for the complete license terms.
*
* You should have received a copy of the AFFERO GNU General Public License
* along with equi_join. If not, see <http://www.gnu.org/licenses/agpl-3.0.html>
*
* END_COPYRIGHT
*/
#define LEGACY_API
#include "query/LogicalOperator.h"
#include "EquiJoinSettings.h"
#include "ArrayIO.h"
namespace scidb
{
using namespace std;
using namespace equi_join;
class LogicalEquiJoin : public LogicalOperator
{
public:
LogicalEquiJoin(const string& logicalName, const string& alias):
LogicalOperator(logicalName, alias)
{
}
static PlistSpec const* makePlistSpec()
{
static PlistSpec argSpec {
{ "", // positionals
RE(RE::LIST, {
RE(PP(PLACEHOLDER_INPUT)),
RE(PP(PLACEHOLDER_INPUT)),
RE(RE::STAR, {
RE(PP(PLACEHOLDER_CONSTANT, TID_STRING))
})
})
},
{ KW_LEFT_IDS, RE(RE::OR, {
RE(PP(PLACEHOLDER_EXPRESSION, TID_INT64)),
RE(RE::GROUP, {
RE(PP(PLACEHOLDER_EXPRESSION, TID_INT64)),
RE(RE::PLUS, {
RE(PP(PLACEHOLDER_EXPRESSION, TID_INT64))
})
})
})
},
{ KW_RIGHT_IDS, RE(RE::OR, {
RE(PP(PLACEHOLDER_EXPRESSION, TID_INT64)),
RE(RE::GROUP, {
RE(PP(PLACEHOLDER_EXPRESSION, TID_INT64)),
RE(RE::PLUS, {
RE(PP(PLACEHOLDER_EXPRESSION, TID_INT64))
})
})
})
},
{ KW_LEFT_NAMES, RE(RE::OR, {
RE(RE::OR, {
RE(PP(PLACEHOLDER_DIMENSION_NAME)),
RE(PP(PLACEHOLDER_ATTRIBUTE_NAME))
}),
RE(RE::GROUP, {
RE(RE::OR, {
RE(PP(PLACEHOLDER_DIMENSION_NAME)),
RE(PP(PLACEHOLDER_ATTRIBUTE_NAME))
}),
RE(RE::PLUS, {
RE(RE::OR, {
RE(PP(PLACEHOLDER_DIMENSION_NAME)),
RE(PP(PLACEHOLDER_ATTRIBUTE_NAME))
})
})
})
})
},
{ KW_RIGHT_NAMES, RE(RE::OR, {
RE(RE::OR, {
RE(PP(PLACEHOLDER_DIMENSION_NAME)),
RE(PP(PLACEHOLDER_ATTRIBUTE_NAME))
}),
RE(RE::GROUP, {
RE(RE::OR, {
RE(PP(PLACEHOLDER_DIMENSION_NAME)),
RE(PP(PLACEHOLDER_ATTRIBUTE_NAME))
}),
RE(RE::PLUS, {
RE(RE::OR, {
RE(PP(PLACEHOLDER_DIMENSION_NAME)),
RE(PP(PLACEHOLDER_ATTRIBUTE_NAME))
})
})
})
})
},
{ KW_HASH_JOIN_THRES, RE(PP(PLACEHOLDER_CONSTANT, TID_INT64)) },
{ KW_CHUNK_SIZE, RE(PP(PLACEHOLDER_CONSTANT, TID_INT64)) },
{ KW_ALGORITHM, RE(PP(PLACEHOLDER_CONSTANT, TID_STRING)) },
{ KW_KEEP_DIMS, RE(PP(PLACEHOLDER_CONSTANT, TID_BOOL)) },
{ KW_BLOOM_FILT_SZ, RE(PP(PLACEHOLDER_CONSTANT, TID_INT64)) },
// { KW_FILTER, RE(PP(PLACEHOLDER_EXPRESSION, TID_BOOL)) },
{ KW_FILTER, RE(PP(PLACEHOLDER_CONSTANT, TID_STRING)) },
{ KW_LEFT_OUTER, RE(PP(PLACEHOLDER_EXPRESSION, TID_BOOL)) },
{ KW_RIGHT_OUTER, RE(PP(PLACEHOLDER_EXPRESSION, TID_BOOL)) },
{ KW_OUT_NAMES, RE(RE::OR, {
RE(PP(PLACEHOLDER_ATTRIBUTE_NAME).setMustExist(false)),
RE(RE::GROUP, {
RE(PP(PLACEHOLDER_ATTRIBUTE_NAME).setMustExist(false)),
RE(RE::PLUS, {
RE(PP(PLACEHOLDER_ATTRIBUTE_NAME).setMustExist(false))
})
})
})
}
};
return &argSpec;
}
ArrayDesc inferSchema(vector< ArrayDesc> schemas, shared_ptr< Query> query)
{
vector<ArrayDesc const*> inputSchemas;
inputSchemas.push_back(&(schemas[0]));
inputSchemas.push_back(&(schemas[1]));
Settings settings(inputSchemas, _parameters, _kwParameters, query);
return settings.getOutputSchema(query);
}
};
REGISTER_LOGICAL_OPERATOR_FACTORY(LogicalEquiJoin, "equi_join");
}