{"record":{"id":"70e6e81ae0594dcb","repo":"risingwavelabs/risingwave","slug":"bit-type-not-supported","errorCode":null,"errorMessage":"BIT({}) type not supported","messagePattern":"BIT\\((.+?)\\) type not supported","errorType":"validation","errorClass":"ConnectorError","httpStatus":null,"severity":"error","filePath":"src/connector/src/source/cdc/external/mysql.rs","lineNumber":367,"sourceCode":"\nfn mysql_type_is_unsigned_bigint(col_type: &ColumnType) -> bool {\n    match col_type {\n        // MySQL SERIAL is an alias for BIGINT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE.\n        ColumnType::Serial => true,\n        ColumnType::BigInt(attr) => attr.unsigned == Some(true),\n        _ => false,\n    }\n}\n\npub fn mysql_type_to_rw_type(col_type: &ColumnType) -> ConnectorResult<DataType> {\n    let dtype = match col_type {\n        ColumnType::Serial => DataType::Decimal,\n        ColumnType::Bit(attr) => {\n            if let Some(1) = attr.maximum {\n                DataType::Boolean\n            } else {\n                return Err(\n                    anyhow!(\"BIT({}) type not supported\", attr.maximum.unwrap_or(0)).into(),\n                );\n            }\n        }\n        // Unsigned integer family needs promotion to avoid overflow.\n        ColumnType::TinyInt(_) => DataType::Int16,\n        ColumnType::SmallInt(attr) => {\n            if attr.unsigned == Some(true) {\n                DataType::Int32\n            } else {\n                DataType::Int16\n            }\n        }\n        ColumnType::Bool => DataType::Boolean,\n        ColumnType::MediumInt(_) => DataType::Int32,\n        ColumnType::Int(attr) => {\n            if attr.unsigned == Some(true) {\n                DataType::Int64\n            } else {","sourceCodeStart":349,"sourceCodeEnd":385,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/connector/src/source/cdc/external/mysql.rs#L349-L385","documentation":"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.","triggerScenarios":"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.","commonSituations":"Legacy schemas using BIT as a bitmask or multi-bit flags; ORM-generated BIT columns; schema evolution adding a wider BIT column.","solutions":["Change the MySQL column to TINYINT UNSIGNED (or INT) to store the bitmask, then recreate/refresh the CDC table.","If the column only ever holds 0/1, change it to BIT(1) or BOOLEAN in MySQL.","Drop the column from the CDC table definition if unnecessary."],"exampleFix":"// before (MySQL)\nALTER TABLE t ADD flags BIT(8);\n// after\nALTER TABLE t ADD flags TINYINT UNSIGNED;","handlingStrategy":"validation","validationCode":"SELECT COLUMN_NAME, COLUMN_TYPE FROM information_schema.COLUMNS\nWHERE TABLE_SCHEMA='mydb' AND TABLE_NAME='t' AND DATA_TYPE = 'bit';","typeGuard":"function bitColumnIsSupported(colType) {\n  const m = /^bit\\((\\d+)\\)$/i.exec(colType);\n  return m !== null && Number(m[1]) === 1;\n}","tryCatchPattern":"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; }","preventionTips":["Only use BIT(1) in tables destined for CDC","Replace multi-bit BIT columns with unsigned integer types","Check DATA_TYPE='bit' columns in information_schema before onboarding"],"tags":["cdc","mysql","type-mapping","unsupported-type"],"backgroundTag":"unsupported-dtype","analyzedSha":"6469eb736d691e8e9b8a419a57edd6429ca77417","analyzedAt":"2026-09-11T21:06:21.487Z","contentChangedAt":"2026-09-11T21:06:21.487Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}