OtterMind/Chat2DB · error · IllegalArgumentException

Missing JDBC type for Kylin column: {name}

Error message

Missing JDBC type for Kylin column: {name}

What it means

Thrown by KylinMetaData.renderColumnType when TableColumn.getDataType() (the JDBC java.sql.Types code) is null. Without a JDBC type code the type cannot be mapped to a Kylin column type, so building the CREATE TABLE column definition fails fast.

Source

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

        StringBuilder definition = new StringBuilder(quoteIdentifier(column.getName()))
                .append(' ')
                .append(dataType);

        if (Objects.equals(column.getNullable(), 0)) {
            definition.append(" NOT NULL");
        }
        if (StringUtils.isNotEmpty(column.getComment())) {
            definition.append(" COMMENT '")
                    .append(getSQLIdentifierProcessor().escapeString(column.getComment()))
                    .append('\'');
        }
        return definition.toString();
    }

    private String renderColumnType(TableColumn column) {
        Integer jdbcType = column.getDataType();
        if (jdbcType == null) {
            throw new IllegalArgumentException("Missing JDBC type for Kylin column: " + column.getName());
        }

        String typeName = switch (jdbcType) {
            case Types.BIT, Types.BOOLEAN -> "BOOLEAN";
            case Types.TINYINT -> "TINYINT";
            case Types.SMALLINT -> "SMALLINT";
            case Types.INTEGER -> "INTEGER";
            case Types.BIGINT -> "BIGINT";
            case Types.FLOAT -> "FLOAT";
            case Types.REAL -> "REAL";
            case Types.DOUBLE -> "DOUBLE";
            case Types.NUMERIC, Types.DECIMAL -> "DECIMAL";
            case Types.CHAR, Types.NCHAR -> "CHAR";
            case Types.VARCHAR, Types.LONGVARCHAR, Types.NVARCHAR, Types.LONGNVARCHAR -> "VARCHAR";
            case Types.DATE -> "DATE";
            case Types.TIME -> "TIME";
            case Types.TIMESTAMP -> "TIMESTAMP";
            case Types.JAVA_OBJECT -> "ANY";

View on GitHub (pinned to 5ee1e990e7)

Solutions

  1. Ensure every TableColumn has a non-null dataType (java.sql.Types integer) before generating Kylin DDL.
  2. Filter out columns with null dataType and log them, rather than aborting the whole table.
  3. If the driver omits DATA_TYPE, populate it from TYPE_NAME at the metadata-read layer.

Example fix

// before
TableColumn c = new TableColumn();
c.setName("c1"); // dataType left null
columns.add(c);
kylinMetaData.tableDDL(...);

// after
TableColumn c = new TableColumn();
c.setName("c1");
c.setDataType(Types.VARCHAR); // required java.sql.Types code
columns.add(c);
Defensive patterns

Strategy: validation

Validate before calling

static boolean hasJdbcType(TableColumn c) {
    return c != null && c.getDataType() != null;
}

Prevention

When it happens

Trigger: Generating Kylin table DDL (KylinMetaData.tableDDL -> buildColumnDefinition -> renderColumnType) for a column whose dataType was not populated by the JDBC metadata reader.

Common situations: A Kylin driver/JDBC metadata row that did not return a DATA_TYPE value; a manually constructed TableColumn used for DDL without setting dataType; a stale column model after a schema change.

Related errors


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