Skip to content

Commit

Permalink
flow of logic
Browse files Browse the repository at this point in the history
  • Loading branch information
Ashish Jayamohan authored and Ashish Jayamohan committed Oct 18, 2024
1 parent fa21310 commit 3240a4b
Showing 1 changed file with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -626,22 +626,6 @@ protected BrokerResponse handleRequest(long requestId, String query, SqlNodeAndO
boolean realtimeTableDisabled = _routingManager.isTableDisabled(
TableNameBuilder.REALTIME.tableNameWithType(rawTableName));
List<ProcessingException> exceptions = new ArrayList<>();

if (offlineTableDisabled || realtimeTableDisabled) {
String errorMessage = null;
if (((realtimeTableConfig != null && offlineTableConfig != null) && (offlineTableDisabled
&& realtimeTableDisabled)) || (offlineTableConfig == null && realtimeTableDisabled) || (
realtimeTableConfig == null && offlineTableDisabled)) {
requestContext.setErrorCode(QueryException.TABLE_IS_DISABLED_ERROR_CODE);
return BrokerResponseNative.TABLE_IS_DISABLED;
} else if ((realtimeTableConfig != null && offlineTableConfig != null) && realtimeTableDisabled) {
errorMessage = "Realtime table is disabled in hybrid table";
} else if ((realtimeTableConfig != null && offlineTableConfig != null) && offlineTableDisabled) {
errorMessage = "Offline table is disabled in hybrid table";
}
exceptions.add(QueryException.getException(QueryException.TABLE_IS_DISABLED_ERROR, errorMessage));
}

if (offlineBrokerRequest != null) {
// NOTE: Routing table might be null if table is just removed
RoutingTable routingTable = _routingManager.getRoutingTable(offlineBrokerRequest, requestId);
Expand Down Expand Up @@ -680,6 +664,22 @@ protected BrokerResponse handleRequest(long requestId, String query, SqlNodeAndO
realtimeBrokerRequest = null;
}
}

if (offlineTableDisabled || realtimeTableDisabled) {
String errorMessage = null;
if (((realtimeTableConfig != null && offlineTableConfig != null) && (offlineTableDisabled
&& realtimeTableDisabled)) || (offlineTableConfig == null && realtimeTableDisabled) || (
realtimeTableConfig == null && offlineTableDisabled)) {
requestContext.setErrorCode(QueryException.TABLE_IS_DISABLED_ERROR_CODE);
return BrokerResponseNative.TABLE_IS_DISABLED;
} else if ((realtimeTableConfig != null && offlineTableConfig != null) && realtimeTableDisabled) {
errorMessage = "Realtime table is disabled in hybrid table";
} else if ((realtimeTableConfig != null && offlineTableConfig != null) && offlineTableDisabled) {
errorMessage = "Offline table is disabled in hybrid table";
}
exceptions.add(QueryException.getException(QueryException.TABLE_IS_DISABLED_ERROR, errorMessage));
}

int numUnavailableSegments = unavailableSegments.size();
requestContext.setNumUnavailableSegments(numUnavailableSegments);

Expand Down

0 comments on commit 3240a4b

Please sign in to comment.