Skip to content

fix(warehouse): match deltalake columns case-insensitively - #7563

Merged
shekhar-rudder merged 9 commits into
masterfrom
harness/RUD-3446-fix-warehouse-match-deltalake-c-0e6f4ec5
Nov 4, 2026
Merged

shekhar-rudder merged 9 commits into
masterfrom
harness/RUD-3446-fix-warehouse-match-deltalake-c-0e6f4ec5

Conversation

@rudder-devbox

@rudder-devbox rudder-devbox Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Description

Prevent Deltalake schema evolution from attempting to add columns that already exist under another casing. Normalize fetched keys to lowercase, retain mapped types when raw names collide, and count collisions. All changes stay inside the Deltalake integration; the warehouse-agnostic schema layer and shared utils are unchanged. Cached schemas written before this fix are replaced on the next schema refresh (Warehouse.schemaTTLInMinutes), since fetchSchema now returns canonical keys.

Linear Ticket

RUD-3446

Security

  • The code changed/added as part of this pull request won't create any security issues with how the software is being used.

Validation

  • go test -count=1 ./warehouse/integrations/deltalake — passed.

  • go build ./warehouse/... — passed.

  • make fmt — passed; git diff --check — passed.

  • make lint — Go lint reported 0 issues; actionlint passed, but the target stopped at gitleaks (see Known Issues).

  • Simplify pass: removed redundant mock-row indirection and a test case that could not observe its claimed preference; kept the deterministic column lookup local to the Deltalake package.

  • Credential-dependent Databricks integration tests were not run.

  • Local Deltalake sync verification: skipped. command -v mini && mini help | head exited 0; mini ps exited 0 with no running services. The available rudder-server image cannot run these source edits in the local stack.

⚠️ Known Issues

  • make lint is blocked by gitleaks reporting 34 findings in the pre-existing HEAD commit, including unchanged test fixtures; this change does not address those findings.
  • govulncheck could not fetch https://vuln.go.dev/index/modules.json.gz (HTTP 403), so vulnerability checking could not complete.
  • Local end-to-end verification of the changed rudder-server source remains unavailable because the stack uses a stock image for this service.
  • Parsing parameterized Databricks DECIMAL types remains a separate follow-up; the raw-schema AddColumns guard covers the reported duplicate-column abort.

@rudder-devbox

rudder-devbox Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor Author

👋 I'm rudder-devbox. I opened this PR from task RUD-3446.

Mention @devbox or @rudder-devbox and I'll act on it — on a top-level PR comment,
in a review summary, or on an inline comment on the diff. Without a mention I won't see it.

@rudder-devbox

rudder-devbox Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor Author

The Snowflake integration failed because gosnowflake/[email protected] races while opening parallel connections: the log reports concurrent access at transport.go:188, then race detected during execution of test in TestIntegration/Event_flow/Upload_Job_with_use_rudder_storage. The All job failed as a consequence. This is in the upstream driver, which is already at its latest available version; the PR does not change Snowflake or its dependencies. I could not fix that driver race within this Deltalake change without an upstream patch. No code change was pushed. The Deltalake, warehouse utility, and schema package tests passed locally.

shekhar-rudder and others added 2 commits November 2, 2026 19:24
- Make the column-name helper Deltalake-specific (DeltalakeColumnNames);
  the provider parameter was always DELTALAKE, where ToProviderCase is a no-op.
- Drop the '#'/empty DESCRIBE-metadata filter: such rows never carry a mapped
  data type, so they were already excluded from the schema.
- Emit the duplicate-columns counter once per table instead of per duplicate.
- Store Rudder types directly in mappedColumns; use logfield.TableName.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…ation

warehouse/schema and warehouse/utils are warehouse-agnostic, so drop the
Deltalake cache normalization from schema.go and move the column-name helper
into the deltalake package. Stale mixed-case cache entries are replaced on the
next schema refresh (schema TTL), since fetchSchema now returns canonical keys.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@rudder-devbox

rudder-devbox Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor Author

Three jobs failed during go mod download, before running tests: [email protected], [email protected], and plan9stats each returned stream error ... INTERNAL_ERROR; received from peer from proxy.golang.org. The All job failed because integration and package-unit were red. This is a dependency-proxy/runner failure, not a source failure I can fix in this repository; no code change was pushed.

shekhar-rudder and others added 3 commits November 3, 2026 12:58
…wercase keys

Deltalake rejects column names that differ only by case, so DESCRIBE never
returns case-duplicates. Lowercase the key in fetchSchema and AddColumns, as
BigQuery does, and drop the tie-break helper, duplicate-columns metric,
case-mismatch log and the collision-only tests.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…bleAttributes

Both fetchSchema and AddColumns read columns through fetchTableAttributes, so
normalising there keeps a single point of truth. Requested column names are
already lowercase from the warehouse transformer (safeName default branch).

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…egration test

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@shekhar-rudder
shekhar-rudder marked this pull request as ready for review November 3, 2026 07:44
Copilot AI balanced review requested due to automatic review settings November 3, 2026 07:44

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues are reported for the Deltalake column-name normalization change.

No open issues 🎉

What changed in this PR

This PR normalizes fetched Deltalake column names to lowercase so schema comparisons recognize existing columns regardless of casing and avoid duplicate-column additions. Changes remain within the Deltalake integration.

Changes:

  • Lowercase column names when reading table attributes.
  • Add unit tests for schema normalization and case-insensitive column-addition checks, including unmapped types.
  • Extend integration coverage for an existing uppercase column.
File Description
warehouse/​integrations/​deltalake/​deltalake.go Normalize fetched column names to lowercase.
warehouse/​integrations/​deltalake/​deltalake_test.go Cover case-insensitive schema fetching and column additions.

Review effort: Balanced

@rudder-devbox

rudder-devbox Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor Author

The generated-files check failed because make fmt changed lo.MapKeys(tableSchema, func(_ string, name string) ...) to func(_, name string), leaving a tracked diff in deltalake.go. I integrated the newer branch commits, which remove that callback by normalizing names in fetchTableAttributes, and pushed the resolved merge. make fmt, the Deltalake package test, and its build pass. Go lint reported 0 issues; the full lint target still stops at 34 existing gitleaks findings.

98c9af8

@rudder-devbox

rudder-devbox Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor Author

Knowledge distillation completed

Copilot AI balanced review requested due to automatic review settings November 3, 2026 08:32
@rudder-devbox

rudder-devbox Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor Author

The ClickHouse week-partition subtest failed before assertions: the service logged listen tcp :32775: bind: address already in use, then /health remained unavailable for 1m. The test selected a free HTTP port before starting Docker Compose, allowing Compose to claim it. I moved port selection after Compose startup in all three ClickHouse event-flow setups and pushed the fix. The focused week-partition integration test passed (ok, 151.586s); the package build and formatting passed. Go lint reported 0 issues, while the full lint target remains blocked by 34 existing gitleaks findings.

8a89a4a

@rudder-devbox

rudder-devbox Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor Author

Knowledge distillation completed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔵 Needs a closer look

The PR description promises mapped-type preservation and collision counting, but case-equivalent keys are overwritten and collisions are not recorded.

No open issues 🎉

1 previously missed issue

In code that hasn't changed since last review

Medium severity Clarify mapped-type preservation and collision-handling scope

warehouse/​integrations/​deltalake/​deltalake.go:474

The PR description promises mapped-type preservation and collision counting, but this assignment unconditionally overwrites any earlier case-equivalent key, and neither fetchTableAttributes nor fetchSchema records collisions. Please update the description to reflect the narrower lowercase-normalization fix, or implement and test the promised collision handling if it is still intended.

Review effort: Balanced

@rudder-devbox

rudder-devbox Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor Author

The Snowflake integration failed because the race detector found concurrent reads and writes in gosnowflake/[email protected] at transport.go:188. It marked TestIntegration/Event_flow/Upload_Job_with_Key_Pair_Unencrypted_Key failed (testing.go:1867: race detected during execution of test). This is the same upstream driver race seen in the earlier Snowflake CI run; the PR changes neither Snowflake code nor its dependencies, and v2.3.0 remains the newest released driver version. I could not safely fix this unrelated upstream race in the Deltalake change, so I made no commit or push.

@codecov

codecov Bot commented Nov 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.23%. Comparing base (69b43e0) to head (8a89a4a).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #7563   +/-   ##
=======================================
  Coverage   85.22%   85.23%           
=======================================
  Files         631      631           
  Lines       62990    62979   -11     
=======================================
- Hits        53683    53677    -6     
+ Misses       9304     9299    -5     
  Partials        3        3           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@lvrach lvrach left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Note: this review is part of an experiment, the #proj-auto-approve auto-approval process. No human looked at this PR. Auto-approve category: documented bug fix.

Approved. fetchTableAttributes now lowercases the names that DESCRIBE QUERY TABLE returns. Both callers, fetchSchema and AddColumns, now match the lowercase upload schema, so ADD COLUMNS no longer sends a column that exists in uppercase. The unmapped DECIMAL(38,0) case also passes: the stored schema gets int, and Databricks widens BIGINT into DECIMAL(38,0) on insert and merge. An uppercase EVENT_DATE is now excluded too.

Verification: I ran the new unit tests against the master version of deltalake.go. Three of the four cases fail there, as they should. CI is green on 8a89a4a, including Warehouse Integration (deltalake), which runs the new COL4 case.

Non-blocking asks:

  • should-fix: the PR body does not match the diff. It promises "retain mapped types when raw names collide, and count collisions" and changes "inside the Deltalake integration". The diff has one strings.ToLower (deltalake.go:474) and a ClickHouse test port fix. Update the body. Delta forbids case-equivalent columns, so the collision code is not needed.
  • should-fix (body wording): a schema cached before this change keeps uppercase keys for up to schemaTTLInMinutes. The diff then adds the lowercase key, and UpdatedSchema holds both COL and col. Staging-table creation fails once with a duplicate column. The export-error path (upload.go:407, IsSchemaOutdated) refetches and retries, so the next attempt passes. Say "one failed attempt per affected destination" instead of "replaced on the next schema refresh".
  • nit: the "unmapped types are omitted" case in TestFetchSchemaCaseInsensitiveColumns passes on master as well. Drop it, or assert the RudderMissingDatatype stat.
  • nit: AddColumns (deltalake.go:601) looks up the raw columnInfo.Name. That is safe because the transformer lowercases Deltalake names. strings.ToLower(columnInfo.Name) would remove the dependency.

@shekhar-rudder
shekhar-rudder merged commit a7d30d7 into master Nov 4, 2026
114 of 116 checks passed
@shekhar-rudder
shekhar-rudder deleted the harness/RUD-3446-fix-warehouse-match-deltalake-c-0e6f4ec5 branch November 4, 2026 07:51
atzoum pushed a commit that referenced this pull request Nov 9, 2026
🤖 I have created a release *beep* *boop*
---


##
[1.93.0-rc.1](v1.92.0...v1.93.0-rc.1)
(2026-11-09)


### Features

* **destination:** recognize machine_oauth accounts as oauth
([#7549](#7549))
([f51e4ca](f51e4ca))
* incremental definitions on the v2 namespace config
([#7487](#7487))
([ce51e38](ce51e38))
* **processor:** add flag to abort python transformations on deployments
that do not offer them
([#7571](#7571))
([ca85eb2](ca85eb2))
* **processor:** filter http v2 events by destination message types
([#7538](#7538))
([58fd176](58fd176))
* **processor:** send the workspace id to per-workspace pyt pods
([#7551](#7551))
([ea33835](ea33835))
* **warehouse:** add maxcompute destination
([#7568](#7568))
([a64bfd9](a64bfd9))


### Bug Fixes

* **batchrouter:** abort bq stream all events jobs on terminal auth
failures
([#7548](#7548))
([6b7e023](6b7e023))
* bump andybalholm/brotli to v1.2.7 [SEC-759]
([#7525](#7525))
([6dfe468](6dfe468))
* bump rudder-go-kit to v0.84.3
([#7547](#7547))
([355054a](355054a))
* **core:** schema forwarder panics on shutdown
([#7519](#7519))
([dd61cfc](dd61cfc))
* database connections hang when context is cancelled during a copy
([#7578](#7578))
([8dae6e3](8dae6e3))
* **jobsdb:** compaction missing pairs after one that doesn't fit
([#7574](#7574))
([573271b](573271b))
* **jobsdb:** multiconsumer recovery misses a consumer's executing
status after another consumer's later status
([#7554](#7554))
([69b43e0](69b43e0))
* **jobsdb:** old jobs not expiring for every consumer
([#7573](#7573))
([366f114](366f114))
* **jobsdb:** pickups stalling on status tables with skewed stats
([#7572](#7572))
([318446f](318446f))
* **jobsdb:** unionjobsdb functions pick the first datasets by table
name ([#7558](#7558))
([e94d6c5](e94d6c5))
* **router:** event order test only counts drained jobs of the last
dataset
([#7552](#7552))
([b0a097a](b0a097a))
* **router:** mask secrets in array-shaped reporting samples
([#7536](#7536))
([902160f](902160f))
* **warehouse:** hot-reload degraded workspaces without aborting
restored uploads
([#7564](#7564))
([cb98598](cb98598))
* **warehouse:** match deltalake columns case-insensitively
([#7563](#7563))
([a7d30d7](a7d30d7))
* **warehouse:** migrate snowflake to gosnowflake v2.3.0
([#7542](#7542))
([cc09426](cc09426))
* **warehouse:** skip job-creation error log on router shutdown
([#7567](#7567))
([895367e](895367e))


### Miscellaneous

* **deps:** bump github.com/go-jose/go-jose/v4 from 4.1.4 to 4.1.6
([#7545](#7545))
([35ee952](35ee952))
* export only the +Inf bucket for limiter timers
([#7570](#7570))
([4429472](4429472))
* **router:** add drainReason label to pipeline_processed_events
([#7561](#7561))
([af0aef8](af0aef8))
* sync release v1.92.0 to main branch
([#7534](#7534))
([9ab165d](9ab165d))
* **warehouse:** bump sqlconnect-go to v1.37.1
([#7575](#7575))
([acdad67](acdad67))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: rudderstack-github-actions[bot] <236995729+rudderstack-github-actions[bot]@users.noreply.github.com>
atzoum pushed a commit that referenced this pull request Nov 10, 2026
🤖 I have created a release *beep* *boop*
---


##
[1.93.0](v1.92.0...v1.93.0)
(2026-11-09)


### Features

* **destination:** recognize machine_oauth accounts as oauth
([#7549](#7549))
([f51e4ca](f51e4ca))
* incremental definitions on the v2 namespace config
([#7487](#7487))
([ce51e38](ce51e38))
* **processor:** add flag to abort python transformations on deployments
that do not offer them
([#7571](#7571))
([ca85eb2](ca85eb2))
* **processor:** filter http v2 events by destination message types
([#7538](#7538))
([58fd176](58fd176))
* **processor:** send the workspace id to per-workspace pyt pods
([#7551](#7551))
([ea33835](ea33835))
* **warehouse:** add maxcompute destination
([#7568](#7568))
([a64bfd9](a64bfd9))


### Bug Fixes

* **batchrouter:** abort bq stream all events jobs on terminal auth
failures
([#7548](#7548))
([6b7e023](6b7e023))
* bump andybalholm/brotli to v1.2.7 [SEC-759]
([#7525](#7525))
([6dfe468](6dfe468))
* bump rudder-go-kit to v0.84.3
([#7547](#7547))
([355054a](355054a))
* **core:** schema forwarder panics on shutdown
([#7519](#7519))
([dd61cfc](dd61cfc))
* database connections hang when context is cancelled during a copy
([#7578](#7578))
([8dae6e3](8dae6e3))
* **jobsdb:** compaction missing pairs after one that doesn't fit
([#7574](#7574))
([573271b](573271b))
* **jobsdb:** multiconsumer recovery misses a consumer's executing
status after another consumer's later status
([#7554](#7554))
([69b43e0](69b43e0))
* **jobsdb:** old jobs not expiring for every consumer
([#7573](#7573))
([366f114](366f114))
* **jobsdb:** pickups stalling on status tables with skewed stats
([#7572](#7572))
([318446f](318446f))
* **jobsdb:** unionjobsdb functions pick the first datasets by table
name ([#7558](#7558))
([e94d6c5](e94d6c5))
* **router:** event order test only counts drained jobs of the last
dataset
([#7552](#7552))
([b0a097a](b0a097a))
* **router:** mask secrets in array-shaped reporting samples
([#7536](#7536))
([902160f](902160f))
* **warehouse:** hot-reload degraded workspaces without aborting
restored uploads
([#7564](#7564))
([cb98598](cb98598))
* **warehouse:** match deltalake columns case-insensitively
([#7563](#7563))
([a7d30d7](a7d30d7))
* **warehouse:** migrate snowflake to gosnowflake v2.3.0
([#7542](#7542))
([cc09426](cc09426))
* **warehouse:** skip job-creation error log on router shutdown
([#7567](#7567))
([895367e](895367e))


### Miscellaneous

* **deps:** bump github.com/go-jose/go-jose/v4 from 4.1.4 to 4.1.6
([#7545](#7545))
([35ee952](35ee952))
* export only the +Inf bucket for limiter timers
([#7570](#7570))
([4429472](4429472))
* **router:** add drainReason label to pipeline_processed_events
([#7561](#7561))
([af0aef8](af0aef8))
* sync release v1.92.0 to main branch
([#7534](#7534))
([9ab165d](9ab165d))
* **warehouse:** bump sqlconnect-go to v1.37.1
([#7575](#7575))
([acdad67](acdad67))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: rudderstack-github-actions[bot] <236995729+rudderstack-github-actions[bot]@users.noreply.github.com>
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.

5 participants