Commit ee04df4
authored
Add entitySubType param to BasePersistence.listEntities (#2317)
`BasePersistence.listEntities` has 3 variants:
```
Page<EntityNameLookupRecord> listEntities(..., PageToken);
Page<EntityNameLookupRecord> listEntities(..., Predicate<PolarisBaseEntity>, PageToken)
<T> Page<T> listEntities(..., Predicate<PolarisBaseEntity>, Function<PolarisBaseEntity, T>, PageToken);
```
the 1st method exists to only return the subset of entity properties required to build an `EntityNameLookupRecord`.
the 3rd method supports a predicate and transformer function on the underlying `PolarisBaseEntity`, which means it has to load all entity properties.
the 2nd method is weird as it supports a full `Predicate<PolarisBaseEntity>`, which means it has to load all entity properties under the hood for filtering but then throws most of them away to return a `EntityNameLookupRecord`.
this explains why the implementations of the 2nd method simply forward to the 3rd method usually.
any performance benefits of returning a `EntityNameLookupRecord` are lost.
as it turns out the 2nd method is only used, because methods 1 and 3 dont support passing a `PolarisEntitySubType` parameter to filter down the retrieved data.
Note that the sub type property is available from both the `PolarisBaseEntity` as well as the `EntityNameLookupRecord`.
By adding this parameter, the 2nd method can go away completely.
we can even push down the sub type filtering into the queries of some of our persistence implementations.
other existing implementations are free to decide whether they want to push it down as well or filter on the query results in memory.
note that since we have no `TransactionalPersistence` implementation in the codebase that provides an optimized variant of method 1 we can have a default method in the interface that forwards to method 3.1 parent cdb58e5 commit ee04df4
File tree
9 files changed
+73
-167
lines changed- persistence
- eclipselink/src/main/java/org/apache/polaris/extension/persistence/impl/eclipselink
- relational-jdbc/src/main/java/org/apache/polaris/persistence/relational/jdbc
- polaris-core/src/main/java/org/apache/polaris/core/persistence
- transactional
9 files changed
+73
-167
lines changedLines changed: 3 additions & 40 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
23 | 22 | | |
24 | 23 | | |
25 | 24 | | |
| |||
49 | 48 | | |
50 | 49 | | |
51 | 50 | | |
| 51 | + | |
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| |||
424 | 424 | | |
425 | 425 | | |
426 | 426 | | |
427 | | - | |
428 | | - | |
429 | | - | |
430 | | - | |
431 | | - | |
432 | | - | |
433 | | - | |
434 | | - | |
435 | | - | |
436 | | - | |
437 | | - | |
438 | | - | |
439 | | - | |
440 | | - | |
441 | | - | |
442 | | - | |
443 | | - | |
444 | | - | |
445 | | - | |
446 | | - | |
447 | | - | |
448 | | - | |
449 | | - | |
450 | | - | |
451 | | - | |
452 | | - | |
453 | | - | |
454 | | - | |
455 | | - | |
456 | | - | |
457 | | - | |
458 | | - | |
459 | | - | |
460 | | - | |
461 | | - | |
462 | | - | |
463 | | - | |
464 | | - | |
465 | 427 | | |
466 | 428 | | |
467 | 429 | | |
468 | 430 | | |
469 | 431 | | |
470 | 432 | | |
| 433 | + | |
471 | 434 | | |
472 | 435 | | |
473 | 436 | | |
474 | 437 | | |
475 | 438 | | |
476 | 439 | | |
477 | 440 | | |
478 | | - | |
| 441 | + | |
479 | 442 | | |
480 | 443 | | |
481 | 444 | | |
| |||
Lines changed: 10 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| 35 | + | |
35 | 36 | | |
36 | 37 | | |
37 | 38 | | |
| |||
289 | 290 | | |
290 | 291 | | |
291 | 292 | | |
| 293 | + | |
292 | 294 | | |
293 | 295 | | |
294 | 296 | | |
| |||
298 | 300 | | |
299 | 301 | | |
300 | 302 | | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
301 | 307 | | |
302 | 308 | | |
303 | 309 | | |
| |||
314 | 320 | | |
315 | 321 | | |
316 | 322 | | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
317 | 327 | | |
318 | 328 | | |
319 | 329 | | |
| |||
Lines changed: 12 additions & 20 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
| 47 | + | |
47 | 48 | | |
48 | 49 | | |
49 | 50 | | |
| |||
427 | 428 | | |
428 | 429 | | |
429 | 430 | | |
| 431 | + | |
430 | 432 | | |
| 433 | + | |
431 | 434 | | |
432 | 435 | | |
433 | 436 | | |
434 | 437 | | |
435 | 438 | | |
| 439 | + | |
436 | 440 | | |
437 | 441 | | |
438 | 442 | | |
439 | 443 | | |
440 | 444 | | |
441 | | - | |
442 | | - | |
443 | | - | |
444 | | - | |
445 | | - | |
446 | | - | |
447 | | - | |
448 | | - | |
449 | | - | |
450 | | - | |
451 | | - | |
452 | | - | |
453 | | - | |
454 | | - | |
455 | | - | |
456 | | - | |
457 | | - | |
458 | | - | |
459 | | - | |
460 | 445 | | |
461 | 446 | | |
462 | 447 | | |
463 | 448 | | |
464 | 449 | | |
465 | 450 | | |
466 | | - | |
| 451 | + | |
| 452 | + | |
467 | 453 | | |
468 | 454 | | |
469 | 455 | | |
| |||
479 | 465 | | |
480 | 466 | | |
481 | 467 | | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
482 | 474 | | |
483 | 475 | | |
484 | 476 | | |
| |||
Lines changed: 3 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
35 | 34 | | |
36 | 35 | | |
37 | 36 | | |
| |||
709 | 708 | | |
710 | 709 | | |
711 | 710 | | |
712 | | - | |
713 | | - | |
714 | | - | |
715 | | - | |
716 | | - | |
717 | | - | |
718 | 711 | | |
719 | | - | |
| 712 | + | |
720 | 713 | | |
721 | 714 | | |
722 | 715 | | |
| |||
1183 | 1176 | | |
1184 | 1177 | | |
1185 | 1178 | | |
| 1179 | + | |
1186 | 1180 | | |
1187 | 1181 | | |
1188 | 1182 | | |
| |||
1504 | 1498 | | |
1505 | 1499 | | |
1506 | 1500 | | |
| 1501 | + | |
1507 | 1502 | | |
1508 | 1503 | | |
1509 | 1504 | | |
| |||
Lines changed: 5 additions & 21 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| 35 | + | |
35 | 36 | | |
36 | 37 | | |
37 | 38 | | |
| |||
275 | 276 | | |
276 | 277 | | |
277 | 278 | | |
| 279 | + | |
278 | 280 | | |
279 | 281 | | |
280 | 282 | | |
| |||
284 | 286 | | |
285 | 287 | | |
286 | 288 | | |
287 | | - | |
288 | | - | |
289 | | - | |
290 | | - | |
291 | | - | |
292 | | - | |
293 | | - | |
294 | | - | |
295 | | - | |
296 | | - | |
297 | | - | |
298 | | - | |
299 | | - | |
300 | | - | |
301 | | - | |
302 | | - | |
303 | | - | |
304 | | - | |
305 | | - | |
306 | | - | |
307 | | - | |
| 289 | + | |
308 | 290 | | |
309 | 291 | | |
310 | 292 | | |
| |||
314 | 296 | | |
315 | 297 | | |
316 | 298 | | |
| 299 | + | |
317 | 300 | | |
318 | 301 | | |
319 | 302 | | |
| |||
326 | 309 | | |
327 | 310 | | |
328 | 311 | | |
| 312 | + | |
329 | 313 | | |
330 | 314 | | |
331 | 315 | | |
| |||
Lines changed: 12 additions & 17 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
34 | 35 | | |
35 | 36 | | |
36 | 37 | | |
| |||
359 | 360 | | |
360 | 361 | | |
361 | 362 | | |
362 | | - | |
363 | | - | |
364 | | - | |
365 | | - | |
366 | | - | |
367 | | - | |
368 | | - | |
369 | | - | |
370 | | - | |
371 | | - | |
372 | | - | |
373 | | - | |
374 | | - | |
375 | | - | |
376 | | - | |
| 363 | + | |
377 | 364 | | |
378 | 365 | | |
379 | 366 | | |
380 | 367 | | |
381 | 368 | | |
382 | | - | |
| 369 | + | |
383 | 370 | | |
384 | 371 | | |
385 | 372 | | |
| |||
390 | 377 | | |
391 | 378 | | |
392 | 379 | | |
| 380 | + | |
393 | 381 | | |
394 | 382 | | |
395 | 383 | | |
396 | 384 | | |
397 | 385 | | |
398 | 386 | | |
399 | 387 | | |
400 | | - | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
401 | 396 | | |
402 | 397 | | |
403 | 398 | | |
| |||
Lines changed: 3 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
34 | 33 | | |
35 | 34 | | |
36 | 35 | | |
| |||
708 | 707 | | |
709 | 708 | | |
710 | 709 | | |
711 | | - | |
712 | | - | |
713 | | - | |
714 | | - | |
715 | | - | |
716 | | - | |
717 | 710 | | |
718 | 711 | | |
719 | 712 | | |
720 | 713 | | |
721 | 714 | | |
722 | 715 | | |
723 | 716 | | |
724 | | - | |
| 717 | + | |
725 | 718 | | |
726 | 719 | | |
727 | 720 | | |
| |||
1385 | 1378 | | |
1386 | 1379 | | |
1387 | 1380 | | |
| 1381 | + | |
1388 | 1382 | | |
1389 | 1383 | | |
1390 | 1384 | | |
| |||
1958 | 1952 | | |
1959 | 1953 | | |
1960 | 1954 | | |
| 1955 | + | |
1961 | 1956 | | |
1962 | 1957 | | |
1963 | 1958 | | |
| |||
0 commit comments