{"record":{"id":"7ee84a71f4223dc8","repo":"apache/iceberg","slug":"unsupported-type-for-parquet-primitive","errorCode":null,"errorMessage":"Unsupported type for Parquet: ${primitive}","messagePattern":"Unsupported type for Parquet: (.+?)","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"parquet/src/main/java/org/apache/iceberg/parquet/TypeToMessageType.java","lineNumber":304,"sourceCode":"\n      case GEOMETRY:\n        GeometryType geometry = (GeometryType) primitive;\n        return Types.primitive(BINARY, repetition)\n            .as(LogicalTypeAnnotation.geometryType(geometry.crs()))\n            .id(id)\n            .named(name);\n\n      case GEOGRAPHY:\n        GeographyType geography = (GeographyType) primitive;\n        return Types.primitive(BINARY, repetition)\n            .as(\n                LogicalTypeAnnotation.geographyType(\n                    geography.crs(), toParquet(geography.algorithm())))\n            .id(id)\n            .named(name);\n\n      default:\n        throw new UnsupportedOperationException(\"Unsupported type for Parquet: \" + primitive);\n    }\n  }\n\n  private static EdgeInterpolationAlgorithm toParquet(EdgeAlgorithm algorithm) {\n    // Iceberg and Parquet use the same algorithm names (SPHERICAL, VINCENTY, THOMAS, ANDOYER,\n    // KARNEY) so the algorithm is mapped by name\n    return EdgeInterpolationAlgorithm.valueOf(algorithm.name());\n  }\n\n  private static LogicalTypeAnnotation decimalAnnotation(int precision, int scale) {\n    return LogicalTypeAnnotation.decimalType(scale, precision);\n  }\n}\n","sourceCodeStart":286,"sourceCodeEnd":318,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/parquet/src/main/java/org/apache/iceberg/parquet/TypeToMessageType.java#L286-L318","documentation":"TypeToMessageType.primitive maps Iceberg primitive types to Parquet PrimitiveTypes with logical type annotations. The switch covers all known primitives; hitting default means an Iceberg primitive type has no Parquet mapping in this version, so conversion aborts with UnsupportedOperationException naming the type.","triggerScenarios":"Calling TypeToMessageType.primitive() (via field()) with an Iceberg primitive type not handled by the switch — typically a newly introduced type (e.g. a variant/geography/unknown-nanosecond type) on an older converter, or a custom primitive type.","commonSituations":"Writing tables whose schema uses a type added in a newer Iceberg spec while the parquet module is older; custom Type implementations; unknown types deserialized from foreign metadata.","solutions":["Read the type named in the message and confirm it is a supported Iceberg primitive for Parquet writes.","Upgrade iceberg-parquet (and Iceberg generally) to a version that maps the type.","Remove or remap the unsupported column (e.g. store as string/binary) if upgrading is not possible."],"exampleFix":"// before\nSchema schema = new Schema(required(1, \"v\", Types.VariantType.get())); // older writer\ntypeToMessageType.convert(schema.asStruct());\n// after\n// upgrade to a version where VariantType maps to Parquet variant, or:\nSchema schema = new Schema(required(1, \"v\", Types.StringType.get()));","handlingStrategy":"validation","validationCode":"Set<Class<?>> unsupported = schema.columns().stream()\n    .map(f -> f.type().getClass())\n    .filter(c -> !SUPPORTED_PARQUET_PRIMITIVES.contains(c))\n    .collect(Collectors.toSet());\nif (!unsupported.isEmpty()) { throw new IllegalArgumentException(\"Unsupported for Parquet: \" + unsupported); }","typeGuard":"boolean supportedForParquet(Type t) { return t.isPrimitiveType() && KNOWN_MAPPINGS.containsKey(t.asPrimitiveType().typeId()); }","tryCatchPattern":"try {\n  schemaDataType = typeToMessageType.convert(schema.asStruct());\n} catch (UnsupportedOperationException e) {\n  LOG.error(\"Column type unsupported by this Iceberg version: {}\", e.getMessage());\n  throw e;\n}","preventionTips":["Align iceberg-core and iceberg-parquet versions before writing tables with new types.","Validate schemas against supported Parquet types at job submission.","Pre-remap unsupported columns (e.g. to string) when pinned to older versions."],"tags":["parquet","type-conversion","unsupported-type"],"backgroundTag":"unsupported-dtype","analyzedSha":"86d9c8fc543e7c56c9f624eb725f76c9baff9570","analyzedAt":"2026-09-12T00:46:39.097Z","contentChangedAt":"2026-09-12T00:46:39.097Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}