|
15 | 15 | import static tech.ydb.yoj.repository.ydb.yql.YqlPredicate.eq;
|
16 | 16 | import static tech.ydb.yoj.repository.ydb.yql.YqlPredicate.gt;
|
17 | 17 | import static tech.ydb.yoj.repository.ydb.yql.YqlPredicate.gte;
|
18 |
| -import static tech.ydb.yoj.repository.ydb.yql.YqlPredicate.likeIgnoreCase; |
19 | 18 | import static tech.ydb.yoj.repository.ydb.yql.YqlPredicate.in;
|
20 | 19 | import static tech.ydb.yoj.repository.ydb.yql.YqlPredicate.like;
|
| 20 | +import static tech.ydb.yoj.repository.ydb.yql.YqlPredicate.likeIgnoreCase; |
21 | 21 | import static tech.ydb.yoj.repository.ydb.yql.YqlPredicate.lt;
|
22 | 22 | import static tech.ydb.yoj.repository.ydb.yql.YqlPredicate.lte;
|
23 | 23 | import static tech.ydb.yoj.repository.ydb.yql.YqlPredicate.neq;
|
24 | 24 | import static tech.ydb.yoj.repository.ydb.yql.YqlPredicate.not;
|
25 |
| -import static tech.ydb.yoj.repository.ydb.yql.YqlPredicate.notLikeIgnoreCase; |
26 | 25 | import static tech.ydb.yoj.repository.ydb.yql.YqlPredicate.notLike;
|
| 26 | +import static tech.ydb.yoj.repository.ydb.yql.YqlPredicate.notLikeIgnoreCase; |
27 | 27 | import static tech.ydb.yoj.repository.ydb.yql.YqlPredicate.where;
|
28 | 28 |
|
29 | 29 | public class YqlPredicateTest {
|
@@ -340,18 +340,35 @@ public void in_negate() {
|
340 | 340 | assertThat(pred.toYql(schema)).isEqualToIgnoringCase("`status` NOT IN ?");
|
341 | 341 | }
|
342 | 342 |
|
| 343 | + @Test |
| 344 | + public void inComplex_single() { |
| 345 | + // id IN (('vla', 42)) <=> (id_zone, id_localId) = ('vla', 42) |
| 346 | + YqlPredicate pred = where("id").in(new FakeComplexEntity.Id("vla", 42)); |
| 347 | + |
| 348 | + assertThat(pred.toYql(complexSchema)).isEqualToIgnoringCase("(`id_zone`, `id_localId`) = ?"); |
| 349 | + } |
| 350 | + |
| 351 | + @Test |
| 352 | + public void inComplex_single_negate() { |
| 353 | + // id NOT IN (('vla', 42)) <=> (id_zone, id_localId) <> ('vla', 42) |
| 354 | + YqlPredicate pred = where("id").in(new FakeComplexEntity.Id("vla", 42)) |
| 355 | + .negate(); |
| 356 | + |
| 357 | + assertThat(pred.toYql(complexSchema)).isEqualToIgnoringCase("(`id_zone`, `id_localId`) <> ?"); |
| 358 | + } |
| 359 | + |
343 | 360 | @Test
|
344 | 361 | public void inComplex() {
|
345 |
| - // id IN ('vla', 42) |
346 |
| - YqlPredicate pred = where("id").in(new YqlPredicateTest.FakeComplexEntity.Id("vla", 42)); |
| 362 | + // id IN (('vla', 42), ('man', 35)) |
| 363 | + YqlPredicate pred = where("id").in(new FakeComplexEntity.Id("vla", 42), new FakeComplexEntity.Id("man", 35)); |
347 | 364 |
|
348 | 365 | assertThat(pred.toYql(complexSchema)).isEqualToIgnoringCase("(`id_zone`, `id_localId`) IN ?");
|
349 | 366 | }
|
350 | 367 |
|
351 | 368 | @Test
|
352 | 369 | public void inComplex_negate() {
|
353 |
| - // id NOT IN ('vla', 42) |
354 |
| - YqlPredicate pred = where("id").in(new YqlPredicateTest.FakeComplexEntity.Id("vla", 42)) |
| 370 | + // id NOT IN (('vla', 42), ('man', 35) |
| 371 | + YqlPredicate pred = where("id").in(new FakeComplexEntity.Id("vla", 42), new FakeComplexEntity.Id("man", 35)) |
355 | 372 | .negate();
|
356 | 373 |
|
357 | 374 | assertThat(pred.toYql(complexSchema)).isEqualToIgnoringCase("(`id_zone`, `id_localId`) NOT IN ?");
|
|
0 commit comments