{"record":{"id":"ad59d3e97b22d9ad","repo":"apache/iceberg","slug":"position-delete-writer-does-not-support-row-data-ad59d3","errorCode":null,"errorMessage":"Position delete writer does not support row data","messagePattern":"Position delete writer does not support row data","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"orc/src/main/java/org/apache/iceberg/orc/ORC.java","lineNumber":649,"sourceCode":"          FileFormat.ORC,\n          location,\n          spec,\n          partition,\n          keyMetadata,\n          sortOrder,\n          equalityFieldIds);\n    }\n\n    public <T> PositionDeleteWriter<T> buildPositionWriter() {\n      Preconditions.checkState(\n          equalityFieldIds == null, \"Cannot create position delete file using delete field ids\");\n      Preconditions.checkArgument(\n          spec != null, \"Spec must not be null when creating position delete writer\");\n      Preconditions.checkArgument(\n          spec.isUnpartitioned() || partition != null,\n          \"Partition must not be null for partitioned writes\");\n      if (rowSchema != null) {\n        throw new UnsupportedOperationException(\"Position delete writer does not support row data\");\n      }\n\n      meta(\"delete-type\", \"position\");\n\n      appenderBuilder.schema(DeleteSchemaUtil.pathPosSchema());\n\n      // the createWriterFunc is ignored, since only the path and position are written\n      appenderBuilder.createWriterFunc(\n          (schema, typeDescription) ->\n              GenericOrcWriters.positionDelete(\n                  GenericOrcWriter.buildWriter(schema, typeDescription), Function.identity()));\n\n      appenderBuilder.createContextFunc(WriteBuilder.Context::deleteContext);\n\n      return new PositionDeleteWriter<>(\n          appenderBuilder.build(), FileFormat.ORC, location, spec, partition, keyMetadata);\n    }\n  }","sourceCodeStart":631,"sourceCodeEnd":667,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/orc/src/main/java/org/apache/iceberg/orc/ORC.java#L631-L667","documentation":"ORC's DeleteWriteBuilder for position deletes only writes the (path, pos) schema. Unlike Parquet, ORC position delete writers do not support storing the deleted row alongside the position, so if a row schema (rowSchema) was supplied the builder throws UnsupportedOperationException.","triggerScenarios":"Calling DeleteWriteBuilder.rowSchema(...) (or an API that sets it) before building an ORC position delete writer — i.e. writing format-version 2 position deletes with row data on ORC files.","commonSituations":"Porting a Parquet delete-writer code path to ORC; generic write pipelines that set rowSchema for all formats; using the merge-on-read row-in-delete feature with an ORC table.","solutions":["Do not call rowSchema() for ORC position delete writers; write position-only deletes","Switch the table's format to Parquet if row-in-position-delete is required","Remove the rowSchema configuration from the delete write path"],"exampleFix":"// before\ndeleteWriteBuilder.rowSchema(table.schema()); // throws for ORC\n// after\ndeleteWriteBuilder.spec(spec).partition(partition); // position-only delete, no rowSchema","handlingStrategy":"type-guard","validationCode":"if (format == FileFormat.ORC && rowSchema != null) {\n  throw new IllegalArgumentException(\"rowSchema is not supported for ORC position deletes\");\n}","typeGuard":"boolean orcRowDeleteSupported(FileFormat f) { return f != FileFormat.ORC; }","tryCatchPattern":"try {\n  appender = deleteWriteBuilder.build();\n} catch (UnsupportedOperationException e) {\n  if (e.getMessage().contains(\"does not support row data\")) {\n    throw new IllegalStateException(\"Write position-only deletes for ORC (drop rowSchema)\", e);\n  } throw e;\n}","preventionTips":["Never call rowSchema() on ORC delete write builders","Choose Parquet if row-in-position-delete is required","Keep delete-writer construction format-conditional in generic pipelines"],"tags":["orc","position-delete","unsupported-feature"],"backgroundTag":"operation-not-supported","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"}