OtterMind/Chat2DB · error · IllegalArgumentException

Unsupported Kylin JDBC ARRAY type for column: {name}

Error message

Unsupported Kylin JDBC ARRAY type for column: {name}

What it means

Thrown by KylinMetaData.renderArrayType when the ARRAY column's TYPE_NAME text does not match ARRAY_TYPE_NAME_PATTERN. The strict regex requires a known scalar element type optionally sized, optional CHARACTER SET/COLLATE, then '... NOT NULL ARRAY'. Any other shape is rejected so malformed metadata cannot produce invalid ARRAY<> DDL.

Source

Thrown at chat2db-community-server/chat2db-community-plugins/chat2db-community-kylin/src/main/java/ai/chat2db/plugin/kylin/KylinMetaData.java:127

        if ("DECIMAL".equals(typeName) && columnSize != null && columnSize > 0) {
            Integer decimalDigits = column.getDecimalDigits();
            if (decimalDigits != null && decimalDigits >= 0) {
                return typeName + '(' + columnSize.toString() + ',' + decimalDigits + ')';
            }
            return typeName + '(' + columnSize.toString() + ')';
        }
        return typeName;
    }

    private String renderArrayType(TableColumn column) {
        String jdbcTypeName = column.getColumnType();
        if (StringUtils.isBlank(jdbcTypeName)) {
            throw new IllegalArgumentException("Missing JDBC type name for Kylin ARRAY column: " + column.getName());
        }

        Matcher matcher = ARRAY_TYPE_NAME_PATTERN.matcher(jdbcTypeName);
        if (!matcher.matches()) {
            throw new IllegalArgumentException("Unsupported Kylin JDBC ARRAY type for column: " + column.getName());
        }
        String elementType = matcher.group(1)
                .replace(" ", "")
                .replace("\t", "")
                .toUpperCase(Locale.ROOT);
        return "ARRAY<" + elementType + '>';
    }

    private String buildCreateIndex(String tableName, TableIndex index) {
        if (StringUtils.isBlank(index.getName()) || index.getColumnList() == null || index.getColumnList().isEmpty()) {
            return "";
        }

        StringJoiner columns = new StringJoiner(", ");
        for (TableIndexColumn column : index.getColumnList()) {
            columns.add(quoteIdentifier(column.getColumnName()));
        }
        return "CREATE " + (Boolean.TRUE.equals(index.getUnique()) ? "UNIQUE " : "")

View on GitHub (pinned to 5ee1e990e7)

Solutions

  1. Ensure the ARRAY column uses a scalar element type the pattern recognizes (BOOLEAN, TINYINT, ..., VARCHAR(n), DECIMAL(p,s), ANY).
  2. If a complex element type is legitimate, extend ARRAY_TYPE_NAME_PATTERN or handle that column manually.
  3. Filter out ARRAY columns whose TYPE_NAME does not match and report them.

Example fix

// before
column.setDataType(Types.ARRAY);
column.setColumnType("MAP<STRING,INTEGER> NOT NULL ARRAY"); // MAP not in pattern
kylinMetaData.tableDDL(...);

// after
column.setDataType(Types.ARRAY);
column.setColumnType("INTEGER NOT NULL ARRAY"); // scalar element recognized
Defensive patterns

Strategy: validation

Validate before calling

// Mirror the ARRAY_TYPE_NAME_PATTERN intent for a pre-check
private static final java.util.regex.Pattern ARRAY_NAME = java.util.regex.Pattern.compile(
    "\\A((?:BOOLEAN|TINYINT|SMALLINT|INTEGER|BIGINT|FLOAT|REAL|DOUBLE|DATE)" +
    "|(?:CHAR|VARCHAR|TIME|TIMESTAMP)(?:\\([0-9]+\\))?" +
    "|(?:DECIMAL|ANY)(?:\\([0-9]+(?:[ \\t]*,[ \\t]*[0-9]+)?\\))?)" +
    ".*NOT[ \\t]+NULL[ \\t]+ARRAY.*\\z", java.util.regex.Pattern.CASE_INSENSITIVE);
static boolean matchesKylinArrayTypeName(String t) {
    return StringUtils.isNotBlank(t) && ARRAY_NAME.matcher(t).matches();
}

Prevention

When it happens

Trigger: Generating Kylin DDL for an ARRAY column whose columnType text is malformed or uses an element type not in the regex (e.g. "MAP<STRING,INT> ARRAY", "STRUCT<...> ARRAY", or text missing the trailing ARRAY keyword).

Common situations: A Kylin array of a complex type (MAP/STRUCT) not supported by the pattern; metadata text with unexpected formatting; a driver version emitting a different TYPE_NAME shape.

Related errors


AI-assisted analysis of OtterMind/Chat2DB@5ee1e990e7 (2026-08-14). Data as JSON: /api/errors/2755823525075002. Report an issue: GitHub.