{"record":{"id":"2755823525075002","repo":"OtterMind/Chat2DB","slug":"unsupported-kylin-jdbc-array-type-for-column-nam","errorCode":null,"errorMessage":"Unsupported Kylin JDBC ARRAY type for column: {name}","messagePattern":"Unsupported Kylin JDBC ARRAY type for column: (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"chat2db-community-server/chat2db-community-plugins/chat2db-community-kylin/src/main/java/ai/chat2db/plugin/kylin/KylinMetaData.java","lineNumber":127,"sourceCode":"        if (\"DECIMAL\".equals(typeName) && columnSize != null && columnSize > 0) {\n            Integer decimalDigits = column.getDecimalDigits();\n            if (decimalDigits != null && decimalDigits >= 0) {\n                return typeName + '(' + columnSize.toString() + ',' + decimalDigits + ')';\n            }\n            return typeName + '(' + columnSize.toString() + ')';\n        }\n        return typeName;\n    }\n\n    private String renderArrayType(TableColumn column) {\n        String jdbcTypeName = column.getColumnType();\n        if (StringUtils.isBlank(jdbcTypeName)) {\n            throw new IllegalArgumentException(\"Missing JDBC type name for Kylin ARRAY column: \" + column.getName());\n        }\n\n        Matcher matcher = ARRAY_TYPE_NAME_PATTERN.matcher(jdbcTypeName);\n        if (!matcher.matches()) {\n            throw new IllegalArgumentException(\"Unsupported Kylin JDBC ARRAY type for column: \" + column.getName());\n        }\n        String elementType = matcher.group(1)\n                .replace(\" \", \"\")\n                .replace(\"\\t\", \"\")\n                .toUpperCase(Locale.ROOT);\n        return \"ARRAY<\" + elementType + '>';\n    }\n\n    private String buildCreateIndex(String tableName, TableIndex index) {\n        if (StringUtils.isBlank(index.getName()) || index.getColumnList() == null || index.getColumnList().isEmpty()) {\n            return \"\";\n        }\n\n        StringJoiner columns = new StringJoiner(\", \");\n        for (TableIndexColumn column : index.getColumnList()) {\n            columns.add(quoteIdentifier(column.getColumnName()));\n        }\n        return \"CREATE \" + (Boolean.TRUE.equals(index.getUnique()) ? \"UNIQUE \" : \"\")","sourceCodeStart":109,"sourceCodeEnd":145,"githubUrl":"https://github.com/OtterMind/Chat2DB/blob/5ee1e990e73fbcae1969dc554be254fedb3ab888/chat2db-community-server/chat2db-community-plugins/chat2db-community-kylin/src/main/java/ai/chat2db/plugin/kylin/KylinMetaData.java#L109-L145","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Ensure the ARRAY column uses a scalar element type the pattern recognizes (BOOLEAN, TINYINT, ..., VARCHAR(n), DECIMAL(p,s), ANY).","If a complex element type is legitimate, extend ARRAY_TYPE_NAME_PATTERN or handle that column manually.","Filter out ARRAY columns whose TYPE_NAME does not match and report them."],"exampleFix":"// before\ncolumn.setDataType(Types.ARRAY);\ncolumn.setColumnType(\"MAP<STRING,INTEGER> NOT NULL ARRAY\"); // MAP not in pattern\nkylinMetaData.tableDDL(...);\n\n// after\ncolumn.setDataType(Types.ARRAY);\ncolumn.setColumnType(\"INTEGER NOT NULL ARRAY\"); // scalar element recognized","handlingStrategy":"validation","validationCode":"// Mirror the ARRAY_TYPE_NAME_PATTERN intent for a pre-check\nprivate static final java.util.regex.Pattern ARRAY_NAME = java.util.regex.Pattern.compile(\n    \"\\\\A((?:BOOLEAN|TINYINT|SMALLINT|INTEGER|BIGINT|FLOAT|REAL|DOUBLE|DATE)\" +\n    \"|(?:CHAR|VARCHAR|TIME|TIMESTAMP)(?:\\\\([0-9]+\\\\))?\" +\n    \"|(?:DECIMAL|ANY)(?:\\\\([0-9]+(?:[ \\\\t]*,[ \\\\t]*[0-9]+)?\\\\))?)\" +\n    \".*NOT[ \\\\t]+NULL[ \\\\t]+ARRAY.*\\\\z\", java.util.regex.Pattern.CASE_INSENSITIVE);\nstatic boolean matchesKylinArrayTypeName(String t) {\n    return StringUtils.isNotBlank(t) && ARRAY_NAME.matcher(t).matches();\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use ARRAY columns with scalar element types the pattern recognizes.","Extend the pattern if a legitimate complex element type must be supported.","Filter non-matching ARRAY columns and report them rather than aborting."],"tags":["kylin","metadata","ddl","jdbc","array","validation"],"backgroundTag":null,"analyzedSha":"5ee1e990e73fbcae1969dc554be254fedb3ab888","analyzedAt":"2026-08-14T07:05:03.077Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}