public String generatePrimitiveTypeColumnTask(long tableId, long dbId, String tableName, String dbName,
                                                  List<ColumnStats> primitiveTypeStats,
                                                  TabletSampleManager manager) {
        String prefix = "INSERT INTO " + STATISTICS_DB_NAME + "." + SAMPLE_STATISTICS_TABLE_NAME;
        StringBuilder builder = new StringBuilder();
        builder.append(prefix).append(" ");
        builder.append("WITH base_cte_table as (");
        String queryDataSql = generateQueryDataSql(tableName, dbName, primitiveTypeStats, manager);
        builder.append(queryDataSql).append(") ");

        int idx = 0;
        int size = primitiveTypeStats.size();
        for (ColumnStats columnStats : primitiveTypeStats) {
            idx++;
            builder.append(generateQueryColumnSql(tableId, dbId, tableName, dbName, columnStats, "col_" + idx));
            if (idx != size) {
                builder.append(" UNION ALL ");
            }
        }
        return builder.toString();
    }
@Test
    public void generateSubFieldTypeColumnTask() {
        SampleInfo sampleInfo = tabletSampleManager.generateSampleInfo("test", "t_struct");
        List<String> columnNames = Lists.newArrayList("c1", "c4.b", "c6.c.b");
        List<Type> columnTypes = Lists.newArrayList(Type.DATE, new ArrayType(Type.ANY_STRUCT), Type.INT);
        ColumnSampleManager columnSampleManager = ColumnSampleManager.init(columnNames, columnTypes, table,
                sampleInfo);
        List<List<ColumnStats>> columnStatsBatch = columnSampleManager.splitPrimitiveTypeStats();
        String sql = sampleInfo.generatePrimitiveTypeColumnTask(table.getId(), db.getId(), table.getName(),
                db.getFullName(), columnStatsBatch.get(0), tabletSampleManager);

        List<StatementBase> stmt = SqlParser.parse(sql, connectContext.getSessionVariable());
        Assert.assertTrue(stmt.get(0) instanceof InsertStmt);
        InsertStmt insertStmt = (InsertStmt) stmt.get(0);
        Assert.assertTrue(insertStmt.getQueryStatement().getQueryRelation() instanceof UnionRelation);
        UnionRelation unionRelation = (UnionRelation) insertStmt.getQueryStatement().getQueryRelation();
        Assert.assertTrue(unionRelation.getRelations().size() == 2);
    }