This file provides guidance to Claude Code (claude.ai/code) when working with the C++ module.
# Build (Release, default) bash build.sh # Build variants bash build.sh -t=Debug bash build.sh -t=RelWithDebInfo bash build.sh -a=ON # Enable AddressSanitizer bash build.sh -c=ON # Enable code coverage # Disable optional compression libraries bash build.sh --disable-snappy --disable-lz4 --disable-lzokay --disable-zlib \ --disable-zstd --disable-lzma2 # LZMA2 is opt-in; its bundled XZ build requires CMake 3.20+ bash build.sh --enable-lzma2=ON # Or use CMake directly mkdir -p build/Release && cd build/Release cmake ../.. -DCMAKE_BUILD_TYPE=Release -DBUILD_TEST=ON make -j$(nproc) # Via Maven from repo root ./mvnw clean verify -P with-cpp # Run all tests ./build/Release/lib/TsFile_Test # Run specific test suite ./build/Release/lib/TsFile_Test --gtest_filter=SnappyCompressorTest.*
All ON by default unless noted:
| Option | Purpose |
|---|---|
BUILD_TEST | Compile tests (GTest 1.12.1, auto-downloaded) |
ENABLE_ANTLR4 | ANTLR4 parser runtime |
ENABLE_SNAPPY / ENABLE_LZ4 / ENABLE_LZOKAY / ENABLE_ZLIB / ENABLE_ZSTD | Compression libraries |
ENABLE_LZMA2 | LZMA2 compression (OFF by default; bundled XZ requires CMake 3.20+) |
ENABLE_THREADS | Multi-threaded read/write via pthreads |
ENABLE_ASAN | AddressSanitizer (OFF by default) |
ENABLE_SIMD | SIMD acceleration |
cpp/src/ ├── common/ # Core types: Schema, Tablet, DeviceId, TsBlock, allocators, config ├── compress/ # Compression: Snappy, LZ4, LZOKAY, Zlib (factory pattern) ├── encoding/ # Encoding: Plain, TS2Diff, Gorilla, Dictionary, RLE, Zigzag, SPRINTZ ├── file/ # File I/O: TsFileIOReader/Writer, RestorableTsFileIOWriter ├── reader/ # Read path: TsFileReader, QueryExecutor, filters, result sets ├── writer/ # Write path: TsFileWriter, TsFileTableWriter, ChunkWriter, PageWriter ├── parser/ # ANTLR4 path parser (grammars + generated code) ├── cwrapper/ # C language bindings (used by Python module) └── utils/ # Utilities: error codes, date handling, fault injection
TsFileTreeWriter/Reader) and table-view (TsFileTableWriter, TableQueryExecutor)ENABLE_THREADSthird_party/ or resolved from compatible system packages and verified source archives; see third_party/README.md.cwrapper/ provides the C API that the Python module binds to via Cython.clang-format./mvnw spotless:apply -P with-cppthird_party/googletest-release-1.12.1.zip)cpp/test/, mirroring src/ structuregtest_discover_tests()Every new file must include the Apache License 2.0 header at the top. For C/C++ files, use the /* */ block comment style. See any existing .h or .cc file for the exact wording.
Co-Authored-By trailer to commit messages.