[Code Simplification] Removal of Snowflake from codebase#133
Merged
Conversation
Member
Author
|
Migration order check failed because I modified all migrations to remove the snowflake references as not relevant. so the failure is expected and ok. |
Contributor
|
Checklist:
|
vinaysrao1
approved these changes
Mar 21, 2026
Contributor
vinaysrao1
left a comment
There was a problem hiding this comment.
Awesome work. Can't find anything.
This was referenced Apr 2, 2026
3 tasks
julietshen
added a commit
that referenced
this pull request
May 29, 2026
The rule anomaly detection query was carried over verbatim from the pre-#133 Snowflake era. Against ClickHouse it fails in five distinct ways, all of which compound to silently make every rule's computed alarm state INSUFFICIENT_DATA so the detection job is a no-op in practice. Surfaced while building the #342 integ test (which couldn't see any alarm transitions until each of these was fixed in turn): 1. `array_size(passes_distinct_user_ids)` — Snowflake `ARRAY_SIZE` has no ClickHouse equivalent under that name. The column is also a JSON `String`, not a native `Array`, so `length()` wouldn't help either. Switch to `JSONLength(...)`, which parses the JSON array and counts. 2. `SYSDATE()` — not a ClickHouse function. Replace with `now64(3)`, which returns `DateTime64(3)` in UTC (matching the column type and matching the original Snowflake-comment claim that we wanted UTC). 3. `ts_start_inclusive >= ?` with a `Date` bind — the warehouse adapter formats Dates as ISO 8601 with `Z`, which ClickHouse rejects when implicitly converting to `DateTime64(3)`. Wrap the bind with `parseDateTime64BestEffort(?)` so the format is accepted explicitly. 4. `row.RULE_ID`, `row.NUM_PASSES`, etc — Snowflake defaults to uppercase identifiers, ClickHouse returns column names as written. Every column access was reading back `undefined`, so the rule-id-keyed grouping in `getCurrentPeriodRuleAlarmStatuses` collapsed to a single `{ undefined: { status: INSUFFICIENT_DATA } }` bucket. 5. `passCount`/`passingUsersCount`/`runsCount` cast as `number` — but ClickHouse `Int64`/`UInt64` columns deserialise to JS `BigInt`. The downstream `binomialTest` validator throws on `1n` even though it accepts `1`. Coerce with `Number(...)` at the read site. Snapshots in the existing unit tests updated to match the new SQL. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
julietshen
added a commit
that referenced
this pull request
May 29, 2026
The rule anomaly detection query was carried over verbatim from the pre-#133 Snowflake era. Against ClickHouse it fails in five distinct ways, all of which compound to silently make every rule's computed alarm state INSUFFICIENT_DATA so the detection job is a no-op in practice. Surfaced while building the #342 integ test (which couldn't see any alarm transitions until each of these was fixed in turn): 1. `array_size(passes_distinct_user_ids)` — Snowflake `ARRAY_SIZE` has no ClickHouse equivalent under that name. The column is also a JSON `String`, not a native `Array`, so `length()` wouldn't help either. Switch to `JSONLength(...)`, which parses the JSON array and counts. 2. `SYSDATE()` — not a ClickHouse function. Replace with `now64(3)`, which returns `DateTime64(3)` in UTC (matching the column type and matching the original Snowflake-comment claim that we wanted UTC). 3. `ts_start_inclusive >= ?` with a `Date` bind — the warehouse adapter formats Dates as ISO 8601 with `Z`, which ClickHouse rejects when implicitly converting to `DateTime64(3)`. Wrap the bind with `parseDateTime64BestEffort(?)` so the format is accepted explicitly. 4. `row.RULE_ID`, `row.NUM_PASSES`, etc — Snowflake defaults to uppercase identifiers, ClickHouse returns column names as written. Every column access was reading back `undefined`, so the rule-id-keyed grouping in `getCurrentPeriodRuleAlarmStatuses` collapsed to a single `{ undefined: { status: INSUFFICIENT_DATA } }` bucket. 5. `passCount`/`passingUsersCount`/`runsCount` cast as `number` — but ClickHouse `Int64`/`UInt64` columns deserialise to JS `BigInt`. The downstream `binomialTest` validator throws on `1n` even though it accepts `1`. Coerce with `Number(...)` at the read site. Snapshots in the existing unit tests updated to match the new SQL. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Context & Requests for Reviewers
This PR removes all references to snowflake from our codebase. It cleans up the snowflake code, the packages as well as its references. It moves any snowflake related types to common data warehouse types instead.
Tests
(Optional) Rollout Plan