@Override
    public ProcResult fetchResult() throws AnalysisException {
        final BaseProcResult result = new BaseProcResult();
        result.setNames(TITLE_NAMES.asList());
        List<QueryStatisticsInfo> queryInfos = QueryStatisticsInfo.makeListFromMetricsAndMgrs();
        List<List<String>> sortedRowData = queryInfos
                .stream()
                .map(QueryStatisticsInfo::formatToList)
                .collect(Collectors.toList());

        result.setRows(sortedRowData);
        return result;
    }
@Test
    public void testFetchResult() throws AnalysisException {
        Map<String, QueryStatisticsItem> statistic = new HashMap<>();
        statistic.put("queryId1", new QueryStatisticsItem.Builder()
                .queryStartTime(1)
                .customQueryId("abc1")
                .queryId("queryId1")
                .warehouseName("wh1")
                .build()
        );
        statistic.put("queryId2", new QueryStatisticsItem.Builder()
                .queryStartTime(2)
                .customQueryId("abc2")
                .queryId("queryId2")
                .warehouseName("wh1")
                .build()
        );
        new MockUp<QeProcessorImpl>() {
            @Mock
            public Map<String, QueryStatisticsItem> getQueryStatistics() {
                return statistic;
            }
        };
        final Map<String, CurrentQueryInfoProvider.QueryStatistics> statisticsMap = new HashMap<>();
        statisticsMap.put("queryId1", new CurrentQueryInfoProvider.QueryStatistics());
        statisticsMap.put("queryId2", new CurrentQueryInfoProvider.QueryStatistics());
        new MockUp<CurrentQueryInfoProvider>() {
            @Mock
            public Map<String, CurrentQueryInfoProvider.QueryStatistics> getQueryStatistics(
                    Collection<QueryStatisticsItem> items) throws AnalysisException {
                return statisticsMap;
            }
        };
        BaseProcResult result = (BaseProcResult) currentQueryStatisticsProcDir.fetchResult();
        List<List<String>> rows = result.getRows();
        List<String> list1 = rows.get(0);
        Assert.assertEquals(list1.size(), CurrentQueryStatisticsProcDir.TITLE_NAMES.size());
        // QueryId
        Assert.assertEquals("queryId1", list1.get(2));
        // Warehouse
        Assert.assertEquals("wh1", list1.get(12));
        // CustomQueryId
        Assert.assertEquals("abc1", list1.get(13));

        List<String> list2 = rows.get(1);
        Assert.assertEquals(list2.size(), CurrentQueryStatisticsProcDir.TITLE_NAMES.size());
        // QueryId
        Assert.assertEquals("queryId2", list2.get(2));
        // Warehouse
        Assert.assertEquals("wh1", list2.get(12));
        // CustomQueryId
        Assert.assertEquals("abc2", list2.get(13));
    }