Skip to content

Fix DuplicateColumn bug in save_parameters_numpy()#12707

Merged
jonathan-eq merged 1 commit intoequinor:mainfrom
jonathan-eq:fix-bugss
Jan 23, 2026
Merged

Fix DuplicateColumn bug in save_parameters_numpy()#12707
jonathan-eq merged 1 commit intoequinor:mainfrom
jonathan-eq:fix-bugss

Conversation

@jonathan-eq
Copy link
Contributor

@jonathan-eq jonathan-eq commented Jan 22, 2026

Issue
Resolves #12706

Approach
Short description of the approach

(Screenshot of new behavior in GUI if applicable)

  • PR title captures the intent of the changes, and is fitting for release notes.
  • Added appropriate release note label
  • Commit history is consistent and clean, in line with the contribution guidelines.
  • Make sure unit tests pass locally after every commit (git rebase -i main --exec 'just rapid-tests')

When applicable

  • When there are user facing changes: Updated documentation
  • New behavior or changes to existing untested code: Ensured that unit tests are added (See Ground Rules).
  • Large PR: Prepare changes in small commits for more convenient review
  • Bug fix: Add regression test for the bug
  • Bug fix: Add backport label to latest release (format: 'backport release-branch-name')

@codecov-commenter
Copy link

codecov-commenter commented Jan 22, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.63%. Comparing base (c528c39) to head (37f3120).
⚠️ Report is 21 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #12707      +/-   ##
==========================================
- Coverage   90.67%   90.63%   -0.05%     
==========================================
  Files         429      431       +2     
  Lines       29803    30113     +310     
==========================================
+ Hits        27025    27292     +267     
- Misses       2778     2821      +43     
Flag Coverage Δ
cli-tests 37.30% <100.00%> (-0.27%) ⬇️
gui-tests 68.67% <100.00%> (-0.74%) ⬇️
performance-and-unit-tests 74.06% <100.00%> (+0.13%) ⬆️
test 37.50% <0.00%> (-0.58%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@codspeed-hq
Copy link

codspeed-hq bot commented Jan 22, 2026

Merging this PR will not alter performance

✅ 23 untouched benchmarks


Comparing jonathan-eq:fix-bugss (37f3120) with main (fbdfd8b)

Open in CodSpeed

Copy link
Contributor

@xjules xjules left a comment

Choose a reason for hiding this comment

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

Nice @jonathan-eq ! Could you maybe update the commit message bit to explain where was this issue?

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a bug in save_parameters_numpy() where calling the method multiple times with the same parameter name would raise a DuplicateColumn error instead of properly overwriting existing values.

Changes:

  • Added logic to drop existing columns (except "realization") before joining new parameter data
  • Added a regression test verifying that multiple saves to the same parameter successfully overwrite previous values

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/ert/storage/local_ensemble.py Drops duplicate columns before joining to prevent DuplicateColumn errors
tests/ert/unit_tests/storage/test_local_storage.py Adds regression test for multiple parameter saves

This fixes the issue in the performance tests, where we try saving the
same parameter key to store multiple times; expecting it to overwrite
the value.
@jonathan-eq jonathan-eq enabled auto-merge (rebase) January 23, 2026 06:58
@jonathan-eq jonathan-eq merged commit 03914d2 into equinor:main Jan 23, 2026
34 checks passed
@scout-team-app
Copy link

Successfully created backport PR for version-18.0:

@scout-team-app
Copy link

Successfully created backport PR for version-19.0:

@jonathan-eq jonathan-eq deleted the fix-bugss branch January 23, 2026 07:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Performance test fails: tests/ert/performance_tests/test_obs_and_responses_performance.py::test_speed_performance_of_doing_es_update

5 participants