@VisibleForTesting
    public HashRing makeHashRing() {
        Set<ComputeNode> nodes = assignedScansPerComputeNode.keySet();
        HashRing hashRing = null;
        String hashAlgorithm = ConnectContext.get() != null ? ConnectContext.get().getSessionVariable().
                getHdfsBackendSelectorHashAlgorithm() : "consistent";
        int virtualNodeNum = ConnectContext.get() != null ? ConnectContext.get().getSessionVariable().
                getConsistentHashVirtualNodeNum() : CONSISTENT_HASH_RING_VIRTUAL_NUMBER;
        if (hashAlgorithm.equalsIgnoreCase("rendezvous")) {
            hashRing = new RendezvousHashRing(Hashing.murmur3_128(), new TScanRangeLocationsFunnel(),
                    new ComputeNodeFunnel(), nodes);
        } else {
            hashRing = new ConsistentHashRing(Hashing.murmur3_128(), new TScanRangeLocationsFunnel(),
                    new ComputeNodeFunnel(), nodes, virtualNodeNum);
        }
        return hashRing;
    }
@Test
    public void testHashRingAlgorithm() {
        SessionVariable sessionVariable = new SessionVariable();
        new Expectations() {
            {
                ConnectContext.get();
                result = context;

                context.getSessionVariable();
                result = sessionVariable;
            }
        };

        int scanRangeNumber = 100;
        int scanRangeSize = 10000;
        int hostNumber = 3;
        List<TScanRangeLocations> locations = createScanRanges(scanRangeNumber, scanRangeSize);
        FragmentScanRangeAssignment assignment = new FragmentScanRangeAssignment();
        ImmutableMap<Long, ComputeNode> computeNodes = createComputeNodes(hostNumber);
        DefaultWorkerProvider workerProvider = new DefaultWorkerProvider(
                ImmutableMap.of(),
                computeNodes,
                ImmutableMap.of(),
                computeNodes,
                true
        );
        HDFSBackendSelector selector =
                new HDFSBackendSelector(hdfsScanNode, locations, assignment, workerProvider, false, false);
        HashRing hashRing = selector.makeHashRing();
        Assert.assertTrue(hashRing.policy().equals("ConsistentHash"));
        ConsistentHashRing consistentHashRing = (ConsistentHashRing) hashRing;
        Assert.assertTrue(consistentHashRing.getVirtualNumber() ==
                HDFSBackendSelector.CONSISTENT_HASH_RING_VIRTUAL_NUMBER);

        sessionVariable.setHdfsBackendSelectorHashAlgorithm("rendezvous");
        hashRing = selector.makeHashRing();
        Assert.assertTrue(hashRing.policy().equals("RendezvousHash"));

        sessionVariable.setHdfsBackendSelectorHashAlgorithm("consistent");
        sessionVariable.setConsistentHashVirtualNodeNum(64);
        hashRing = selector.makeHashRing();
        Assert.assertTrue(hashRing.policy().equals("ConsistentHash"));
        consistentHashRing = (ConsistentHashRing) hashRing;
        Assert.assertTrue(consistentHashRing.getVirtualNumber() == 64);
    }