From 34fa70a1a7092151be6fbb8240c947ed4eb14648 Mon Sep 17 00:00:00 2001 From: chenqi Date: Fri, 18 Aug 2023 15:01:14 +0800 Subject: [PATCH] [Fix](multi-catalog) Fix NPE when file cache is enabled. --- .../apache/doris/planner/external/FileQueryScanNode.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/planner/external/FileQueryScanNode.java b/fe/fe-core/src/main/java/org/apache/doris/planner/external/FileQueryScanNode.java index 4cf6ac829aa360f..6975bd2adcee439 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/planner/external/FileQueryScanNode.java +++ b/fe/fe-core/src/main/java/org/apache/doris/planner/external/FileQueryScanNode.java @@ -326,6 +326,8 @@ public void createScanRangeLocations() throws UserException { HudiScanNode.setHudiParams(rangeDesc, (HudiSplit) fileSplit); } + curLocations.getScanRange().getExtScanRange().getFileScanRange().addToRanges(rangeDesc); + TScanRangeLocation location = new TScanRangeLocation(); Backend selectedBackend; if (enableSqlCache) { // Use consistent hash to assign the same scan range into the same backend among different queries @@ -336,9 +338,6 @@ public void createScanRangeLocations() throws UserException { } else { selectedBackend = backendPolicy.getNextBe(); } - - curLocations.getScanRange().getExtScanRange().getFileScanRange().addToRanges(rangeDesc); - TScanRangeLocation location = new TScanRangeLocation(); location.setBackendId(selectedBackend.getId()); location.setServer(new TNetworkAddress(selectedBackend.getHost(), selectedBackend.getBePort())); curLocations.addToLocations(location); @@ -465,7 +464,7 @@ protected static Optional getTFileType(String location) { } else if (location.startsWith(FeConstants.FS_PREFIX_HDFS)) { return Optional.of(TFileType.FILE_HDFS); } else if (location.startsWith(FeConstants.FS_PREFIX_COSN)) { - return Optional.of(TFileType.FILE_HDFS); + return Optional.of(TFileType.FILE_BROKER); } else if (location.startsWith(FeConstants.FS_PREFIX_FILE)) { return Optional.of(TFileType.FILE_LOCAL); } else if (location.startsWith(FeConstants.FS_PREFIX_OFS)) {