Skip to content

Support WITH options in FIRE TRIGGER#225

Merged
srnand merged 3 commits into
mainfrom
sthakkar/may15_26/fire-trigger-with-options
May 18, 2026
Merged

Support WITH options in FIRE TRIGGER#225
srnand merged 3 commits into
mainfrom
sthakkar/may15_26/fire-trigger-with-options

Conversation

@srnand
Copy link
Copy Markdown
Collaborator

@srnand srnand commented May 18, 2026

Summary

Extend FIRE TRIGGER with an optional WITH (k v, ...) options clause whose pairs are merged into the trigger's spec.jobProperties before the fire timestamp is bumped. The deployer rejects FIRE on an in-flight execution (status.timestamp > status.watermark) so callers see explicit failure rather than racing two triggered Jobs.

Option keys with the job.properties. prefix have it stripped on the way into spec.jobProperties, mirroring CREATE TRIGGER. Unprefixed keys are stored verbatim. The new Trigger.FIRE_OPTION marker carries the fire intent through DeploymentService to K8sTriggerDeployer.

Why: enables FIRE TRIGGER to inject per-fire parameters (e.g. backfill window bounds) into the trigger-job pod without baking domain-specific options into the SQL grammar.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 18, 2026

Code Coverage

Overall Project 84.24% -0.29% 🟢
Files changed 54.4%

File Coverage
Trigger.java 100% 🟢
K8sTriggerDeployer.java 93.98% 🟢
HoptimatorDdlExecutor.java 85.43% -7.22%

Copy link
Copy Markdown
Collaborator

@ryannedolan ryannedolan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

neat!

String name = fire.name.names.get(0);

Map<String, String> options = HoptimatorDdlUtils.options(fire.options);
options.put(Trigger.FIRE_OPTION, "true");
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the difference between create trigger and fire trigger is essentially this fire: true? Wonder what happens if you create trigger ... with (fire 'true')?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As of now, WITH (fire 'true') on create trigger doesnt set Trigger.FIRE_OPTION. We could wire it up easily but i think it will get little more complex,

  1. If create trigger succeeds but the fire step fails, do we roll back the CR?
  2. CREATE OR REPLACE ... WITH (fire 'true') needs to decide if we fire only on replace, only on create, or both?

So, i feel we should keep the firing a trigger as a separate grammar for itself.

shrinandthakkar and others added 2 commits May 18, 2026 11:06
Extend FIRE TRIGGER with an optional WITH (k v, ...) options clause whose
pairs are merged into the trigger's spec.jobProperties before the fire
timestamp is bumped. The deployer rejects FIRE on an in-flight execution
(status.timestamp > status.watermark) so callers see explicit failure
rather than racing two materialised Jobs.

Option keys with the job.properties. prefix have it stripped on the way
into spec.jobProperties, mirroring CREATE TRIGGER. Unprefixed keys are
stored verbatim. The new Trigger.FIRE_OPTION marker carries the fire
intent through DeploymentService to K8sTriggerDeployer.

Why: enables FIRE TRIGGER to inject per-fire parameters (e.g. backfill
window bounds) into the trigger-job pod without baking domain-specific
options into the SQL grammar.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@srnand srnand force-pushed the sthakkar/may15_26/fire-trigger-with-options branch from 3cef5a1 to 7c7f21c Compare May 18, 2026 18:31
@srnand srnand merged commit 4b11715 into main May 18, 2026
1 check passed
@srnand srnand deleted the sthakkar/may15_26/fire-trigger-with-options branch May 18, 2026 19:33
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.

3 participants