New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[multistage]partition assignment refactor #12079
[multistage]partition assignment refactor #12079
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #12079 +/- ##
============================================
- Coverage 61.68% 61.48% -0.20%
- Complexity 1151 1153 +2
============================================
Files 2391 2406 +15
Lines 130211 130851 +640
Branches 20141 20218 +77
============================================
+ Hits 80317 80457 +140
- Misses 44046 44513 +467
- Partials 5848 5881 +33
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
ad29058
to
78f9d7a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CC @Jackie-Jiang to take a look
@@ -58,15 +58,22 @@ | |||
public class WorkerManager { | |||
private static final Logger LOGGER = LoggerFactory.getLogger(WorkerManager.class); | |||
private static final Random RANDOM = new Random(); | |||
private static final String DEFAULT_PARTITION_FUNCTION = "Hashcode"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure if this is the best way to go. i am also ok with having to ask this pass in as mandatory
} | ||
|
||
private ColocatedTableInfo getColocatedTableInfo(String tableName, String partitionKey, int numPartitions) { | ||
private ColocatedTableInfo getColocatedTableInfo(String tableName, String partitionKey, int numPartitions, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
technically the class should be named "PartitionTableInfo". this doesn't indicate "co-locate" at all
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Either change it or add a TODO
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
{ | ||
"description": "hint table without partitioning should throw exception", | ||
"sql": "EXPLAIN PLAN FOR SELECT * FROM d /*+ tableOptions(partition_key='col1', partition_size='4') */ LIMIT 10", | ||
"expectedException": "Error composing query plan for:.*" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: fix this test, it should always check the nested reason b/c that's always wrapped in parser throw or planner throw. doesn't make sense to check just the top level msg
"ignored": true, | ||
"comment": "partition parallelism mismatched in hint, this query shouldn't work at all", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
previously we decided to allow this but i guess we should not. putting an ignore here first but i think we should not allow this and should throw exception
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note: allowed here but it will revert back to generic assignment
this field is to indicate whether the exchange (or mailbox) requires to reshuffle the data isPartition semantically means if the data is already partitioned, which can be true, just not the same partition as the mailbox/exchange expects
fix several rebase error
a63a686
to
325c1b2
Compare
1. we don't support rehash by pre-hash method (exchange doesn't support the same with table) so check all pre-partition instead of check single child 2. set default for exchange and default for table separately 3. fix tests
...-planner/src/main/java/org/apache/pinot/query/planner/physical/DispatchablePlanMetadata.java
Show resolved
Hide resolved
} | ||
|
||
private ColocatedTableInfo getColocatedTableInfo(String tableName, String partitionKey, int numPartitions) { | ||
private ColocatedTableInfo getColocatedTableInfo(String tableName, String partitionKey, int numPartitions, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Either change it or add a TODO
Preconditions.checkState(numPartitions > 0, "'%s' must be positive, got: %s", | ||
PinotHintOptions.TableHintOptions.PARTITION_SIZE, numPartitions); | ||
|
||
String partitionFunction = tableOptions.getOrDefault(PinotHintOptions.TableHintOptions.PARTITION_FUNCTION, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't add default. In most cases this is murmur
but we should not assume it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this would be backward-incompatible, all existing queries with table hints without hash function will fail
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Understood. Currently we assume all table options using the same partition function. Putting Murmur
as the default might be safer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
// leaf-to-intermediate condition | ||
return numSenders * sender.getPartitionParallelism() == numReceivers | ||
&& sender.getPartitionFunction() != null | ||
&& sender.getPartitionFunction().equals(receiver.getPartitionFunction()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should compare ignore cases
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
* reword isPartition --> to isPrePartitioned this field is to indicate whether the exchange (or mailbox) requires to reshuffle the data isPartition semantically means if the data is already partitioned, which can be true, just not the same partition as the mailbox/exchange expects * allow partition info to pull all the way through * adding hash-function as part of the physical plan info only 2 partition functions are supported, one from table; one from shuffle (shuffle is non-configurable at the moment) * limitation: we don't support rehash by pre-hash method (exchange doesn't support the same with table) so check all children for pre-partition is necessary instead of just checking single child * clean ups: rename colocated to partition table info; compare partition function in case insensitive manner; changing default to murmur and modify all tests --------- Co-authored-by: Rong Rong <rongr@startree.ai>
step 2 in #12015
this PR:
tableOptions
- e.g. assigned as table partitionWork List
TODO: