Skip to content

Commit 287241f

Browse files
authored
Merge branch 'main' into feature/dope-239-object-funcitons
2 parents c3712b7 + 2c5f4c6 commit 287241f

7 files changed

Lines changed: 561 additions & 349 deletions

File tree

core/src/main/kotlin/ch/ergon/dope/resolvable/clause/ISelectClause.kt

Lines changed: 78 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,12 @@ import ch.ergon.dope.resolvable.clause.model.AliasedUnnestClause
1010
import ch.ergon.dope.resolvable.clause.model.DopeVariable
1111
import ch.ergon.dope.resolvable.clause.model.FromClause
1212
import ch.ergon.dope.resolvable.clause.model.GroupByClause
13-
import ch.ergon.dope.resolvable.clause.model.InnerJoinClause
14-
import ch.ergon.dope.resolvable.clause.model.LeftJoinClause
13+
import ch.ergon.dope.resolvable.clause.model.InnerJoinOnConditionClause
14+
import ch.ergon.dope.resolvable.clause.model.InnerJoinOnKeyClause
15+
import ch.ergon.dope.resolvable.clause.model.InnerJoinOnKeysClause
16+
import ch.ergon.dope.resolvable.clause.model.LeftJoinOnConditionClause
17+
import ch.ergon.dope.resolvable.clause.model.LeftJoinOnKeyClause
18+
import ch.ergon.dope.resolvable.clause.model.LeftJoinOnKeysClause
1519
import ch.ergon.dope.resolvable.clause.model.LetClause
1620
import ch.ergon.dope.resolvable.clause.model.OrderExpression
1721
import ch.ergon.dope.resolvable.clause.model.OrderType
@@ -20,7 +24,9 @@ import ch.ergon.dope.resolvable.clause.model.SelectLimitClause
2024
import ch.ergon.dope.resolvable.clause.model.SelectOffsetClause
2125
import ch.ergon.dope.resolvable.clause.model.SelectOrderByClause
2226
import ch.ergon.dope.resolvable.clause.model.SelectWhereClause
23-
import ch.ergon.dope.resolvable.clause.model.StandardJoinClause
27+
import ch.ergon.dope.resolvable.clause.model.StandardJoinOnConditionClause
28+
import ch.ergon.dope.resolvable.clause.model.StandardJoinOnKeyClause
29+
import ch.ergon.dope.resolvable.clause.model.StandardJoinOnKeysClause
2430
import ch.ergon.dope.resolvable.clause.model.UnnestClause
2531
import ch.ergon.dope.resolvable.clause.model.WindowClause
2632
import ch.ergon.dope.resolvable.clause.model.WindowDeclaration
@@ -33,6 +39,7 @@ import ch.ergon.dope.resolvable.expression.type.toDopeType
3339
import ch.ergon.dope.validtype.ArrayType
3440
import ch.ergon.dope.validtype.BooleanType
3541
import ch.ergon.dope.validtype.NumberType
42+
import ch.ergon.dope.validtype.StringType
3643
import ch.ergon.dope.validtype.ValidType
3744

3845
interface ISelectOffsetClause<T : ValidType> : Clause {
@@ -85,76 +92,121 @@ interface ISelectLetClause<T : ValidType> : ISelectFromClause<T> {
8592
interface ISelectJoinClause<T : ValidType> : ISelectLetClause<T> {
8693
fun join(
8794
joinable: Joinable,
88-
onCondition: TypeExpression<BooleanType>,
95+
condition: TypeExpression<BooleanType>,
8996
hashOrNestedLoopHint: HashOrNestedLoopHint? = null,
9097
keysOrIndexHint: KeysOrIndexHint? = null,
91-
) = StandardJoinClause(joinable, onCondition, hashOrNestedLoopHint, keysOrIndexHint, this)
98+
) = StandardJoinOnConditionClause(joinable, condition, hashOrNestedLoopHint, keysOrIndexHint, this)
9299

93100
fun join(
94101
joinable: Joinable,
95-
onKeys: Field<out ValidType>,
102+
keys: TypeExpression<ArrayType<StringType>>,
96103
hashOrNestedLoopHint: HashOrNestedLoopHint? = null,
97104
keysOrIndexHint: KeysOrIndexHint? = null,
98-
) = StandardJoinClause(joinable, onKeys, hashOrNestedLoopHint, keysOrIndexHint, this)
105+
) = StandardJoinOnKeysClause(joinable, keys, hashOrNestedLoopHint, keysOrIndexHint, this)
99106

100107
fun join(
101108
joinable: Joinable,
102-
onKey: Field<out ValidType>,
103-
forBucket: Bucket,
109+
keys: Collection<String>,
104110
hashOrNestedLoopHint: HashOrNestedLoopHint? = null,
105111
keysOrIndexHint: KeysOrIndexHint? = null,
106-
) = StandardJoinClause(joinable, onKey, forBucket, hashOrNestedLoopHint, keysOrIndexHint, this)
112+
) = join(joinable, keys.toDopeType(), hashOrNestedLoopHint, keysOrIndexHint)
113+
114+
fun join(
115+
joinable: Joinable,
116+
key: TypeExpression<StringType>,
117+
bucket: Bucket? = null,
118+
hashOrNestedLoopHint: HashOrNestedLoopHint? = null,
119+
keysOrIndexHint: KeysOrIndexHint? = null,
120+
) = StandardJoinOnKeyClause(joinable, key, bucket, hashOrNestedLoopHint, keysOrIndexHint, this)
121+
122+
fun join(
123+
joinable: Joinable,
124+
keys: String,
125+
bucket: Bucket? = null,
126+
hashOrNestedLoopHint: HashOrNestedLoopHint? = null,
127+
keysOrIndexHint: KeysOrIndexHint? = null,
128+
) = join(joinable, keys.toDopeType(), bucket, hashOrNestedLoopHint, keysOrIndexHint)
129+
130+
fun innerJoin(
131+
joinable: Joinable,
132+
condition: TypeExpression<BooleanType>,
133+
hashOrNestedLoopHint: HashOrNestedLoopHint? = null,
134+
keysOrIndexHint: KeysOrIndexHint? = null,
135+
) = InnerJoinOnConditionClause(joinable, condition, hashOrNestedLoopHint, keysOrIndexHint, this)
107136

108137
fun innerJoin(
109138
joinable: Joinable,
110-
onCondition: TypeExpression<BooleanType>,
139+
keys: TypeExpression<ArrayType<StringType>>,
111140
hashOrNestedLoopHint: HashOrNestedLoopHint? = null,
112141
keysOrIndexHint: KeysOrIndexHint? = null,
113-
) = InnerJoinClause(joinable, onCondition, hashOrNestedLoopHint, keysOrIndexHint, this)
142+
) = InnerJoinOnKeysClause(joinable, keys, hashOrNestedLoopHint, keysOrIndexHint, this)
114143

115144
fun innerJoin(
116145
joinable: Joinable,
117-
onKeys: Field<out ValidType>,
146+
keys: Collection<String>,
118147
hashOrNestedLoopHint: HashOrNestedLoopHint? = null,
119148
keysOrIndexHint: KeysOrIndexHint? = null,
120-
) = InnerJoinClause(joinable, onKeys, hashOrNestedLoopHint, keysOrIndexHint, this)
149+
) = innerJoin(joinable, keys.toDopeType(), hashOrNestedLoopHint, keysOrIndexHint)
121150

122151
fun innerJoin(
123152
joinable: Joinable,
124-
onKey: Field<out ValidType>,
125-
forBucket: Bucket,
153+
key: TypeExpression<StringType>,
154+
bucket: Bucket? = null,
155+
hashOrNestedLoopHint: HashOrNestedLoopHint? = null,
156+
keysOrIndexHint: KeysOrIndexHint? = null,
157+
) = InnerJoinOnKeyClause(joinable, key, bucket, hashOrNestedLoopHint, keysOrIndexHint, this)
158+
159+
fun innerJoin(
160+
joinable: Joinable,
161+
key: String,
162+
bucket: Bucket? = null,
163+
hashOrNestedLoopHint: HashOrNestedLoopHint? = null,
164+
keysOrIndexHint: KeysOrIndexHint? = null,
165+
) = innerJoin(joinable, key.toDopeType(), bucket, hashOrNestedLoopHint, keysOrIndexHint)
166+
167+
fun leftJoin(
168+
joinable: Joinable,
169+
condition: TypeExpression<BooleanType>,
170+
hashOrNestedLoopHint: HashOrNestedLoopHint? = null,
171+
keysOrIndexHint: KeysOrIndexHint? = null,
172+
) = LeftJoinOnConditionClause(joinable, condition, hashOrNestedLoopHint, keysOrIndexHint, this)
173+
174+
fun leftJoin(
175+
joinable: Joinable,
176+
keys: TypeExpression<ArrayType<StringType>>,
126177
hashOrNestedLoopHint: HashOrNestedLoopHint? = null,
127178
keysOrIndexHint: KeysOrIndexHint? = null,
128-
) = InnerJoinClause(joinable, onKey, forBucket, hashOrNestedLoopHint, keysOrIndexHint, this)
179+
) = LeftJoinOnKeysClause(joinable, keys, hashOrNestedLoopHint, keysOrIndexHint, this)
129180

130181
fun leftJoin(
131182
joinable: Joinable,
132-
onCondition: TypeExpression<BooleanType>,
183+
keys: Collection<String>,
133184
hashOrNestedLoopHint: HashOrNestedLoopHint? = null,
134185
keysOrIndexHint: KeysOrIndexHint? = null,
135-
) = LeftJoinClause(joinable, onCondition, hashOrNestedLoopHint, keysOrIndexHint, this)
186+
) = leftJoin(joinable, keys.toDopeType(), hashOrNestedLoopHint, keysOrIndexHint)
136187

137188
fun leftJoin(
138189
joinable: Joinable,
139-
onKeys: Field<out ValidType>,
190+
key: TypeExpression<StringType>,
191+
bucket: Bucket? = null,
140192
hashOrNestedLoopHint: HashOrNestedLoopHint? = null,
141193
keysOrIndexHint: KeysOrIndexHint? = null,
142-
) = LeftJoinClause(joinable, onKeys, hashOrNestedLoopHint, keysOrIndexHint, this)
194+
) = LeftJoinOnKeyClause(joinable, key, bucket, hashOrNestedLoopHint, keysOrIndexHint, this)
143195

144196
fun leftJoin(
145197
joinable: Joinable,
146-
onKey: Field<out ValidType>,
147-
forBucket: Bucket,
198+
keys: String,
199+
bucket: Bucket? = null,
148200
hashOrNestedLoopHint: HashOrNestedLoopHint? = null,
149201
keysOrIndexHint: KeysOrIndexHint? = null,
150-
) = LeftJoinClause(joinable, onKey, forBucket, hashOrNestedLoopHint, keysOrIndexHint, this)
202+
) = leftJoin(joinable, keys.toDopeType(), bucket, hashOrNestedLoopHint, keysOrIndexHint)
151203

152204
fun rightJoin(
153205
joinable: Joinable,
154-
onCondition: TypeExpression<BooleanType>,
206+
condition: TypeExpression<BooleanType>,
155207
hashOrNestedLoopHint: HashOrNestedLoopHint? = null,
156208
keysOrIndexHint: KeysOrIndexHint? = null,
157-
) = RightJoinClause(joinable, onCondition, hashOrNestedLoopHint, keysOrIndexHint, this)
209+
) = RightJoinClause(joinable, condition, hashOrNestedLoopHint, keysOrIndexHint, this)
158210
}
159211

160212
interface ISelectUnnestClause<T : ValidType> : ISelectJoinClause<T> {

0 commit comments

Comments
 (0)