somandal commented on code in PR #11234: URL: https://github.com/apache/pinot/pull/11234#discussion_r1283602150
########## pinot-query-planner/src/test/resources/queries/PinotHintablePlans.json: ########## @@ -1,33 +1,19 @@ { "pinot_hint_option_tests": { "queries": [ - { - "description": "SELECT * inner join with filter on one table", - "sql": "EXPLAIN PLAN FOR SELECT /*+ joinOptions(is_colocated_by_join_keys='true') */ * FROM a JOIN b ON a.col1 = b.col2 WHERE a.col3 >= 0", - "output": [ - "Execution Plan", - "\nLogicalJoin(condition=[=($0, $8)], joinType=[inner])", - "\n PinotLogicalExchange(distribution=[single])", - "\n LogicalFilter(condition=[>=($2, 0)])", - "\n LogicalTableScan(table=[[a]])", - "\n PinotLogicalExchange(distribution=[single])", - "\n LogicalTableScan(table=[[b]])", - "\n" - ] - }, { "description": "Inner join with group by", - "sql": "EXPLAIN PLAN FOR SELECT /*+ joinOptions(is_colocated_by_join_keys='true'), aggOptions(is_partitioned_by_group_by_keys='true') */a.col1, AVG(b.col3) FROM a JOIN b ON a.col1 = b.col2 WHERE a.col3 >= 0 AND a.col2 = 'a' AND b.col3 < 0 GROUP BY a.col1", + "sql": "EXPLAIN PLAN FOR SELECT /*+ aggOptions(is_partitioned_by_group_by_keys='true') */ a.col1, AVG(b.col3) FROM a JOIN b ON a.col1 = b.col2 WHERE a.col3 >= 0 AND a.col2 = 'a' AND b.col3 < 0 GROUP BY a.col1", Review Comment: it'll be good to have a few planner side tests that use both the `aggOptions` for `is_partitioned_by_group_by_keys` and use the newly table options for partitioning. One which also uses the join option to set dynamic_broadcast with table partitioning and `is_partitioned_by_group_by_keys` `aggOption` as well ########## pinot-query-planner/src/test/resources/queries/PinotHintablePlans.json: ########## @@ -1,33 +1,19 @@ { "pinot_hint_option_tests": { "queries": [ - { Review Comment: why not add some planner tests for the tableOptions for partition key + num partitions? ########## pinot-query-planner/src/main/java/org/apache/pinot/query/routing/WorkerManager.java: ########## @@ -391,32 +359,39 @@ private ColocatedTableInfo getColocatedTableInfo(String tableName) { } return new ColocatedTableInfo(colocatedPartitionInfoMap, timeBoundaryInfo); } else if (offlineRoutingExists) { - return getOfflineColocatedTableInfo(offlineTableName); + return getOfflineColocatedTableInfo(offlineTableName, partitionKey, numPartitions); } else { - return getRealtimeColocatedTableInfo(realtimeTableName); + return getRealtimeColocatedTableInfo(realtimeTableName, partitionKey, numPartitions); } } else { if (tableType == TableType.OFFLINE) { - return getOfflineColocatedTableInfo(tableName); + return getOfflineColocatedTableInfo(tableName, partitionKey, numPartitions); } else { - return getRealtimeColocatedTableInfo(tableName); + return getRealtimeColocatedTableInfo(tableName, partitionKey, numPartitions); } } } - private TablePartitionInfo getTablePartitionInfo(String tableNameWithType) { + private TablePartitionInfo getTablePartitionInfo(String tableNameWithType, String partitionKey, int numPartitions) { TablePartitionInfo tablePartitionInfo = _routingManager.getTablePartitionInfo(tableNameWithType); Preconditions.checkState(tablePartitionInfo != null, "Failed to find table partition info for table: %s", tableNameWithType); + Preconditions.checkState(tablePartitionInfo.getPartitionColumn().equals(partitionKey), + "Partition key: %s does not match partition column: %s for table: %s", partitionKey, + tablePartitionInfo.getPartitionColumn(), tableNameWithType); + Preconditions.checkState(tablePartitionInfo.getNumPartitions() == numPartitions, Review Comment: i was just curious, why even allow users to pass in a `numPartitions` if we expect it to match the `tablePartitionInfo`? Can't we just look this up and set the numPartitions ourselves? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org