@Override
    public void write(DataOutput out) throws IOException {
        // save history
        SerializeData data = new SerializeData();
        data.jobs = getAllNativeAnalyzeJobList();
        data.nativeStatus = new ArrayList<>(getAnalyzeStatusMap().values().stream().
                filter(AnalyzeStatus::isNative).
                map(status -> (NativeAnalyzeStatus) status).collect(Collectors.toSet()));
        data.basicStatsMeta = new ArrayList<>(getBasicStatsMetaMap().values());
        data.histogramStatsMeta = new ArrayList<>(getHistogramStatsMetaMap().values());

        String s = GsonUtils.GSON.toJson(data);
        Text.writeString(out, s);
    }
@Test
    public void testExternalAnalyzeStatusPersist() throws Exception {
        Table table = connectContext.getGlobalStateMgr().getMetadataMgr().getTable("hive0", "partitioned_db", "t1");

        ExternalAnalyzeStatus analyzeStatus = new ExternalAnalyzeStatus(100,
                "hive0", "partitioned_db", "t1",
                table.getUUID(), ImmutableList.of("c1", "c2"), StatsConstants.AnalyzeType.FULL,
                StatsConstants.ScheduleType.ONCE, Maps.newHashMap(), LocalDateTime.now());
        UtFrameUtils.PseudoImage testImage = new UtFrameUtils.PseudoImage();
        analyzeStatus.write(testImage.getDataOutputStream());

        ExternalAnalyzeStatus loadAnalyzeStatus = ExternalAnalyzeStatus.read(testImage.getDataInputStream());
        Assert.assertEquals("hive0", loadAnalyzeStatus.getCatalogName());
        Assert.assertEquals("partitioned_db", loadAnalyzeStatus.getDbName());
        Assert.assertEquals("t1", loadAnalyzeStatus.getTableName());
        Assert.assertEquals(StatsConstants.AnalyzeType.FULL, loadAnalyzeStatus.getType());
        Assert.assertEquals(StatsConstants.ScheduleType.ONCE, loadAnalyzeStatus.getScheduleType());
    }