@Override
    public void write(DataOutput out) throws IOException {
        String json = GsonUtils.GSON.toJson(this, AlterJobV2.class);
        Text.writeString(out, json);
    }
@Test
    public void testSerializeOfRollupJob() throws IOException,
            AnalysisException {
        Config.enable_materialized_view = true;
        // prepare file
        String fileName = "./RollupJobV2Test";
        File file = new File(fileName);
        file.createNewFile();
        DataOutputStream out = new DataOutputStream(new FileOutputStream(file));

        short keysCount = 1;
        List<Column> columns = Lists.newArrayList();
        String mvColumnName = MVUtils.MATERIALIZED_VIEW_NAME_PREFIX + "bitmap_union_" + "c1";
        Column column = new Column(mvColumnName, Type.BITMAP, false, AggregateType.BITMAP_UNION, false,
                new ColumnDef.DefaultValueDef(true, new StringLiteral("1")), "");
        columns.add(column);
        RollupJobV2 rollupJobV2 = new RollupJobV2(1, 1, 1, "test", 1, 1,
                1, "test", "rollup", 0, columns, null, 1, 1,
                KeysType.AGG_KEYS, keysCount,
                new OriginStatement("create materialized view rollup as select bitmap_union(to_bitmap(c1)) from test",
                        0), "", false);

        // write rollup job
        rollupJobV2.write(out);
        out.flush();
        out.close();

        // read objects from file

        DataInputStream in = new DataInputStream(new FileInputStream(file));
        RollupJobV2 result = (RollupJobV2) AlterJobV2.read(in);
        List<Column> resultColumns = Deencapsulation.getField(result, "rollupSchema");
        assertEquals(1, resultColumns.size());
        Column resultColumn1 = resultColumns.get(0);
        assertEquals(mvColumnName,
                resultColumn1.getName());
        Assert.assertTrue(resultColumn1.getDefineExpr() instanceof FunctionCallExpr);
        FunctionCallExpr resultFunctionCall = (FunctionCallExpr) resultColumn1.getDefineExpr();
        assertEquals("to_bitmap", resultFunctionCall.getFnName().getFunction());
    }