Skip to content

Commit

Permalink
[Refactor] Remove duplicate code (#25137)
Browse files Browse the repository at this point in the history
Signed-off-by: imay <buaa.zhaoc@gmail.com>
  • Loading branch information
imay authored Jun 13, 2023
1 parent 8426916 commit f5bda98
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 47 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ public class IcebergScanNode extends ScanNode {

private Set<String> equalityDeleteColumns = new HashSet<>();

private final HashMultimap<String, Long> hostToBeId = HashMultimap.create();
private long totalBytes = 0;

private boolean isFinalized = false;
Expand Down Expand Up @@ -122,21 +121,6 @@ private void setupCloudCredential() {
@Override
public void init(Analyzer analyzer) throws UserException {
super.init(analyzer);
getAliveBackends();
}

private void getAliveBackends() throws UserException {
ImmutableCollection<ComputeNode> computeNodes =
ImmutableList.copyOf(GlobalStateMgr.getCurrentSystemInfo().getComputeNodes());

for (ComputeNode computeNode : computeNodes) {
if (computeNode.isAlive()) {
hostToBeId.put(computeNode.getHost(), computeNode.getId());
}
}
if (hostToBeId.isEmpty()) {
throw new UserException(FeConstants.BACKEND_NODE_NOT_FOUND_ERROR);
}
}

public void preProcessIcebergPredicate(ScalarOperator predicate) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@

import com.google.common.base.Preconditions;
import com.google.common.base.Strings;
import com.google.common.collect.ImmutableCollection;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Iterators;
import com.google.common.collect.Lists;
Expand Down Expand Up @@ -790,35 +788,6 @@ public ImmutableMap<Long, ComputeNode> getIdComputeNode() {
return ImmutableMap.copyOf(idToComputeNodeRef);
}

public ImmutableCollection<ComputeNode> getComputeNodes() {
List<Long> computeNodeIds = getComputeNodeIds(true);
if (computeNodeIds != null && computeNodeIds.size() > 0) {
return getComputeNodes(true);
} else {
return getBackends(true);
}
}

public ImmutableCollection<ComputeNode> getComputeNodes(boolean needAlive) {
ImmutableMap<Long, ComputeNode> idToComputeNode = ImmutableMap.copyOf(idToComputeNodeRef);
List<Long> computeNodeIds = getComputeNodeIds(needAlive);
List<ComputeNode> computeNodes = new ArrayList<>();
for (Long computeNodeId : computeNodeIds) {
computeNodes.add(idToComputeNode.get(computeNodeId));
}
return ImmutableList.copyOf(computeNodes);
}

public ImmutableCollection<ComputeNode> getBackends(boolean needAlive) {
ImmutableMap<Long, Backend> idToComputeNode = ImmutableMap.copyOf(idToBackendRef);
List<Long> backendIds = getBackendIds(needAlive);
List<ComputeNode> backends = new ArrayList<>();
for (Long backendId : backendIds) {
backends.add(idToComputeNode.get(backendId));
}
return ImmutableList.copyOf(backends);
}

public long getBackendReportVersion(long backendId) {
AtomicLong atomicLong;
if ((atomicLong = idToReportVersionRef.get(backendId)) == null) {
Expand Down

0 comments on commit f5bda98

Please sign in to comment.