Skip to content

fix treatIntegersAsDouble - #75

Open
danovaro wants to merge 1 commit into
developfrom
fix/treatIntegersAsDoubles
Open

danovaro wants to merge 1 commit into
developfrom
fix/treatIntegersAsDoubles

Conversation

@danovaro

@danovaro danovaro commented Dec 3, 2026 •

Copy link
Copy Markdown
Member

Description

fix treatIntegersAsDouble:
value 1 is interpreted as denormal 4.9e-324 and, which is flushed to zero

Contributor Declaration

By opening this pull request, I affirm the following:

  • All authors agree to the Contributor License Agreement.
  • The code follows the project's coding standards.
  • I have performed self-review and added comments where needed.
  • I have added or updated tests to verify that my changes are effective and functional.
  • I have run all existing tests and confirmed they pass.

📖 Documentation 📖
https://sites.ecmwf.int/docs/dev-section/odc/pull-requests/PR-75

@danovaro danovaro added downstream-ci-not-needed Deliberately skip the downstream fan-out run-hpc-ci Run the HPC legs of CI labels Dec 3, 2026
@danovaro
danovaro requested a balanced review from Copilot December 3, 2026 23:17

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 were identified for the SQL filtering fix.

No open issues 🎉

What changed in this PR

Fixes SQL filtering when treatIntegersAsDoubles is disabled, preventing integer bit patterns from being misinterpreted as doubles.

Changes:

  • Temporarily enables integer-as-double handling during SQL evaluation and restores the caller’s setting afterward.
  • Documents filtering behavior and adds regression tests for both setting modes.
File Description
tests/​api/​read.cc Tests SQL filtering results and setting preservation in both modes.
src/​odc/​api/​Odb.h Documents how filtering interacts with integer representation settings.
src/​odc/​api/​Odb.cc Adds a scoped setting override for SQL evaluation.

Review effort: Balanced

Comment thread tests/api/read.cc
eckit::PathName path = "sql-filter-test-1";

{
odc::api::Settings::treatIntegersAsDoubles(false);

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.

here you set a global setting?

Comment thread tests/api/read.cc
EXPECT(s.getIntegerValues("values") == query.expected);
}

EXPECT(!reader.next());

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.

but it's never resetted?

Comment thread src/odc/api/Odb.cc
// The data crossing this function (in and out) is encoded ODB-2, where the in-memory representation does not
// matter, so we always run the query with integers-as-doubles. The (32-bit) integers are exactly representable
// as doubles, so nothing is lost. Frames read from the output are decoded according to the caller's setting.
const IntegersAsDoublesGuard guard(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.

Would this also apply to other places?

Seems like a general problem of the SQL interface?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

downstream-ci-not-needed Deliberately skip the downstream fan-out run-hpc-ci Run the HPC legs of CI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants