Skip to content

feat(file sink): add parquet batch encoding to file sink - #25971

Open
sonnens wants to merge 2 commits into
vectordotdev:masterfrom
sonnens:file_sink_parquet
Open

feat(file sink): add parquet batch encoding to file sink#25971
sonnens wants to merge 2 commits into
vectordotdev:masterfrom
sonnens:file_sink_parquet

Conversation

@sonnens

@sonnens sonnens commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Summary

add the 'parquet' batch encoder to the file sink

Vector configuration

  filetest:
    type: file
    path: /data/class_uid={{ .class_uid }}/{{class_name}}.parquet
    inputs:
      - ocsf
    encoding:
      codec: json
    batch:
      timeout_secs: 30
    batch_encoding:
      codec: parquet
      compression:
        algorithm: snappy
      schema_mode: relaxed
      schema_file: /data/schema/findings/detection_finding.parquet.schema

How did you test this PR?

with a parquet schema that includes struct & array, being fed json objects

Is this a breaking change?

  • Yes
  • No

Does this PR include user facing changes?

  • Yes. Please add a changelog fragment based on our guidelines.
  • No. A maintainer will apply the no-changelog label to this PR.

References

Notes

  • Please read our Vector contributor resources.
  • Do not hesitate to use @vectordotdev/vector to reach out to us regarding this PR.
  • Some CI checks run only after we manually approve them.
    • We recommend adding a pre-push hook, please see this template.
    • Alternatively, we recommend running the following locally before pushing to the remote branch:
      • make fmt
      • make check-clippy (if there are failures it's possible some of them can be fixed with make clippy-fix)
      • make test
  • After a review is requested, please avoid force pushes to help us review incrementally.
    • Feel free to push as many commits as you want. They will be squashed into one before merging.
    • For example, you can run git merge origin master and git push.
  • If this PR introduces changes Vector dependencies (modifies Cargo.lock), please
    run make build-licenses to regenerate the license inventory and commit the changes (if any). More details on the dd-rust-license-tool.

@sonnens
sonnens requested review from a team as code owners July 29, 2026 23:48
@github-actions github-actions Bot added docs review on hold The documentation team reviews PRs only after a PR is approved by the COSE team. domain: sinks Anything related to the Vector's sinks domain: external docs Anything related to Vector's external, public documentation labels Jul 29, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fa2e5e3ab9

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/sinks/file/mod.rs
Comment thread src/sinks/file/parquet.rs Outdated
Comment thread src/sinks/file/parquet.rs Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9a8a39ca6f

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/sinks/file/parquet.rs

match write_file(&mut file, &buffer).await {
Ok(()) => {
finalizers.update_status(EventStatus::Delivered);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Do not acknowledge filtered non-log events

When the upstream output advertises multiple event types (Vector's graph allows an all_bits output into a log-only sink), metric or trace events can still reach this Parquet path. ParquetSerializer::encode filters those non-log events out and returns Ok(()) (even with an empty buffer if the whole batch was non-log), but this success branch marks the finalizers for the original batch as Delivered, so end-to-end acknowledgements report dropped metric/trace events as successfully written and the sent counters include events that never made it into the Parquet file. Filter or reject non-log events before taking the batch finalizers, or mark the whole batch errored when any event is discarded by the encoder.

Useful? React with 👍 / 👎.

Comment thread src/sinks/file/parquet.rs
Comment on lines +122 to +124
let mut batches = input.batched_partitioned(partitioner, settings.timeout, move |_| {
settings.as_byte_size_config()
});

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Confine paths before partitioning batches

When path contains event-controlled fields, an outside-base_dir value still becomes a live partition key here and is retained by batched_partitioned until the batch fills or the 300s default timeout expires; sending many distinct invalid paths can therefore create an unbounded set of batches that will only be rejected later in write_batch. Confine the rendered path in the partitioner and return None/error for rejected paths so malicious keys are dropped before they allocate batch state.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs review on hold The documentation team reviews PRs only after a PR is approved by the COSE team. domain: external docs Anything related to Vector's external, public documentation domain: sinks Anything related to the Vector's sinks

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant