Skip SQL job generation when a pipeline source or sink has no connector - #247
Merged
Conversation
A JobTemplate with no `databases` filter matches every sink, so a table
with no connector configuration (empty `WITH ()`) would still get a Flink
SqlJob rendered against it -- e.g. `CREATE TABLE ... WITH ()` plus an
`INSERT INTO` that Flink cannot execute. Such tables are moved by a
non-SQL JobTemplate rather than a SqlJob. This happens in both directions:
a connector-less sink (materialized by a downstream non-SQL job) and a
connector-less source (the reverse case).
Add MissingConnectorException (SQLNonTransientException) to signal that a
table has no connector and cannot participate in a generated SQL job.
PipelineRel throws it while resolving connector configs when the sink
(sql()) or any source (script()) has an empty config map. Callers that
generate SQL treat it as 'skip the SQL job', not an error:
- K8sJobDeployer: a sqlOrNull helper catches it so {{sql}}/{{flinksql}}
resolve to null, dropping SQL-based JobTemplates during rendering while
non-SQL templates still render.
- LogicalTableDeployer and K8sMaterializedViewDeployer: catch it and treat
the pipeline as having no SQL.
- K8sPipelineDeployer stores "" instead of null for the Pipeline CR sql.
Fixture: add ads-catalog-database to demodb-write-template's databases. The
offline demo tier (ADS_CATALOG) previously had only a read/trigger template,
so its sink had no write connector; the nearline->offline logical-table
graph now correctly renders a FlinkSessionJob for that tier.
Tests (per testing-best-practices.md): PipelineRelImplementorTest asserts
sql() throws when the sink or a source has no connector; K8sJobDeployerTest
asserts a connector-less sink skips the SQL template while a non-SQL template
still renders.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Code Coverage
|
ryannedolan
approved these changes
Aug 8, 2026
ryannedolan
left a comment
Collaborator
There was a problem hiding this comment.
Wow great idea. Nice writeup as well.
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.
What
Teach the pipeline planner to skip Flink SQL job generation when a table involved in the pipeline has no connector configuration (i.e. an empty
WITH ()clause). Such tables are moved by a non-SQLJobTemplate(e.g. a triggered/ETL-style job) rather than a FlinkSqlJob, so emitting aSqlJobfor them produces SQL that is unrunnable and fails at Flink runtime.Why
A
JobTemplatewith nodatabasesfilter matches every sink, so a connector-less table would still get a FlinkSqlJobrendered against it — e.g.CREATE TABLE … WITH ()followed by anINSERT INTOthat Flink cannot execute. This affects both directions:SqlJobwrites into an empty-connector sink.SqlJobreads from an empty-connector source.Both should render only their non-SQL
JobTemplate, never a brokenSqlJob.How
MissingConnectorException(hoptimator-api), aSQLNonTransientExceptionsignaling that a table has no connector and therefore cannot participate in a generated SQL job.PipelineRelthrows it while resolving connector configs when the sink (sql()) or any source (script()) has an empty config map.K8sJobDeployer— asqlOrNullhelper catches it so{{sql}}/{{flinksql}}resolve tonull, which drops SQL-basedJobTemplates during rendering while non-SQL templates still render.LogicalTableDeployerandK8sMaterializedViewDeployer— catch it and treat the pipeline as having no SQL (null → nullable Pipeline CR field).K8sPipelineDeployerstores""instead ofnullfor the Pipeline CRsqlfield.Tests
PipelineRelImplementorTest— new cases assertingsql()throwsMissingConnectorExceptionwhen the sink or a source has no connector; existing SQL-generation tests stub a non-empty connector.K8sJobDeployerTest— new cases asserting a connector-less sink skips the SQL template while a non-SQL template still renders, and that a sink with a connector still renders the SQL template.Fixtures
deploy/samples/demodb.yaml: addads-catalog-databasetodemodb-write-template'sdatabases. The offline demo tier (ADS_CATALOG) previously had only a read/trigger template, so its sink had no write connector — the missing write connector is the fixture bug this surfaced. Thenearline→offlinelogical-table integration graph now correctly renders aFlinkSessionJobfor that tier.Compatibility
No public API changes.
sql()'s contract now allows throwingMissingConnectorException; all in-tree callers handle it.