Skip to content

fix(vertica): make edr_current_timestamp_in_utc return UTC - #1084

Open
joostboon wants to merge 1 commit into
masterfrom
fix/vertica-utc-timezone
Open

joostboon wants to merge 1 commit into
masterfrom
fix/vertica-utc-timezone

Conversation

@joostboon

@joostboon joostboon commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Problem

The Vertica CI job fails 12 tests whenever it runs between roughly 00:00 and 07:00 UTC, all with 'pass' == 'fail':

  • test_data_freshness_sla.py: test_no_data_fails, test_stale_data_fails, test_with_where_expression
  • test_metric_stability.py: detects_restated_settled_value, detects_restatement_in_any_column, first_check_catches_gradual_drift, quoted_column_details[first_check|last_check], reports_disappearing_bucket[dimensions0|1], reports_disappearing_dimension, tolerates_change_within_threshold

Root cause

There was no vertica__edr_current_timestamp_in_utc, so the default implementation used dbt's default__current_timestamp_in_utc_backcompat, which is simply current_timestamp::timestamp in the session's local time zone. The CI container runs with TZ=America/Los_Angeles, so the "UTC" timestamp lagged real UTC by 7 hours. During early UTC hours that meant:

  • freshness SLA: current_timestamp_in_utc > sla_deadline_utc was still false, so stale or missing data was not flagged;
  • metric stability: metrics were stamped with an updated_at earlier than the bucket's settle time, so they were never used as a baseline and restatements went undetected.

Fix

Add vertica__edr_current_timestamp_in_utc returning cast(current_timestamp at time zone 'UTC' as timestamp). This also fixes the same skew for real Vertica deployments whose server is not set to UTC.

The container TZ is left as is and now has a comment explaining it is intentionally non-UTC, since that is what surfaced this bug.

Verification

Ran locally against ghcr.io/ratiopbc/vertica-ce with the container clock skewed:

Container TZ Tests Before After
Etc/GMT+12 (UTC-12, local date one day behind) freshness SLA + metric stability 12 failed, 13 passed (the exact CI failures) 25 passed
Etc/GMT+12 full suite 271 passed, 30 skipped
Etc/GMT-14 (UTC+14) freshness SLA + metric stability 25 passed

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Vertica now returns current timestamps in UTC, keeping timestamp-based behavior consistent when the database session uses a non-UTC timezone.

Vertica had no override, so it fell back to dbt's
default__current_timestamp_in_utc_backcompat, which is just the
session-local current_timestamp. With the CI container on
America/Los_Angeles, the "UTC" timestamp lagged real UTC by 7 hours,
so between 00:00 and 07:00 UTC freshness SLA deadlines looked unpassed
and metric stability baselines looked unsettled, and tests that should
fail passed.

Use current_timestamp at time zone 'UTC' instead, and note in the
compose file that the non-UTC TZ is intentional.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

👋 @joostboon
Thank you for raising your pull request.
Please make sure to add tests and document all user-facing changes.
You can do this by editing the docs files in the elementary repository.

@coderabbitai

coderabbitai Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c39f758c-5b66-472f-8503-436a349f0831

📥 Commits

Reviewing files that changed from the base of the PR and between 837e006 and 7290b0c.


📒 Files selected for processing (2)
  • integration_tests/docker-compose-vertica.yml
  • macros/utils/cross_db_utils/current_timestamp.sql

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 2 remain after this review.



📝 Walkthrough

Walkthrough

Adds a Vertica-specific macro that converts the current timestamp at time zone UTC to a timestamp. Documents that the Vertica integration container uses a non-UTC timezone to test macros that must use UTC.

Changes

Vertica UTC timestamps

Layer / File(s) Summary
Vertica UTC timestamp implementation
macros/utils/cross_db_utils/current_timestamp.sql, integration_tests/docker-compose-vertica.yml
Adds the Vertica-specific UTC timestamp macro. Documents the container’s non-UTC timezone; the TZ value remains America/Los_Angeles.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~5 minutes

Change: Bug fix


Merge Risk: ⚪ Minimal · up to 7290b

The Vertica timestamp implementation returns UTC values compatible with its consumers. No actionable merge-blocking risk remains in the reviewed changes.

Architecture Summary

Architecture risk: 🔵 Low · up to 7290b

The change affects 2 systems.

Changed systems: integration_tests, macros

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — integration_tests (service) was modified; 1 changed file maps to changed impact.
  • observed — macros (service) was modified; 1 changed file maps to changed impact.

Before / after behavior

  • observed — Modified behavior in integration_tests/docker-compose-vertica.yml: Added comments documenting the non-UTC timezone’s role in testing macros that must use UTC; the TZ value is unchanged.
  • observed — Modified behavior in macros/utils/cross_db_utils/current_timestamp.sql: Added the Vertica-specific UTC timestamp implementation; it converts current_timestamp at time zone UTC to timestamp.

Pre-merge checks | Passed 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly identifies the Vertica-specific fix and states that edr_current_timestamp_in_utc now returns UTC. It is concise and directly matches the main change.
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

This branch has not been deployed

No deployments
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.

1 participant