apache/iceberg · error · UnsupportedOperationException
Cannot drop partition field in non-Iceberg table: $table
Error message
Cannot drop partition field in non-Iceberg table: $table
What it means
This UnsupportedOperationException is thrown by Spark's DROP PARTITION FIELD execution when the target table is not an Iceberg table. Partition field (partition spec evolution) changes are Iceberg-only; the non-Iceberg table case falls through to the default match and throws.
Source
Thrown at spark/v4.2/spark-extensions/src/main/scala/org/apache/spark/sql/execution/datasources/v2/DropPartitionFieldExec.scala:58
val schema = iceberg.table.schema
transform match {
case IdentityTransform(FieldReference(parts))
if parts.size == 1 && schema.findField(parts.head) == null =>
// the name is not present in the Iceberg schema, so it must be a partition field name, not a column name
iceberg.table
.updateSpec()
.removeField(parts.head)
.commit()
case _ =>
iceberg.table
.updateSpec()
.removeField(Spark3Util.toIcebergTerm(transform))
.commit()
}
case table =>
throw new UnsupportedOperationException(
s"Cannot drop partition field in non-Iceberg table: $table")
}
Nil
}
override def simpleString(maxFields: Int): String = {
s"DropPartitionField ${catalog.name}.${ident.quoted} ${transform.describe}"
}
}
View on GitHub (pinned to 86d9c8fc54)
Solutions
- Confirm the table is an Iceberg table
- Qualify the table name with the Iceberg catalog in the DDL
- Check spark.sql.catalog.<name> points to org.apache.iceberg.spark.SparkCatalog
- Rewrite the statement to the native provider's partitioning API if the table is not Iceberg
Example fix
// before ALTER TABLE other_table DROP PARTITION FIELD years(ts); // after ALTER TABLE iceberg_catalog.db.other_table DROP PARTITION FIELD years(ts);
Defensive patterns
Strategy: validation
Validate before calling
val icebergTable = Spark3Util.loadIcebergTable(spark, fullTableName) require(icebergTable != null, s"$fullTableName is not an Iceberg table")
Type guard
def isIcebergTable(spark: SparkSession, name: String): Boolean = scala.util.Try(Spark3Util.loadIcebergTable(spark, name)).map(_ != null).getOrElse(false)
Prevention
- Confirm provider=iceberg via DESCRIBE TABLE EXTENDED before partition evolution
- Qualify with the Iceberg catalog in DDL scripts
- Separate Iceberg-specific DDL from other engines' scripts
When it happens
Trigger: Running 'ALTER TABLE ... DROP PARTITION FIELD <transform>' where the table resolves to a non-Iceberg Spark table.
Common situations: Migrating DDL scripts written for Iceberg to tables in other formats; missing or wrong catalog qualification; catalog plugin misconfiguration.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- v4 manifests are not bound to a single partition spec
- Renaming a view is not supported by catalog: ${catalogName}
- Cannot convert predicate to SQL: <pred>
- Cannot convert term to SQL: <term>
- Cannot retrieve UUID for table <table.name()>
AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12).
Data as JSON: /api/errors/392453ec071d188d.
Report an issue: GitHub.