{"record":{"id":"9f9f7ca3763b2afc","repo":"apache/seatunnel","slug":"common-19-9f9f7c","errorCode":"COMMON-19","errorMessage":"'<identifier>' unsupported convert SeaTunnel data type '<dataType>' of '<field>' to connector data type.","messagePattern":"'<identifier>' unsupported convert SeaTunnel data type '<dataType>' of '<field>' to connector data type\\.","errorType":"error_code","errorClass":"org.apache.seatunnel.common.exception.SeaTunnelRuntimeException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/duckdb/DuckDBTypeConverter.java","lineNumber":296,"sourceCode":"            case TIME:\n                builder.columnType(DUCKDB_TIME);\n                builder.dataType(DUCKDB_TIME);\n                break;\n            case TIMESTAMP:\n                builder.columnType(DUCKDB_TIMESTAMP);\n                builder.dataType(DUCKDB_TIMESTAMP);\n                break;\n            case TIMESTAMP_TZ:\n                builder.columnType(DUCKDB_TIMESTAMP_WITH_TZ);\n                builder.dataType(DUCKDB_TIMESTAMP_WITH_TZ);\n                break;\n            case BYTES:\n                builder.columnType(DUCKDB_BLOB);\n                builder.dataType(DUCKDB_BLOB);\n                builder.length(column.getColumnLength());\n                break;\n            default:\n                throw CommonError.convertToConnectorTypeError(\n                        DatabaseIdentifier.DUCKDB,\n                        column.getDataType().getSqlType().name(),\n                        column.getName());\n        }\n        return builder.build();\n    }\n\n    private void reconvertDecimalType(\n            Column column, BasicTypeDefine.BasicTypeDefineBuilder builder) {\n        DecimalType decimalType = (DecimalType) column.getDataType();\n        long precision =\n                decimalType.getPrecision() > 0 ? decimalType.getPrecision() : DEFAULT_PRECISION;\n        int scale = decimalType.getScale();\n        if (precision > MAX_PRECISION) {\n            log.warn(\n                    \"DECIMAL precision {} exceeds maximum {}, truncating to {}\",\n                    precision,\n                    MAX_PRECISION,","sourceCodeStart":278,"sourceCodeEnd":314,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/duckdb/DuckDBTypeConverter.java#L278-L314","documentation":"This error is thrown by DuckDBTypeConverter.reconvert() when converting a SeaTunnel data type back to a DuckDB column type. The switch handles the supported DuckDB physical types (BOOLEAN, integer widths, float/double, DECIMAL, VARCHAR, DATE/TIME/TIMESTAMP variants, DUCKDB_BLOB for BYTES, etc.); any SeaTunnel type without a case reaches the default branch and CommonError.convertToConnectorTypeError is raised with the DUCKDB identifier, the SeaTunnel type's SQL type name, and the column name.","triggerScenarios":"Writing to DuckDB via the JDBC sink when DuckDB needs to derive the target column type (schema_save_mode creating the table, auto table creation, or schema evolution) and the SeaTunnel schema contains a type the converter cannot map — typically ARRAY, MAP, or ROW composite types, or time types without a matching DuckDB case.","commonSituations":"Piping data from a source that emits nested/complex types (JSON, Kafka formats, transforms producing MAP/ARRAY) into a DuckDB sink with automatic table creation enabled. Also occurs after upstream schema changes introduce a new field type.","solutions":["Convert complex fields to scalar types before the sink (e.g. serialize to STRING via a transform), so the DuckDB column type can be resolved.","Pre-create the DuckDB table with explicit column types and disable auto creation (schema_save_mode = ERROR_WHEN_SCHEMA_NOT_EXIST).","Filter out unsupported columns from the sink dataset.","Upgrade SeaTunnel to a version with broader DuckDB type coverage.","Extend DuckDBTypeConverter.reconvert() with a mapping for the missing SeaTunnel type if the data can be represented (e.g. MAP -> VARCHAR/JSON)."],"exampleFix":"// before: sink auto-creates table from schema containing ARRAY<INT>\nsink {\n  Jdbc {\n    url = \"jdbc:duckdb:/path/db.duckdb\"\n    schema_save_mode = \"CREATE_SCHEMA_WHEN_NOT_EXIST\"\n  }\n}\n// after: cast ARRAY to string upstream, or pre-create table\nsink {\n  Jdbc {\n    url = \"jdbc:duckdb:/path/db.duckdb\"\n    schema_save_mode = \"ERROR_WHEN_SCHEMA_NOT_EXIST\"\n  }\n}","handlingStrategy":"validation","validationCode":"// Verify the DuckDB sink schema only contains primitive types before writing\nfor (CatalogColumn col : catalogTable.getTableSchema().getColumns()) {\n    if (!(col.getDataType() instanceof SeaTunnelPrimitiveType)) {\n        throw new IllegalArgumentException(\n            \"Field \" + col.getName() + \" (\" + col.getDataType().getSqlType()\n            + \") has no DuckDB column mapping; flatten it or pre-create the table.\");\n    }\n}","typeGuard":"static boolean isDuckDbWritable(SeaTunnelDataType<?> t) {\n    return t instanceof SeaTunnelPrimitiveType; // composite types lack reconvert mappings\n}","tryCatchPattern":"try {\n    sinkWriter.write(...);\n} catch (SeaTunnelRuntimeException e) {\n    if (e.getMessage().contains(\"COMMON-19\") && e.getMessage().contains(\"DUCKDB\")) {\n        throw new IllegalArgumentException(\"Flatten unsupported field or pre-create the DuckDB table\", e);\n    }\n    throw e;\n}","preventionTips":["Do not pipe JSON/Kafka nested fields straight into a DuckDB sink with auto table creation; convert MAP/ARRAY/ROW to STRING first.","Pre-create DuckDB tables with explicit types and set schema_save_mode = ERROR_WHEN_SCHEMA_NOT_EXIST.","Re-check the upstream schema whenever source tables change."],"tags":["jdbc","duckdb","type-conversion","sink","table-creation"],"backgroundTag":"unsupported-dtype","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}