public List<List<Comparable>> fetchComparableResult(long version, long backendId, Replica.ReplicaState state,
                                                        Boolean hideIpPort) {
        Preconditions.checkNotNull(db);
        Preconditions.checkNotNull(index);
        Preconditions.checkState(table.isOlapTableOrMaterializedView());
        ImmutableMap<Long, Backend> backendMap = GlobalStateMgr.getCurrentState().getNodeMgr().getClusterInfo().getIdToBackend();

        List<List<Comparable>> tabletInfos = new ArrayList<List<Comparable>>();
        Locker locker = new Locker();
        locker.lockDatabase(db, LockType.READ);
        try {
            // get infos
            for (Tablet tablet : index.getTablets()) {
                LocalTablet localTablet = (LocalTablet) tablet;
                long tabletId = tablet.getId();
                if (localTablet.getImmutableReplicas().isEmpty()) {
                    List<Comparable> tabletInfo = createTabletInfo(tabletId);
                    tabletInfos.add(tabletInfo);
                } else {
                    for (Replica replica : localTablet.getImmutableReplicas()) {
                        if ((version > -1 && replica.getVersion() != version)
                                || (backendId > -1 && replica.getBackendId() != backendId)
                                || (state != null && replica.getState() != state)) {
                            continue;
                        }
                        List<Comparable> tabletInfo = new ArrayList<Comparable>();
                        // tabletId -- replicaId -- backendId -- version -- versionHash -- dataSize -- rowCount -- state
                        tabletInfo.add(tabletId);
                        tabletInfo.add(replica.getId());
                        tabletInfo.add(replica.getBackendId());
                        tabletInfo.add(Replica.DEPRECATED_PROP_SCHEMA_HASH);
                        tabletInfo.add(replica.getVersion());
                        tabletInfo.add(0);
                        tabletInfo.add(replica.getLastSuccessVersion());
                        tabletInfo.add(0);
                        tabletInfo.add(replica.getLastFailedVersion());
                        tabletInfo.add(0);
                        tabletInfo.add(TimeUtils.longToTimeString(replica.getLastFailedTimestamp()));
                        tabletInfo.add(new ByteSizeValue(replica.getDataSize()));
                        tabletInfo.add(replica.getRowCount());
                        tabletInfo.add(replica.getState());

                        tabletInfo.add(TimeUtils.longToTimeString(tablet.getLastCheckTime()));
                        tabletInfo.add(localTablet.getCheckedVersion());
                        tabletInfo.add(0);
                        tabletInfo.add(replica.getVersionCount());
                        tabletInfo.add(replica.getPathHash());
                        Backend backend = backendMap.get(replica.getBackendId());
                        String metaUrl;
                        String compactionUrl;
                        if (backend != null) {
                            String hostPort = hideIpPort ? "*:0" :
                                    NetUtils.getHostPortInAccessibleFormat(backend.getHost(), backend.getHttpPort());
                            metaUrl = String.format("http://" + hostPort + "/api/meta/header/%d", tabletId);
                            compactionUrl = String.format(
                                    "http://" + hostPort + "/api/compaction/show?tablet_id=%d", tabletId);
                        } else {
                            metaUrl = "N/A";
                            compactionUrl = "N/A";
                        }
                        tabletInfo.add(metaUrl);
                        tabletInfo.add(compactionUrl);

                        tabletInfos.add(tabletInfo);
                    }
                }
            }
        } finally {
            locker.unLockDatabase(db, LockType.READ);
        }
        return tabletInfos;
    }
@Test
    public void testFetchResultWithLocalTablet(@Mocked GlobalStateMgr globalStateMgr,
                                               @Mocked SystemInfoService systemInfoService) {
        Map<Long, Backend> idToBackend = Maps.newHashMap();
        long backendId = 20L;
        idToBackend.put(backendId, new Backend(backendId, "127.0.0.1", 9050));
        idToBackend.put(backendId, new Backend(backendId + 1, "127.0.0.2", 9050));

        new Expectations() {
            {
                GlobalStateMgr.getCurrentState().getNodeMgr().getClusterInfo();
                result = systemInfoService;
                systemInfoService.getIdToBackend();
                result = ImmutableMap.copyOf(idToBackend);
            }
        };

        long dbId = 1L;
        long tableId = 2L;
        long partitionId = 3L;
        long indexId = 4L;
        long tablet1Id = 5L;
        long tablet2Id = 6L;
        long replicaId = 10L;

        // Columns
        List<Column> columns = new ArrayList<Column>();
        Column k1 = new Column("k1", Type.INT, true, null, "", "");
        columns.add(k1);
        columns.add(new Column("k2", Type.BIGINT, true, null, "", ""));
        columns.add(new Column("v", Type.BIGINT, false, AggregateType.SUM, "0", ""));

        // Replica
        Replica replica1 = new Replica(replicaId, backendId, Replica.ReplicaState.NORMAL, 1, 0);
        Replica replica2 = new Replica(replicaId + 1, backendId + 1, Replica.ReplicaState.NORMAL, 1, 0);

        // Tablet
        LocalTablet tablet1 = new LocalTablet(tablet1Id);
        tablet1.addReplica(replica1);
        tablet1.addReplica(replica2);
        LocalTablet tablet2 = new LocalTablet(tablet2Id);

        // Partition info and distribution info
        DistributionInfo distributionInfo = new HashDistributionInfo(1, Lists.newArrayList(k1));
        PartitionInfo partitionInfo = new SinglePartitionInfo();
        partitionInfo.setDataProperty(partitionId, new DataProperty(TStorageMedium.SSD));
        partitionInfo.setIsInMemory(partitionId, false);
        partitionInfo.setTabletType(partitionId, TTabletType.TABLET_TYPE_DISK);
        partitionInfo.setReplicationNum(partitionId, (short) 3);

        // Index
        MaterializedIndex index = new MaterializedIndex(indexId, MaterializedIndex.IndexState.NORMAL);
        TabletMeta tabletMeta = new TabletMeta(dbId, tableId, partitionId, indexId, 0, TStorageMedium.SSD);
        index.addTablet(tablet1, tabletMeta);
        index.addTablet(tablet2, tabletMeta);

        // Partition
        Partition partition = new Partition(partitionId, "p1", index, distributionInfo);

        // Table
        OlapTable table = new OlapTable(tableId, "t1", columns, KeysType.AGG_KEYS, partitionInfo, distributionInfo);
        Deencapsulation.setField(table, "baseIndexId", indexId);
        table.addPartition(partition);
        table.setIndexMeta(indexId, "t1", columns, 0, 0, (short) 3, TStorageType.COLUMN, KeysType.AGG_KEYS);

        // Db
        Database db = new Database(dbId, "test_db");
        db.registerTableUnlocked(table);

        // Check
        LocalTabletsProcDir tabletsProcDir = new LocalTabletsProcDir(db, table, index);
        List<List<Comparable>> result = tabletsProcDir.fetchComparableResult(-1, -1, null, false);
        System.out.println(result);
        Assert.assertEquals(3, result.size());
        Assert.assertEquals((long) result.get(0).get(0), tablet1Id);
        Assert.assertEquals((long) result.get(1).get(0), tablet1Id);
        if ((long) result.get(0).get(1) == replicaId) {
            Assert.assertEquals((long) result.get(0).get(2), backendId);
        } else if ((long) result.get(0).get(1) == replicaId + 1) {
            Assert.assertEquals((long) result.get(0).get(2), backendId + 1);
        }
        Assert.assertEquals((long) result.get(2).get(0), tablet2Id);
        Assert.assertEquals(result.get(2).get(1), -1);
        Assert.assertEquals(result.get(2).get(2), -1);
    }