private static SegmentSchema getSchema(String createSql) {
        String regx = "`\\w+` \\w+ COMMENT '.*'";
        Pattern pattern = Pattern.compile(regx);
        Matcher matcher = pattern.matcher(createSql);
        List<ColumnSchema> columnSchemas = new ArrayList<>();
        while (matcher.find()) {
            String colStr = matcher.group().trim();
            colStr = colStr.substring(0, colStr.indexOf("COMMENT"));
            String[] strs = colStr.trim().split(" ", 2);
            String colName = StringUtils.strip(strs[0], "`");
            String colType = strs[1].trim();
            SQLType indexrType;
            switch (colType.toUpperCase()) {
                case "INT":
                    indexrType = SQLType.INT;
                    break;
                case "BIGINT":
                    indexrType = SQLType.BIGINT;
                    break;
                case "FLOAT":
                    indexrType = SQLType.FLOAT;
                    break;
                case "DOUBLE":
                    indexrType = SQLType.DOUBLE;
                    break;
                case "STRING":
                    indexrType = SQLType.VARCHAR;
                    break;
                case "DATE":
                    indexrType = SQLType.DATE;
                    break;
                case "TIMESTAMP":
                    indexrType = SQLType.DATETIME;
                    break;
                default:
                    throw new IllegalStateException("unsupported hive type " + colType);
            }
            columnSchemas.add(new ColumnSchema(colName, indexrType));
        }
        return new SegmentSchema(columnSchemas);
    }
A tool which move realtime data in rt folder into history partition.
Only support one partition column.
It only works on indexr tables which has a hive table with location pointed to the same path and with a table partition column.
indexr-server/src/main/java/io/indexr/server/rt2his/Rt2HisOnHive.java