Merged
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #767 +/- ##
===========================================
- Coverage 62.73% 62.59% -0.15%
===========================================
Files 705 705
Lines 42165 42516 +351
Branches 6223 6285 +62
===========================================
+ Hits 26453 26613 +160
- Misses 14781 14936 +155
- Partials 931 967 +36 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
jt2594838
approved these changes
Apr 7, 2026
| char* str_max; | ||
| char* str_first; | ||
| char* str_last; | ||
| } TimeseriesStatistic; |
Contributor
There was a problem hiding this comment.
typedef struct BaseStatistics {
TSDataType type;
int32_t row_count;
int64_t start_time;
int64_t end_time;
} BaseStatistic
typedef struct FloatStatistics {
BaseStatistic _base;
double min_float64;
double max_float64;
double first_float64;
double last_float64;
} FloatStatistic
May consider patterns like this?
Otherwise, the memory footprint of Statistics will be much higher.
python/tsfile/tsfile_py_cpp.pyx
Outdated
Comment on lines
+979
to
+980
| if segs[i] == NULL: | ||
| out.append("") |
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.
Summary
Adds C-wrapper support for listing devices and reading per-device timeseries metadata, with Python
TsFileReaderbindings. Device identity is a singleDeviceID(path, table name, segments). Chunk statistics are exposed as a tagged layout: common headerTsFileStatisticBase(has_statistic,TSDataType type,row_count,start_time,end_time) plus aTimeseriesStatisticUnionarm selected bybase.type. Numeric arms exposesum(boolean sum of true values asdouble, integer sum asdouble, float/double sum asdouble), ranges, and first/last where applicable; STRING exposes lexicographic min/max and time-ordered first/last strings; TEXT exposes first/last strings only (no min/max).C API
Types:
TsFileStatisticBase,TsFileBoolStatistic,TsFileIntStatistic,TsFileFloatStatistic,TsFileStringStatistic,TsFileTextStatistic,TimeseriesStatisticUnion,TimeseriesStatistic,TimeseriesMetadata,DeviceID,DeviceTimeseriesMetadataEntry(embedsdeviceonly),DeviceTimeseriesMetadataMap.Device listing:
tsfile_reader_get_all_devices→DeviceID*; free withtsfile_free_device_id_array. For a single struct, clear heap fields withtsfile_device_id_free_contents.Metadata:
tsfile_reader_get_timeseries_metadata_all(whole file);tsfile_reader_get_timeseries_metadata_for_devices(length == 0→ empty map;devices == NULL && length > 0→ invalid arg; whenlength > 0, each entry’spathis required). Free maps withtsfile_free_device_timeseries_metadata_maponly (also frees nested device strings and statistic heap strings).Read common statistic fields via
tsfile_statistic_base(&statistic); readsumand type-specific min/max/first/last viastatistic.u.bool_s,.int_s,.float_s,.string_s, or.text_saccording tobase.type.Python
get_all_devices()→list[DeviceID](tsfile.schema.DeviceID: path, table name, segments).get_timeseries_metadata(device_ids=None)→dict[str, DeviceTimeseriesMetadataGroup]:None= all devices,[]= empty map, non-empty list filters by device path. Elements may beDeviceID(uses.path) or any object accepted as path viastr(...).Statistic types map to
TimeseriesStatisticplus subclassesIntTimeseriesStatistic,FloatTimeseriesStatistic,BoolTimeseriesStatistic,StringTimeseriesStatistic, andTextTimeseriesStatistic(withsumonly on the numeric/boolean subclasses).Tests
cpp/test/cwrapper/cwrapper_metadata_test.ccpython/tests/test_reader_metadata.py