Hi community,

I have opened PR #897 to add file-level TsFile properties support for the C++ 
and Python APIs:


https://github.com/apache/tsfile/pull/897


Java already represents TsFile properties as Map<String, byte[]>. This PR 
provides equivalent capabilities for C++ and Python while keeping the existing 
TsFile metadata encoding unchanged.


The main changes include:


1. C++
   - Introduce TsFilePropertyValue and TsFileProperties for binary property 
values.
   - Add property setters to TsFileWriter and TsFileTableWriter.
   - Add TsFileReader::get_tsfile_properties().
   - Replace the previous raw-pointer property map with value-based ownership.


2. C wrapper
   - Add length-aware APIs for binary property keys and values.
   - Add an explicit is_null field to distinguish null from an empty byte array.
   - Provide a release function for property results returned by the reader.


3. Python
   - Add add_tsfile_property(key: str, value: bytes) to TsFileWriter and
     TsFileTableWriter.
   - Add get_tsfile_properties() to TsFileReader.
   - Return properties as dict[str, bytes | None].
   - Accept bytes values without implicit string conversion.


Property values are treated as raw bytes without an additional type tag.
Applications can use their own portable encoding for integers, floating-point
values, or structures. Adding the same key again replaces its previous value.


The implementation preserves compatibility with Java byte[] properties,
including arbitrary binary data, embedded NUL bytes, null values, and
non-null empty byte arrays.


The PR also adds C++, C wrapper, and Python tests covering binary values,
null and empty values, duplicate-key replacement, API validation, and
system property precedence.


Feedback and review are welcome.


Best regards,
Colin

Reply via email to