This is an automated email from the ASF dual-hosted git repository.
siddteotia pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pinot.git
The following commit(s) were added to refs/heads/master by this push:
new b777a620c4 adding routing entry checker for null tables (#9396)
b777a620c4 is described below
commit b777a620c48c542fb6e42e04da4eed1b9cb5992d
Author: Rong Rong <[email protected]>
AuthorDate: Tue Sep 13 22:21:35 2022 -0700
adding routing entry checker for null tables (#9396)
Co-authored-by: Rong Rong <[email protected]>
---
.../org/apache/pinot/query/routing/WorkerManager.java | 19 ++++++++++++++++---
.../apache/pinot/query/QueryEnvironmentTestUtils.java | 2 +-
2 files changed, 17 insertions(+), 4 deletions(-)
diff --git
a/pinot-query-planner/src/main/java/org/apache/pinot/query/routing/WorkerManager.java
b/pinot-query-planner/src/main/java/org/apache/pinot/query/routing/WorkerManager.java
index 9238c33ca4..112aec606b 100644
---
a/pinot-query-planner/src/main/java/org/apache/pinot/query/routing/WorkerManager.java
+++
b/pinot-query-planner/src/main/java/org/apache/pinot/query/routing/WorkerManager.java
@@ -64,6 +64,9 @@ public class WorkerManager {
// table scan stage, need to attach server as well as segment info for
each physical table type.
String logicalTableName = scannedTables.get(0);
Map<String, RoutingTable> routingTableMap =
getRoutingTable(logicalTableName);
+ if (routingTableMap.size() == 0) {
+ throw new IllegalArgumentException("Unable to find routing entries for
table: " + logicalTableName);
+ }
// acquire time boundary info if it is a hybrid table.
if (routingTableMap.size() > 1) {
TimeBoundaryInfo timeBoundaryInfo =
_routingManager.getTimeBoundaryInfo(TableNameBuilder
@@ -125,11 +128,21 @@ public class WorkerManager {
String rawTableName =
TableNameBuilder.extractRawTableName(logicalTableName);
TableType tableType =
TableNameBuilder.getTableTypeFromTableName(logicalTableName);
Map<String, RoutingTable> routingTableMap = new HashMap<>();
+ RoutingTable routingTable;
if (tableType == null) {
- routingTableMap.put(TableType.OFFLINE.name(),
getRoutingTable(rawTableName, TableType.OFFLINE));
- routingTableMap.put(TableType.REALTIME.name(),
getRoutingTable(rawTableName, TableType.REALTIME));
+ routingTable = getRoutingTable(rawTableName, TableType.OFFLINE);
+ if (routingTable != null) {
+ routingTableMap.put(TableType.OFFLINE.name(), routingTable);
+ }
+ routingTable = getRoutingTable(rawTableName, TableType.REALTIME);
+ if (routingTable != null) {
+ routingTableMap.put(TableType.REALTIME.name(), routingTable);
+ }
} else {
- routingTableMap.put(tableType.name(), getRoutingTable(logicalTableName,
tableType));
+ routingTable = getRoutingTable(logicalTableName, tableType);
+ if (routingTable != null) {
+ routingTableMap.put(tableType.name(), routingTable);
+ }
}
return routingTableMap;
}
diff --git
a/pinot-query-planner/src/test/java/org/apache/pinot/query/QueryEnvironmentTestUtils.java
b/pinot-query-planner/src/test/java/org/apache/pinot/query/QueryEnvironmentTestUtils.java
index e8c29aeb02..7197152d1d 100644
---
a/pinot-query-planner/src/test/java/org/apache/pinot/query/QueryEnvironmentTestUtils.java
+++
b/pinot-query-planner/src/test/java/org/apache/pinot/query/QueryEnvironmentTestUtils.java
@@ -75,7 +75,7 @@ public class QueryEnvironmentTestUtils {
public static TableCache mockTableCache() {
TableCache mock = mock(TableCache.class);
- when(mock.getTableNameMap()).thenReturn(ImmutableMap.of("a_REALTIME", "a",
"b_REALTIME", "b", "c_REALTIME", "c",
+ when(mock.getTableNameMap()).thenReturn(ImmutableMap.of("a_REALTIME", "a",
"b_REALTIME", "b", "c_OFFLINE", "c",
"d_OFFLINE", "d", "d_REALTIME", "d"));
when(mock.getSchema("a")).thenReturn(SCHEMA_BUILDER.setSchemaName("a").build());
when(mock.getSchema("b")).thenReturn(SCHEMA_BUILDER.setSchemaName("b").build());
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]