feat(exec): Enforce NOT NULL constraints on table writes - #1810
Open
Yuhta wants to merge 1 commit into
Open
Conversation
Summary: ## Why The native (Prestissimo) worker currently accepts NULLs into NOT NULL columns silently, while the Java engine rejects them in `TableWriterOperator` before any file is written — a data-integrity and Java-parity gap (prestodb/presto#28156). ## What Table writes can now enforce NOT NULL constraints on selected columns. Writing a null into a column marked NOT NULL fails with, for example: `NULL value not allowed for NOT NULL column: c1`. `InsertTableHandle` carries the list of NOT NULL column names (empty means unconstrained), so the constraint travels with the write-request descriptor and round-trips through plan serialization. `TableWriteNode` validates at construction that each name exists in the target schema. `TableWriter` maps each constrained column to its input column and checks it with `DecodedVector::hasNulls()`, which catches nulls behind dictionary or constant encoding as well as flat vectors. The check is opt-in and only scans the listed columns. Part of prestodb/presto#28156. E2E protocol changes: prestodb/presto#28040. X-link: facebookincubator/velox#18135 Reviewed By: shrinidhijoshi Differential Revision: D116681749 Pulled By: Yuhta
|
@Yuhta has exported this pull request. If you are a Meta employee, you can view the originating Diff in D116681749. |
mbasmanova
approved these changes
Sep 1, 2026
Yuhta
force-pushed
the
export-D116681749
branch
from
September 3, 2026 14:37
a9fc3d9 to
bd011ef
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
Why
The native (Prestissimo) worker currently accepts NULLs into NOT NULL columns
silently, while the Java engine rejects them in
TableWriterOperatorbefore anyfile is written — a data-integrity and Java-parity gap
(prestodb/presto#28156).
What
Table writes can now enforce NOT NULL constraints on selected columns. Writing a
null into a column marked NOT NULL fails with, for example:
NULL value not allowed for NOT NULL column: c1.InsertTableHandlecarries the list of NOT NULL column names (empty meansunconstrained), so the constraint travels with the write-request descriptor and
round-trips through plan serialization.
TableWriteNodevalidates atconstruction that each name exists in the target schema.
TableWritermaps eachconstrained column to its input column and checks it with
DecodedVector::hasNulls(), which catches nulls behind dictionary or constantencoding as well as flat vectors. The check is opt-in and only scans the listed
columns.
Part of prestodb/presto#28156. E2E protocol changes:
prestodb/presto#28040.
X-link: facebookincubator/velox#18135
Reviewed By: shrinidhijoshi
Differential Revision: D116681749
Pulled By: Yuhta