{"record":{"id":"5075b08ad3fc8e3c","repo":"apache/seatunnel","slug":"type-mismatch-for-column-s-inside-target-bigque","errorCode":null,"errorMessage":"Type mismatch for column '%s' inside target BigQuery table '%s'. Source type: '%s', target type: '%s'","messagePattern":"Type mismatch for column '(.+?)' inside target BigQuery table '(.+?)'\\. Source type: '(.+?)', target type: '(.+?)'","errorType":"exception","errorClass":"CatalogException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-bigquery/src/main/java/org/apache/seatunnel/connectors/bigquery/sink/BigQuerySaveModeHandler.java","lineNumber":115,"sourceCode":"\n            for (Column sourceColumn : catalogTable.getTableSchema().getColumns()) {\n                Optional<Column> remoteColOpt =\n                        remoteTable.getTableSchema().getColumns().stream()\n                                .filter(c -> c.getName().equalsIgnoreCase(sourceColumn.getName()))\n                                .findFirst();\n\n                if (!remoteColOpt.isPresent()) {\n                    throw new CatalogException(\n                            String.format(\n                                    \"Target BigQuery table '%s' is missing source column: '%s'\",\n                                    tablePath.getFullName(), sourceColumn.getName()));\n                }\n\n                Column remoteColumn = remoteColOpt.get();\n                if (!isTypeCompatible(\n                        sourceColumn.getDataType().getSqlType(),\n                        remoteColumn.getDataType().getSqlType())) {\n                    throw new CatalogException(\n                            String.format(\n                                    \"Type mismatch for column '%s' inside target BigQuery table '%s'. Source type: '%s', target type: '%s'\",\n                                    sourceColumn.getName(),\n                                    tablePath.getFullName(),\n                                    sourceColumn.getDataType().getSqlType(),\n                                    remoteColumn.getDataType().getSqlType()));\n                }\n            }\n            log.info(\n                    \"BigQuery schema coherence check passed successfully for table: {}\",\n                    tablePath.getFullName());\n        } catch (TableNotExistException e) {\n            log.info(\n                    \"Target BigQuery table '{}' does not exist yet. Skipping schema coherence check.\",\n                    tablePath.getFullName());\n            return;\n        } catch (Exception e) {\n            if (e instanceof CatalogException) {","sourceCodeStart":97,"sourceCodeEnd":133,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-bigquery/src/main/java/org/apache/seatunnel/connectors/bigquery/sink/BigQuerySaveModeHandler.java#L97-L133","documentation":"This CatalogException is thrown by BigQuerySaveModeHandler.validateSchemaCoherence when isTypeCompatible determines that the SeaTunnel SqlType of a source column cannot be written into the corresponding BigQuery column's SqlType in save-mode ERROR. Both the source and target types are reported in the message. It prevents silent data corruption from incompatible type coercions.","triggerScenarios":"Running a sink with schema_save_mode=ERROR against an existing BigQuery table whose column type is incompatible with the source — e.g. source STRING vs target INT64, source DECIMAL vs target STRING, source TIMESTAMP vs target DATE, or source array/struct types that the compatibility map disallows.","commonSituations":"Table created earlier with different types; upstream connector schema changed (e.g. int -> string); BigQuery maps a column to a narrower type; user expects implicit casts that the strict compatibility check rejects.","solutions":["Cast the conflicting column in the SeaTunnel config (e.g. via a transform or source read options) to match the BigQuery type, or ALTER the BigQuery column type if safely castable","Set schema_save_mode=EVOLVE_SCHEMA / allow type evolution so the handler reconciles types","Recreate the target table with types matching the source schema","Check isTypeCompatible rules to pick a supported type pair"],"exampleFix":"// before\nschema_save_mode = ERROR   // source INT64 vs target STRING -> mismatch\n// after\nschema_save_mode = EVOLVE_SCHEMA\n// or transform source: CAST(id AS STRING)","handlingStrategy":"validation","validationCode":"for (Column c : sourceSchema.getColumns()) {\n    Column rc = remoteSchema.getColumn(c.getName());\n    if (rc != null && !compatible(c.getDataType().getSqlType(), rc.getDataType().getSqlType())) {\n        LOG.error(\"Type mismatch on column \" + c.getName() + \": \"\n            + c.getDataType().getSqlType() + \" vs \" + rc.getDataType().getSqlType());\n    }\n}","typeGuard":null,"tryCatchPattern":"try {\n    handler.handleSchemaSaveMode();\n} catch (CatalogException e) {\n    if (e.getMessage() != null && e.getMessage().startsWith(\"Type mismatch for column\")) {\n        LOG.error(\"Align column types (cast in source/transform) or enable EVOLVE_SCHEMA\");\n    }\n    throw e;\n}","preventionTips":["Match source SqlTypes to BigQuery types when creating target tables","Add explicit casts in transforms for known type gaps (e.g. STRING vs INT64)","Prefer schema_save_mode=EVOLVE_SCHEMA where type drift is expected","Recreate legacy tables whose types no longer fit the source schema"],"tags":["bigquery","type-mismatch","schema-validation","save-mode"],"backgroundTag":"type-mismatch","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}