public String generateComplexTypeColumnTask(long tableId, long dbId, String tableName, String dbName,
                                                List<ColumnStats> complexTypeStats) {
        String sep = ", ";
        String prefix = "INSERT INTO " + STATISTICS_DB_NAME + "." + SAMPLE_STATISTICS_TABLE_NAME + " VALUES ";
        StringJoiner joiner = new StringJoiner(sep, prefix, ";");

        for (ColumnStats columnStats : complexTypeStats) {
            StringBuilder builder = new StringBuilder();
            builder.append("(");
            builder.append(tableId).append(sep);
            builder.append(addSingleQuote(columnStats.getColumnName())).append(sep);
            builder.append(dbId).append(sep);
            builder.append("'").append(StringEscapeUtils.escapeSql(dbName)).append(".")
                    .append(StringEscapeUtils.escapeSql(tableName)).append("'").append(sep);
            builder.append(addSingleQuote(dbName)).append(sep);
            builder.append(columnStats.getRowCount()).append(sep);
            builder.append(columnStats.getDateSize()).append(sep);
            builder.append(columnStats.getDistinctCount(0L)).append(sep);
            builder.append(columnStats.getNullCount()).append(sep);
            builder.append(columnStats.getMax()).append(sep);
            builder.append(columnStats.getMin()).append(sep);
            builder.append("NOW()");
            builder.append(")");
            joiner.add(builder);
        }
        return joiner.toString();
    }
@Test
    public void generateComplexTypeColumnTask() {
        SampleInfo sampleInfo = tabletSampleManager.generateSampleInfo("test", "t_struct");
        List<String> columnNames = table.getColumns().stream().map(Column::getName).collect(Collectors.toList());
        List<Type> columnTypes = table.getColumns().stream().map(Column::getType).collect(Collectors.toList());
        ColumnSampleManager columnSampleManager = ColumnSampleManager.init(columnNames, columnTypes, table,
                sampleInfo);

        String complexSql = sampleInfo.generateComplexTypeColumnTask(table.getId(), db.getId(), table.getName(),
                db.getFullName(), columnSampleManager.getComplexTypeStats());
        List<StatementBase> stmt = SqlParser.parse(complexSql, connectContext.getSessionVariable());
        Assert.assertTrue(stmt.get(0) instanceof InsertStmt);
        InsertStmt insertStmt = (InsertStmt) stmt.get(0);
        Assert.assertTrue(insertStmt.getQueryStatement().getQueryRelation() instanceof ValuesRelation);
        ValuesRelation valuesRelation = (ValuesRelation) insertStmt.getQueryStatement().getQueryRelation();
        Assert.assertTrue(valuesRelation.getRows().size() == 3);
        Assert.assertTrue(valuesRelation.getRows().get(0).size() == 12);
    }