Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop NULL columns from INSERT INTO #68

Merged
merged 1 commit into from
Jul 15, 2024
Merged

Drop NULL columns from INSERT INTO #68

merged 1 commit into from
Jul 15, 2024

Conversation

ryannedolan
Copy link
Collaborator

@ryannedolan ryannedolan commented Jul 14, 2024

Summary

Drop NULL columns (e.g. NULL AS KEY) from INSERT INTO pipelines.

Promote NULL fields to BYTES in DDL (e.g. KEY BYTES).

Details

Flink does not allow NULLs in queries (SQL) or in table definitions (DDL). This is problematic, because we would like to be able to write NULL AS KEY in subscriptions.

In Hoptimator, sink tables are derived from subscription SQL. If we write NULL AS KEY in a subscription, the sink table would have a NULL-typed column, and the Flink job would fail. Instead, NULL AS KEY should result in the column being omitted form the pipeline entirely (defaulting to NULL).

At the same time, Flink DDL cannot have NULL-typed fields, so we promote these to BYTES.

The result is that SELECT ... NULL AS KEY ... results in a sink table with KEY BYTES and pipelines that omit the KEY field (defaulting to NULL).

Testing

New unit tests. Tested locally and by manually tweaking production pipelines.

Changed integration tests to use NULL AS KEY.

@ryannedolan ryannedolan changed the title Replace NULL fields with computed values Drop NULL columns from INSERT INTO Jul 14, 2024
@ryannedolan ryannedolan force-pushed the computed-nulls branch 3 times, most recently from 31a8cd7 to f24f866 Compare July 14, 2024 16:34
@ryannedolan ryannedolan marked this pull request as ready for review July 14, 2024 16:47
@ryannedolan ryannedolan merged commit 701ce75 into main Jul 15, 2024
1 check passed
@ryannedolan ryannedolan deleted the computed-nulls branch July 15, 2024 19:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants