OtterMind/Chat2DB · error · IllegalArgumentException

Unsupported Hive index type: {type}

Error message

Unsupported Hive index type: {type}

What it means

Thrown in HiveSqlBuilder.createTable when HiveIndexTypeEnum.getByType(tableIndex.getType()) returns null, i.e. the index type string is not one of the recognized Hive index types. It only fires when the index already passed the blank-name/blank-type skip filter, so a non-null unknown type reaches the lookup.

Source

Thrown at chat2db-community-server/chat2db-community-plugins/chat2db-community-hive/src/main/java/ai/chat2db/plugin/hive/builder/HiveSqlBuilder.java:126

        script.append(SQL_CREATE_TABLE);
        if (StringUtils.isNotBlank(table.getDatabaseName())) {
            script.append(HiveIdentifierProcessor.INSTANCE.quoteIdentifierAlways(table.getDatabaseName())).append(SQLConstants.DOT);
        }
        script.append(HiveIdentifierProcessor.INSTANCE.quoteIdentifierAlways(table.getName())).append(SQLConstants.SPACE_OPEN_PARENTHESIS).append(SQLConstants.LINE_SEPARATOR);
        for (TableColumn column : table.getColumnList()) {
            if (StringUtils.isBlank(column.getName()) || StringUtils.isBlank(column.getColumnType())) {
                continue;
            }
            script.append(SQLConstants.TAB).append(HiveColumnTypeEnum.buildCreateColumnSqlSafely(column))
                    .append(SQLConstants.COMMA_LINE_SEPARATOR);
        }
        for (TableIndex tableIndex : table.getIndexList()) {
            if (StringUtils.isBlank(tableIndex.getName()) || StringUtils.isBlank(tableIndex.getType())) {
                continue;
            }
            HiveIndexTypeEnum hiveIndexTypeEnum = HiveIndexTypeEnum.getByType(tableIndex.getType());
            if (hiveIndexTypeEnum == null) {
                throw new IllegalArgumentException("Unsupported Hive index type: " + tableIndex.getType());
            }
            script.append(SQLConstants.TAB).append(SQLConstants.EMPTY).append(hiveIndexTypeEnum.buildIndexScript(tableIndex)).append(SQLConstants.COMMA_LINE_SEPARATOR);
        }

        script = new StringBuilder(script.substring(0, script.length() - 2));
        script.append(SQLConstants.LINE_SEPARATOR_CLOSE_PARENTHESIS);


        if (StringUtils.isNotBlank(table.getEngine())) {
            script.append(SQLConstants.ENGINE_SQL).append(HiveSqlGuards.requireHiveName(table.getEngine(), "engine"));
        }

        if (StringUtils.isNotBlank(table.getCharset())) {
            script.append(SQLConstants.DEFAULT_CHARACTER_SET_SQL).append(HiveSqlGuards.requireHiveName(table.getCharset(), "charset"));
        }

        if (StringUtils.isNotBlank(table.getCollate())) {
            script.append(SQLConstants.COLLATE_SQL).append(HiveSqlGuards.requireHiveName(table.getCollate(), "collation"));

View on GitHub (pinned to 5ee1e990e7)

Solutions

  1. Use only Hive-supported index type strings that HiveIndexTypeEnum recognizes.
  2. Filter the index list to Hive-supported types before building CREATE TABLE.
  3. If the index is not relevant to Hive, remove it from table.getIndexList() for that build.

Example fix

// before
table.getIndexList().add(idxWithFulltext); // type "FULLTEXT"
new HiveSqlBuilder().createTable(table);

// after
table.setIndexList(table.getIndexList().stream()
    .filter(i -> HiveIndexTypeEnum.getByType(i.getType()) != null)
    .toList());
new HiveSqlBuilder().createTable(table);
Defensive patterns

Strategy: validation

Validate before calling

static boolean isSupportedHiveIndexType(String type) {
    return StringUtils.isNotBlank(type) && ai.chat2db.plugin.hive.enums.type.HiveIndexTypeEnum.getByType(type) != null;
}

Prevention

When it happens

Trigger: Building a CREATE TABLE for Hive where table.getIndexList() contains a TableIndex whose type is a non-blank but unsupported string (e.g. "FULLTEXT", "SPATIAL", a MySQL-style type).

Common situations: Reusing a TableIndex model from MySQL/PostgreSQL inside the Hive builder; a UI exposing all dialect index types to Hive; a typo in the index type.

Related errors


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