public void computeBeScanRanges() {
        List<ComputeNode> nodeList;
        if (RunMode.getCurrentRunMode() == RunMode.SHARED_DATA) {
            long warehouseId = ConnectContext.get().getCurrentWarehouseId();
            List<Long> computeNodeIds = GlobalStateMgr.getCurrentState().getWarehouseMgr().getAllComputeNodeIds(warehouseId);

            nodeList = computeNodeIds.stream()
                    .map(id -> GlobalStateMgr.getCurrentState().getNodeMgr().getClusterInfo().getBackendOrComputeNode(id))
                    .collect(Collectors.toList());
        } else {
            nodeList = Lists.newArrayList();
            nodeList.addAll(GlobalStateMgr.getCurrentState().getNodeMgr().getClusterInfo().getBackends());
            nodeList.addAll(GlobalStateMgr.getCurrentState().getNodeMgr().getClusterInfo().getComputeNodes());
        }

        for (ComputeNode node : nodeList) {
            // if user specifies BE id, we try to scan all BEs(including bad BE)
            // if user doesn't specify BE id, we only scan live BEs
            if ((node.isAlive() && beId == null) || (beId != null && beId.equals(node.getId()))) {
                if (beScanRanges == null) {
                    beScanRanges = Lists.newArrayList();
                }
                TScanRangeLocations scanRangeLocations = new TScanRangeLocations();
                TScanRangeLocation location = new TScanRangeLocation();
                location.setBackend_id(node.getId());
                location.setServer(new TNetworkAddress(node.getHost(), node.getBePort()));
                scanRangeLocations.addToLocations(location);
                TScanRange scanRange = new TScanRange();
                scanRangeLocations.setScan_range(scanRange);
                beScanRanges.add(scanRangeLocations);
            }
        }
    }
@Test
    public void testComputeBeScanRanges() {
        new MockUp<RunMode>() {
            @Mock
            public RunMode getCurrentRunMode() {
                return RunMode.SHARED_DATA;
            }
        };

        new MockUp<WarehouseManager>() {
            @Mock
            public List<Long> getAllComputeNodeIds(long warehouseId) {
                return Lists.newArrayList(1L);
            }
        };

        new MockUp<SystemInfoService>() {
            @Mock
            public ComputeNode getBackendOrComputeNode(long nodeId) {
                ComputeNode computeNode = new ComputeNode(1L, "127.0.0.1", 9030);
                computeNode.setAlive(true);
                return computeNode;
            }
        };

        TupleDescriptor desc = new TupleDescriptor(new TupleId(0));
        SystemTable table = new SystemTable(0, "fe_metrics", null, null, null);
        desc.setTable(table);
        SchemaScanNode scanNode = new SchemaScanNode(new PlanNodeId(0), desc);
        scanNode.computeBeScanRanges();
    }