Skip to content

fix: update tsfile cli and add auto-updating boundary in CLAUDE.md - #1108

Open
Alchuang22-dev wants to merge 5 commits into
apache:developfrom
Alchuang22-dev:fix/cli-skills-11
Open

Alchuang22-dev wants to merge 5 commits into
apache:developfrom
Alchuang22-dev:fix/cli-skills-11

Conversation

@Alchuang22-dev

Copy link
Copy Markdown
Contributor

Summary

  • Replace whole-result memory buffering with disk-backed stdout staging and 64 KiB publishing, preserving failure atomicity. Stream exports directly to their existing temporary targets.
  • Release previous rows’ materialized strings to prevent SDK memory accumulation during large reads.
  • Reuse SDK encoding names and encoder/decoder factories for CLI validation, adding ALP support and correcting the supported type/encoding combinations.
  • Add regression coverage for 160 type/encoding combinations, bounded output writes, output failures, and row-memory reclamation.
  • Update skills and CLI documentation, and require SDK changes to synchronize applicable CLI functionality, tests, and skills in the same change.

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.

🟡 Changes recommended

GORILLA_V1 accepts CSV NaN values despite reserving NaN as an end sentinel, allowing successful writes that fail to round-trip and requiring input rejection plus an embedded-NaN regression test.

1 open issue
What changed in this PR

This PR reduces memory use in the C++ CLI’s row-output path and aligns encoding validation with SDK capabilities, including ALP support.

Changes:

  • Stage stdout on disk, publish in 64 KiB blocks, and stream exports to temporary targets.
  • Reclaim previous rows’ materialized strings and add output and codec regression coverage.
  • Update documentation and require SDK changes to synchronize applicable CLI functionality, tests, and skills.
File Description
skills/​tsfile/​references/​encoding-compression.md Document CLI codec support and RLE precision.
skills/​tsfile/​references/​cpp.md Clarify result-row string lifetimes.
skills/​tsfile-cli/​SKILL.md Update output staging and codec guidance.
cpp/​tools/​skills/​tsfile-cli/​SKILL.md Synchronize packaged CLI guidance.
cpp/​tools/​README.md Explain disk staging and expanded encoding support.
cpp/​tools/​format/​staged_output.h Declare disk-backed output staging.
cpp/​tools/​format/​staged_output.cc Implement buffered staging and publication.
cpp/​tools/​format/​output_format.cc Reuse SDK encoding names.
cpp/​tools/​commands/​row_query.cc Integrate optional disk-backed staging.
cpp/​tools/​commands/​commands.h Expose the output-staging option.
cpp/​tools/​commands/​cmd_write.cc Validate encodings through SDK factories.
cpp/​tools/​commands/​cmd_export.cc Bypass redundant export staging.
cpp/​test/​tools/​output_format_test.cc Test staging, output failures, and encoding names.
cpp/​test/​tools/​command_e2e_test.cc Verify bounded publication writes.
cpp/​test/​tools/​codec_round_trip_test.cc Exercise 160 type/encoding combinations.
cpp/​test/​reader/​block/​reusable_tsblock_test.cc Test row-string memory reclamation.
cpp/​src/​reader/​table_result_set.cc Release previous rows’ string storage.
CLAUDE.md Require SDK, CLI, and skill synchronization.

Review effort: Balanced

storage::EncoderFactory::alloc_value_encoder(encoding, type);
auto* decoder =
storage::DecoderFactory::alloc_value_decoder(encoding, type);
const bool supported = encoder != nullptr && decoder != nullptr;
namespace tsfile_cli {

StagedOutput::StagedOutput() : file_(std::tmpfile()), stream_(this) {
setp(buffer_, buffer_ + sizeof(buffer_));

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

buffer_ has fixed size char[65536], which is not a pointer. So the issue may be a misinformation.

if (file_ == nullptr) return -1;
const size_t size = static_cast<size_t>(pptr() - pbase());
if (std::fwrite(buffer_, 1, size, file_) != size) return -1;
setp(buffer_, buffer_ + sizeof(buffer_));

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Same with the last issue.

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