Code review comment: test case should be added to cover the new behavior.

Code before review:
private List<Column> getFileSchema() throws DdlException {
if (fileStatuses.isEmpty()) {
return Lists.newArrayList();
}
TNetworkAddress address;
List<Long> nodeIds = GlobalStateMgr.getCurrentSystemInfo().getBackendIds(true);
if (nodeIds.isEmpty()) {
if (RunMode.getCurrentRunMode() == RunMode.SHARED_NOTHING) {
throw new DdlException("Failed to send proxy request. No alive backends");
} else {
nodeIds.addAll(GlobalStateMgr.getCurrentSystemInfo().getComputeNodeIds(true));
if (nodeIds.isEmpty()) {
throw new DdlException("Failed to send proxy request. " +
"No alive backends or compute nodes");
}
}
}
Collections.shuffle(nodeIds);
ComputeNode node = GlobalStateMgr.getCurrentSystemInfo().getBackendOrComputeNode(nodeIds.get(0));
address = new TNetworkAddress(node.getHost(), node.getBrpcPort());
PGetFileSchemaResult result;
try {
PGetFileSchemaRequest request = getGetFileSchemaRequest(fileStatuses);
Future<PGetFileSchemaResult> future = BackendServiceClient.getInstance().getFileSchema(address, request);
result = future.get();
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new DdlException("failed to get file schema", e);
} catch (Exception e) {
throw new DdlException("failed to get file schema", e);
}
if (TStatusCode.findByValue(result.status.statusCode) != TStatusCode.OK) {
throw new DdlException("failed to get file schema, path: " + path + ", error: " + result.status.errorMsgs);
}
List<Column> columns = new ArrayList<>();
for (PSlotDescriptor slot : result.schema) {
columns.add(new Column(slot.colName, Type.fromProtobuf(slot.slotType), true));
}
return columns;
}

Line under review: address = new TNetworkAddress(node.getHost(), node.getBrpcPort());

Code after addressing the review:
private List<Column> getFileSchema() throws DdlException {
if (fileStatuses.isEmpty()) {
return Lists.newArrayList();
}
TNetworkAddress address;
List<Long> nodeIds = GlobalStateMgr.getCurrentSystemInfo().getBackendIds(true);
if (RunMode.getCurrentRunMode() == RunMode.SHARED_DATA) {
nodeIds.addAll(GlobalStateMgr.getCurrentSystemInfo().getComputeNodeIds(true));
}
if (nodeIds.isEmpty()) {
if (RunMode.getCurrentRunMode() == RunMode.SHARED_NOTHING) {
throw new DdlException("Failed to send proxy request. No alive backends");
} else {
throw new DdlException("Failed to send proxy request. No alive backends or compute nodes");
}
}
Collections.shuffle(nodeIds);
ComputeNode node = GlobalStateMgr.getCurrentSystemInfo().getBackendOrComputeNode(nodeIds.get(0));
address = new TNetworkAddress(node.getHost(), node.getBrpcPort());
PGetFileSchemaResult result;
try {
PGetFileSchemaRequest request = getGetFileSchemaRequest(fileStatuses);
Future<PGetFileSchemaResult> future = BackendServiceClient.getInstance().getFileSchema(address, request);
result = future.get();
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new DdlException("failed to get file schema", e);
} catch (Exception e) {
throw new DdlException("failed to get file schema", e);
}
if (TStatusCode.findByValue(result.status.statusCode) != TStatusCode.OK) {
throw new DdlException("failed to get file schema, path: " + path + ", error: " + result.status.errorMsgs);
}
List<Column> columns = new ArrayList<>();
for (PSlotDescriptor slot : result.schema) {
columns.add(new Column(slot.colName, Type.fromProtobuf(slot.slotType), true));
}
return columns;
}