Skip to content

Commit d7e65a4

Browse files
committed
Apply Pavel review suggestions
1 parent f492950 commit d7e65a4

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

axiom/optimizer/Optimization.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,9 @@ bool isIndexColocated(
482482
input->distribution().maybeNeedsShuffle(distribution)) {
483483
return !*needsShuffle;
484484
}
485+
// TODO: Future partition type should be accounted.
486+
// TODO: This code actually doesn't feel right.
487+
// We should check it when we will add indexes.
485488
// True if 'input' is partitioned so that each partitioning key is joined to
486489
// the corresponding partition key in 'info'.
487490
for (size_t i = 0; i < input->distribution().partition.size(); ++i) {

axiom/optimizer/Schema.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -367,22 +367,23 @@ std::optional<bool> Distribution::maybeNeedsShuffle(
367367
// One is gather, the other is not, repartitioning needed.
368368
return true;
369369
}
370-
if (partition.size() != desired.partition.size()) {
371-
// Different number of partition keys, repartitioning needed.
372-
// TODO: Future partition type should decide this.
373-
return true;
374-
}
375370
return std::nullopt;
376371
}
377372

378373
bool Distribution::needsShuffle(const Distribution& desired) const {
379374
if (auto maybe = maybeNeedsShuffle(desired)) {
380375
return *maybe;
381376
}
377+
// TODO: Future partition type should decide this.
378+
// For an example range partitioning may not need shuffle if
379+
// the ranges are compatible, e.g. "a, b, c" and "a, b".
380+
if (partition.size() != desired.partition.size()) {
381+
// Different number of partition keys, repartitioning needed.
382+
return true;
383+
}
382384
for (size_t i = 0; i < partition.size(); ++i) {
383385
if (!partition[i]->sameOrEqual(*desired.partition[i])) {
384386
// Different partition key, repartitioning needed.
385-
// TODO: Future partition type should decide this.
386387
return true;
387388
}
388389
}

0 commit comments

Comments
 (0)