#28156·presto

Support ALTER TABLE ALTER COLUMN SET/DROP NOT NULL for Iceberg and the native (Prestissimo) worker

Author: Joe-AbrahamCreated Jul 15, 2026Updated Sep 14, 2026
Labelsfeature requesticeberg

Summary

ALTER TABLE ... ALTER COLUMN ... SET NOT NULL / DROP NOT NULL is only partially supported across connectors and execution engines. This issue tracks closing the remaining gaps so the feature behaves consistently everywhere.

Current state

  • Hive connector (Java engine): SET NOT NULL / DROP NOT NULL supported; enforced on INSERT by TableWriterOperator.
  • Hive connector (native/Prestissimo worker): DDL succeeds, but a NOT NULL constraint added via ALTER COLUMN SET NOT NULL is not enforced on writes — inserting NULL into such a column succeeds instead of failing with NULL value not allowed for NOT NULL column: <col>.
  • Iceberg connector (Java engine): SET NOT NULL supported (metadata-only Iceberg schema evolution via requireColumn). DROP NOT NULL is not implementedALTER TABLE ... ALTER COLUMN ... DROP NOT NULL fails with This connector does not support dropping table constraints.
  • Iceberg connector (native/Prestissimo worker): not exercised today; no native test coverage exists for either SET NOT NULL or DROP NOT NULL.

Desired behavior

  1. ALTER TABLE ... ALTER COLUMN ... DROP NOT NULL is implemented for the Iceberg connector (IcebergAbstractMetadata), mirroring the existing addConstraint/SET NOT NULL implementation via UpdateSchema.makeColumnOptional(...).
  2. The native (Prestissimo/Velox) worker enforces NOT NULL constraints added via ALTER COLUMN SET NOT NULL on writes, for both Hive and Iceberg tables, consistent with the Java engine's TableWriterOperator behavior.
  3. Native test coverage (dual-runner: native worker vs. Java engine) exists for SET NOT NULL / DROP NOT NULL for both the Hive and Iceberg connectors, covering: DDL success, SHOW CREATE TABLE / information_schema.columns reflecting the constraint, INSERT enforcement, and idempotent drop-when-already-nullable.

Additional context

While investigating, found and root-caused two contributing native-side bugs:

  • PrestoToVeloxQueryPlan.cpp: TableWriteNode was constructed with notNullColumnNames and source in the wrong argument order relative to the Velox TableWriteNode constructor signature, silently dropping the not-null column list.
  • presto_cpp/main/common/Exception.cpp: VeloxToPrestoExceptionTranslator::translate unconditionally prefixed the error message with failingExpression() + " ", producing a stray leading space in messages raised via VELOX_USER_FAIL (which carries no failing expression), e.g. " NULL value not allowed for NOT NULL column: c2" instead of "NULL value not allowed for NOT NULL column: c2".