Skip to content

Fix several bugs in tsfile-cli and add tag filter commands#837

Merged
jt2594838 merged 7 commits into
apache:developfrom
Alchuang22-dev:tsfile-cli
Jun 11, 2026
Merged

Fix several bugs in tsfile-cli and add tag filter commands#837
jt2594838 merged 7 commits into
apache:developfrom
Alchuang22-dev:tsfile-cli

Conversation

@Alchuang22-dev

Copy link
Copy Markdown
Contributor

Summary

The PR is a plugin for #836.

CLI install behavior. cpp/build.sh no longer runs make install by default, which previously installed into CMake's default /usr/local prefix when users only intended to build. The script now builds only by default and runs install only when explicitly invoked with install / --install. --help and README docs were updated accordingly.

Case-insensitive table filters. Metadata commands now normalize table filter names before comparing against stored table schema names. This fixes schema -t TABLE1, stats -t TABLE1, and count -t TABLE1 returning empty results for table-model files whose internal table names are lower-cased.

Row-window pushdown. head / cat now use TsFileReader::queryByRow(...) when --offset / -n can be pushed down, avoiding the previous behavior of scanning rows first and applying offset/limit in the formatter. Time-range queries (--start / --end) keep the existing path so offset/limit semantics remain "after time filtering" until queryByRow grows a time-range API.

Tag filter predicates. Added a simple table TAG predicate interface for row commands:

  • --tag-filter <column> <op> <value>
  • --tag-between <column> <lower> <upper>
  • --tag-not-between <column> <lower> <upper>

Supported operators match the existing C++ tag filter builder: eq, neq, lt, lteq, gt, gteq, regexp, and not-regexp. The CLI constructs the underlying TagFilterBuilder filter and passes it through the reader's tag_filter path for head, cat, and sample.

Docs and agent skill. Updated cpp/tools/README.md and the in-repo tsfile-cli skill so users and agents can discover the explicit install mode, row-window behavior, and tag predicate options.

Test plan

  • cmake --build cpp/build/Debug --target tsfile_cli
  • cmake -S cpp -B cpp/build/Debug -DCMAKE_BUILD_TYPE=Debug -DBUILD_TEST=ON -DENABLE_ANTLR4=OFF
  • cmake --build cpp/build/Debug --target TsFile_Test
  • cpp/build/Debug/test/lib/TsFile_Test --gtest_filter='ParseArgsTest.*'
  • cpp/build/Debug/test/lib/TsFile_Test --gtest_filter='CliE2E.*'
  • Regression coverage for case-insensitive table metadata filters: schema, stats, count
  • Regression coverage for head / cat --offset/-n row-window behavior, including time-range fallback semantics
  • Regression coverage for table TAG filters on cat, head, and sample, including invalid field-column rejection
  • Manual large-file-path check with large_data.tsfile for cat/head --offset -n
  • Manual tag-filter check with large_data.tsfile, including eq, between, and regexp predicates
  • bash -n build.sh
  • bash build.sh --help
  • bash build.sh -t=Debug --disable-antlr4 confirms default build skips install

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

# Conflicts:
#	cpp/tools/cli/run_cli.cc
#	cpp/tools/skills/tsfile-cli/SKILL.md
Comment thread cpp/tools/commands/statistics.cc Outdated
@jt2594838 jt2594838 merged commit 719f80a into apache:develop Jun 11, 2026
29 checks passed
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.

3 participants