{"record":{"id":"3b40a8f802a5d35c","repo":"apache/iceberg","slug":"unsupported-avro-type-schema-gettype-3b40a8","errorCode":null,"errorMessage":"Unsupported Avro type '\" + schema.getType() + \"'.","messagePattern":"Unsupported Avro type '\" \\+ schema\\.getType\\(\\) \\+ \"'\\.","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"flink/v2.2/flink/src/main/java/org/apache/iceberg/flink/formats/avro/typeutils/AvroSchemaConverter.java","lineNumber":236,"sourceCode":"              || (schema.getLogicalType() != null\n                  && schema.getLogicalType().getName().equals(\"local-timestamp-nanos\"))) {\n            return Types.LOCAL_DATE_TIME;\n          } else if (schema.getLogicalType() == LogicalTypes.timeMicros()\n              || schema.getLogicalType() == LogicalTypes.timeMillis()) {\n            return Types.SQL_TIME;\n          }\n        }\n        return Types.LONG;\n      case FLOAT:\n        return Types.FLOAT;\n      case DOUBLE:\n        return Types.DOUBLE;\n      case BOOLEAN:\n        return Types.BOOLEAN;\n      case NULL:\n        return Types.VOID;\n    }\n    throw new IllegalArgumentException(\"Unsupported Avro type '\" + schema.getType() + \"'.\");\n  }\n\n  /**\n   * Converts an Avro schema string into a nested row structure with deterministic field order and\n   * data types that are compatible with Flink's Table &amp; SQL API.\n   *\n   * @param avroSchemaString Avro schema definition string\n   * @return data type matching the schema\n   */\n  public static DataType convertToDataType(String avroSchemaString) {\n    return convertToDataType(avroSchemaString, true);\n  }\n\n  /**\n   * Converts an Avro schema string into a nested row structure with deterministic field order and\n   * data types that are compatible with Flink's Table &amp; SQL API.\n   *\n   * @param avroSchemaString Avro schema definition string","sourceCodeStart":218,"sourceCodeEnd":254,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/flink/v2.2/flink/src/main/java/org/apache/iceberg/flink/formats/avro/typeutils/AvroSchemaConverter.java#L218-L254","documentation":"The convertToTypeInfo(Schema, boolean) overload maps Avro schema types to Flink TypeInformation. Avro types without a Flink mapping (e.g. FIXED, some logical types, or other exotic branches) fall through the switch and trigger IllegalArgumentException('Unsupported Avro type ...').","triggerScenarios":"Calling convertToTypeInfo with a Schema whose root (or nested branch) is an Avro type the switch does not cover, such as FIXED, or a record/array/map branch containing such a type.","commonSituations":"Schemas containing Avro FIXED for binary data; DECIMAL logical types in TypeInformation path; legacy schemas with unions or enums not supported by the legacy conversion.","solutions":["Replace FIXED fields with BYTES/STRING in the schema, or use the convertToDataType API which supports more types.","Expand FIXED fields to explicit primitive types before conversion.","Update the library version, which may add mappings for the missing Avro type.","If a mapping is genuinely missing, extend the switch in AvroSchemaConverter to handle the type."],"exampleFix":"// before\n{\"name\":\"id\",\"type\":{\"type\":\"fixed\",\"size\":16,\"name\":\"uuid\"}}\n// after\n{\"name\":\"id\",\"type\":\"string\"}","handlingStrategy":"validation","validationCode":"Schema best = new Schema.Parser().parse(schemaString);\nSet<Schema.Type> unsupported = Set.of(Schema.Type.FIXED);\nif (unsupported.contains(best.getType())) throw new IllegalArgumentException(\"Unsupported Avro type: \" + best.getType());\n// also walk record fields recursively","typeGuard":null,"tryCatchPattern":"try { convertToTypeInfo(schema, legacy); } catch (IllegalArgumentException e) { /* switch to convertToDataType path or map FIXED->bytes upstream */ }","preventionTips":["Avoid Avro FIXED in schemas consumed by Flink TypeInformation paths.","Prefer the DataType API (convertToDataType) which supports more types.","Recursively validate schema types before wiring a sink."],"tags":["flink","avro","schema","unsupported-type"],"backgroundTag":"unsupported-enum-value","analyzedSha":"86d9c8fc543e7c56c9f624eb725f76c9baff9570","analyzedAt":"2026-09-12T00:46:39.097Z","contentChangedAt":"2026-09-12T00:46:39.097Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}