Skip to content

Add sketch command in tsfile-cli from TsFileSketchTool - #838

Open
Alchuang22-dev wants to merge 2 commits into
apache:developfrom
Alchuang22-dev:feat-print-tsfile
Open

Add sketch command in tsfile-cli from TsFileSketchTool#838
Alchuang22-dev wants to merge 2 commits into
apache:developfrom
Alchuang22-dev:feat-print-tsfile

Conversation

@Alchuang22-dev

Copy link
Copy Markdown
Contributor

Summary

Content

Migrates the Java TsFileSketchTool print/self-check capability into tsfile-cli as the new sketch command.

Known Limitation

We must mention that the Java edition has a stream-based fallback for very large metadata/index regions. The C++ implementation currently buffers these regions and does not implement the same streaming fallback. If a metadata or chunk data range exceeds the C++ sketch reader buffer limit, the CLI reports truncated output with an explicit blocker instead of attempting Java-equivalent streaming traversal.

Test Plan

  • cmake --build cpp/build/Debug --target tsfile_cli -j 4
  • cmake --build cpp/build/Debug --target TsFile_Test -j 4
  • cpp/build/Debug/test/lib/TsFile_Test --gtest_filter='CliE2E.Sketch*'
  • cpp/build/Debug/test/lib/TsFile_Test --gtest_filter='CliE2E.*:RunCliTest.*'
  • env PATH=/opt/homebrew/opt/llvm@17/bin:/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin ./mvnw -P with-cpp -pl :tsfile-cpp spotless:check
  • Compared Java and C++ sketch output for real tsfile large_data.tsfile with cmp; result: cmp_exit=0.

@ColinLeeo

Copy link
Copy Markdown
Contributor

You can show the command’s output/result in the comment.

@ColinLeeo
ColinLeeo self-requested a review June 19, 2026 03:50
@Alchuang22-dev

Copy link
Copy Markdown
Contributor Author

The output of the command shown as following format:

TsFile Sketch
file path: /**/timeseek-opensource/IoTDB-TimeSeek/timeseek_codex/workspaces/tsfile/large_data.tsfile
file length: 18429

POSITION|CONTENT
|||||||||||||||||||||
TsFile Info
                   0|	[magic head] TsFile
                   6|	[version number] 4
|||||||||||||||||||||
Chunk Groups
                   7|	[ChunkGroup] of sensor_data.d000, num of Chunks:2
... 
               16473|	[TsFileMetadata] TableIndexRootCnt=1
               18166|	[TsFileMetadata] TableSchemaCnt=1
               18250|	[Bloom Filter Size] bit vector byte array length=995
               18254|	[Bloom Filter] , filterCapacity=792, hashFunctionSize=5
               18419|	[TsFileMetadataSize] 1946
               18423|	[magic tail] TsFile
               18429|	END of TsFile
IndexOfTimerseriesIndex Tree
...
TsFile Sketch End

the same as java edition

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.

2 participants