Skip to content

feat(state time series): add retrieve_arrays support for raw state datapoints - #2812

Open
haakonvt wants to merge 10 commits into
add-state-ts-retrieve-support-pandasfrom
add-state-ts-retrieve-arrays-support
Open

feat(state time series): add retrieve_arrays support for raw state datapoints#2812
haakonvt wants to merge 10 commits into
add-state-ts-retrieve-support-pandasfrom
add-state-ts-retrieve-arrays-support

Conversation

@haakonvt

@haakonvt haakonvt commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Extends DatapointsArray with numeric_states and string_states and adds support for retrieving (possibly nullable) raw state datapoints using retrieve_arrays (using numpy).

As Gemini is pointing out, some slicing mechanics is missing. This is planned as a separate PR.

@haakonvt
haakonvt requested review from a team as code owners September 2, 2026 21:09

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request implements support for retrieving raw state datapoints using retrieve_arrays(...) by handling state datapoints in the underlying numpy unpacking and result generation tasks, and adding numeric_states and string_states attributes to DatapointsArray. The review feedback highlights a critical bug where indexing, slicing, or dumping the retrieved state datapoints will fail or result in data loss due to plural vs singular attribute mismatches (e.g., numeric_states vs numeric_state) and their omission from DatapointsArray._data_fields.

Comment thread cognite/client/data_classes/datapoints.py
@codecov

codecov Bot commented Sep 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.13%. Comparing base (4c2afcf) to head (08de949).

Additional details and impacted files
@@                           Coverage Diff                            @@
##           add-state-ts-retrieve-support-pandas    #2812      +/-   ##
========================================================================
- Coverage                                 93.15%   93.13%   -0.03%     
========================================================================
  Files                                       516      516              
  Lines                                     53788    53832      +44     
========================================================================
+ Hits                                      50106    50135      +29     
- Misses                                     3682     3697      +15     
Files with missing lines Coverage Δ
cognite/client/_api/datapoint_tasks.py 95.69% <100.00%> (+0.08%) ⬆️
cognite/client/data_classes/datapoints.py 90.58% <100.00%> (-0.10%) ⬇️
...ests/tests_integration/test_api/test_datapoints.py 99.36% <100.00%> (+0.01%) ⬆️

... and 6 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@haakonvt
haakonvt force-pushed the add-state-ts-retrieve-arrays-support branch from 0bc4fb8 to 9b440ea Compare September 4, 2026 10:52
@haakonvt
haakonvt force-pushed the add-state-ts-retrieve-arrays-support branch from 9b440ea to 08de949 Compare September 7, 2026 20:05
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