validation: allow multiple constraints per projection#2977
Open
mdibaiee wants to merge 2 commits into
Open
Conversation
451d1d0 to
8ceb86b
Compare
8ceb86b to
1407552
Compare
1407552 to
a961fa0
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.
Description:
Materialization connectors report field constraints through a map<string, Constraint> in Validated.Binding. Because it's a map, only one constraint per projection field is possible.
This caused a bug we saw with a customer recently: when a new binding is attached to an existing table whose
flow_documentcolumn has an incompatible type, the connector emitsflow_document: INCOMPATIBLE. The control plane drops bareINCOMPATIBLEon new bindings (no live spec) because there's no way to know whether the field is required — soFieldSelection.Documentis set to "" and the materialization silently degrades todelta updates writes since there is no
flow_document, creating duplicate rows on every update.The connector can't fix this unilaterally: emitting
LOCATION_REQUIREDinstead ofINCOMPATIBLEhides the incompatibility signal: they can publish but they will get an error during connector runtime that complains about an incompatibleflow_documentcolumn.This PR allows connectors to provide multiple constraints per field. This allows a connector to emit both
LOCATION_REQUIREDandINCOMPATIBLE, which results in control plane throwing a clean error about why the field cannot be materialized as-is.Existing tasks are not affected, there is full backwards compatibility. Once we merge and land this, I will work on migrating all materializations to use the new protocol field, and later we can remove the old deprecated field.
Workflow steps:
(How does one use this feature, and how has it changed)
Documentation links affected:
(list any documentation links that you created, or existing ones that you've identified as needing updates, along with a brief description)
Notes for reviewers:
(anything that might help someone review this PR)