Skip to content

test(cpp): cover the extended C wrapper API - #1130

Open
ColinLeeo wants to merge 1 commit into
apache:developfrom
ColinLeeo:colin/cpp-cwrapper-tests
Open

ColinLeeo wants to merge 1 commit into
apache:developfrom
ColinLeeo:colin/cpp-cwrapper-tests

Conversation

@ColinLeeo

Copy link
Copy Markdown
Contributor

Summary

The C wrapper is the surface the Python bindings call, but several of its entry points had zero C++ test coverage (41 of 168 functions in tsfile_cwrapper.cc).

cpp/test/cwrapper/cwrapper_extended_test.cc now covers:

  • global time encoding/compression setters and getters, plus set_allow_non_decreasing_timestamps
  • tablet_get_cur_row_size, typed adders by name/index (float, bool, int32)
  • tsfile_writer_flush
  • result-set getters by index (int32/int64/float/double/bool), is_null_by_index, binary cell copies, get_metadata plus the metadata accessors, and free_result_set_meta_data
  • tsfile_reader_query_table with offset/limit and an inverted range, tsfile_query_table_batch, and tsfile_result_set_get_next_tsblock_as_arrow
  • Arrow writes through both writers (tsfile_writer_write_arrow and _tsfile_writer_write_arrow_table), building the input struct from a TsBlock
  • tag filter and/or/not composition and tsfile_query_table_with_tag_filter
  • schema-array release helpers (tsfile_free_table_schema_array, tsfile_free_device_schema_array)
  • the legacy device/record path (_tsfile_writer_register_device, typed record inserts, _tsfile_writer_write_ts_record, _tsfile_writer_flush) and tsfile_query_table_on_tree
  • generic-writer table write via _tsfile_writer_write_table

Coverage: tsfile_cwrapper.cc 62.5% -> 73.5% lines (163/168 functions), arrow_c.cc 69.9% -> 77.5% (27/28 functions). The five remaining prepared-series functions require a dataset-index locator that the C API does not expose, so they stay unreachable from C++ tests.

Test plan

  • ./mvnw -B clean verify -P with-java,with-python -Denable.lzma2=ON (Java, C++, Python; 1858 C++ tests passed)
  • ./mvnw -B clean verify -P with-cpp -Denable.asan=ON -Dbuild.type=RelWithDebInfo -Denable.lzma2=ON (1859 tests, 0 failed; macOS run used the Xcode 26.6 toolchain with ASAN_OPTIONS=detect_container_overflow=0 for the uninstrumented ANTLR runtime)
  • ./mvnw spotless:check -P with-java,with-python

Exercise the C parts of the wrapper that the Python bindings use but the
C++ suite never reached: global time encoding/compression setters and
getters, tablet row-count/typed adders, writer flush, result-set value
getters and metadata accessors, binary cell copies, reader query
variants (offset/limit, inverted range, batch), Arrow block export and
Arrow table writes through both writers, tag filter and/or/not
composition, schema-array release helpers, and the legacy device/record
write path.

tsfile_cwrapper.cc: 62.5% -> 73.5% line coverage (163/168 functions);
arrow_c.cc: 69.9% -> 77.5% (27/28 functions). The remaining prepared-series
entry points need a dataset-index locator that is not exposed through the
C API.
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