risingwavelabs/risingwave · error · ConnectorError

BIT({}) type not supported

Error message

BIT({}) type not supported

What it means

mysql_type_to_rw_type maps MySQL column types to RisingWave types. BIT(1) maps to Boolean; any other BIT width has no RW equivalent, so the function returns 'BIT({n}) type not supported'. This prevents silently truncating multi-bit values into a boolean.

Source

Thrown at src/connector/src/source/cdc/external/mysql.rs:367

fn mysql_type_is_unsigned_bigint(col_type: &ColumnType) -> bool {
    match col_type {
        // MySQL SERIAL is an alias for BIGINT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE.
        ColumnType::Serial => true,
        ColumnType::BigInt(attr) => attr.unsigned == Some(true),
        _ => false,
    }
}

pub fn mysql_type_to_rw_type(col_type: &ColumnType) -> ConnectorResult<DataType> {
    let dtype = match col_type {
        ColumnType::Serial => DataType::Decimal,
        ColumnType::Bit(attr) => {
            if let Some(1) = attr.maximum {
                DataType::Boolean
            } else {
                return Err(
                    anyhow!("BIT({}) type not supported", attr.maximum.unwrap_or(0)).into(),
                );
            }
        }
        // Unsigned integer family needs promotion to avoid overflow.
        ColumnType::TinyInt(_) => DataType::Int16,
        ColumnType::SmallInt(attr) => {
            if attr.unsigned == Some(true) {
                DataType::Int32
            } else {
                DataType::Int16
            }
        }
        ColumnType::Bool => DataType::Boolean,
        ColumnType::MediumInt(_) => DataType::Int32,
        ColumnType::Int(attr) => {
            if attr.unsigned == Some(true) {
                DataType::Int64
            } else {

View on GitHub (pinned to 6469eb736d)

Solutions

  1. Change the MySQL column to TINYINT UNSIGNED (or INT) to store the bitmask, then recreate/refresh the CDC table.
  2. If the column only ever holds 0/1, change it to BIT(1) or BOOLEAN in MySQL.
  3. Drop the column from the CDC table definition if unnecessary.

Example fix

// before (MySQL)
ALTER TABLE t ADD flags BIT(8);
// after
ALTER TABLE t ADD flags TINYINT UNSIGNED;
Defensive patterns

Strategy: validation

Validate before calling

SELECT COLUMN_NAME, COLUMN_TYPE FROM information_schema.COLUMNS
WHERE TABLE_SCHEMA='mydb' AND TABLE_NAME='t' AND DATA_TYPE = 'bit';

Type guard

function bitColumnIsSupported(colType) {
  const m = /^bit\((\d+)\)$/i.exec(colType);
  return m !== null && Number(m[1]) === 1;
}

Try / catch

try { await createCdcTable('t'); } catch (e) { if (String(e).includes('type not supported') && /BIT\(/.test(String(e))) { /* convert BIT(n>1) column to TINYINT UNSIGNED and retry */ } else throw e; }

Prevention

When it happens

Trigger: Creating a CDC table containing a MySQL column of type BIT(n) with n > 1 (e.g. BIT(8)); also triggered during parse_schema_change when an ALTER adds such a column.

Common situations: Legacy schemas using BIT as a bitmask or multi-bit flags; ORM-generated BIT columns; schema evolution adding a wider BIT column.

Related errors


AI-assisted analysis of risingwavelabs/risingwave@6469eb736d (2026-09-11). Data as JSON: /api/errors/70e6e81ae0594dcb. Report an issue: GitHub.