Skip to content

fix(codecs): Support avro date values#24774

Open
omwbennett wants to merge 4 commits intovectordotdev:masterfrom
omwbennett:support-avro-date-values
Open

fix(codecs): Support avro date values#24774
omwbennett wants to merge 4 commits intovectordotdev:masterfrom
omwbennett:support-avro-date-values

Conversation

@omwbennett
Copy link
Copy Markdown

Summary

Fixes #24773 by adding support for decoding Avro date values.

Vector configuration

sources:
  kafka_avro:
    type: kafka
    bootstrap_servers: "kafka:9092"
    group_id: "vector"
    topics:
      - test_topic
    decoding:
      codec: avro
      avro:
        schema: |
          {
            "type": "record",
            "name": "test",
            "fields": [
              {
                "name": "date_field",
                "type": { "type": "int", "logicalType": "date" }
              }
            ]
          }
        strip_schema_id_prefix: false

sinks:
  console_out:
    type: console
    inputs:
      - kafka_avro
    encoding:
      codec: json

How did you test this PR?

Change Type

  • Bug fix
  • New feature
  • Dependencies
  • Non-functional (chore, refactoring, docs)
  • Performance

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

Closes #24773

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 here.

@omwbennett omwbennett requested a review from a team as a code owner February 26, 2026 16:07
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Feb 26, 2026

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@omwbennett
Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

@omwbennett omwbennett force-pushed the support-avro-date-values branch from 1ecf525 to 40d0d6a Compare February 26, 2026 16:27
@omwbennett omwbennett force-pushed the support-avro-date-values branch from 40d0d6a to aa24899 Compare February 26, 2026 16:28
@omwbennett omwbennett requested a review from a team as a code owner March 3, 2026 14:59
@github-actions github-actions bot added the domain: external docs Anything related to Vector's external, public documentation label Mar 3, 2026
@rtrieu rtrieu self-assigned this Mar 3, 2026
@omwbennett
Copy link
Copy Markdown
Author

Hey @vectordotdev/vector, appreciate if you could review this PR, thanks!

@pront
Copy link
Copy Markdown
Member

pront commented Apr 2, 2026

@codex review

Hi @omwbennett, thanks for contributing to Vector. I enabled the workflows and requested a first pass from codex.

Copy link
Copy Markdown

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

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: 857b4b3903

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@@ -0,0 +1 @@
{"name":"test","type":"record","fields":[{"name":"date_field","type":{"type":"int"}}]} No newline at end of file
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 Preserve logicalType in date fixture schema

roundtrip_avro_fixtures reads this .avsc as the schema, but the new fixture stores date_field as plain int ({"type":{"type":"int"}}) rather than an Avro date logical type. That means decoding this fixture produces AvroValue::Int, so the new AvroValue::Date branch added in try_from is never exercised by tests; regressions in real logicalType: "date" inputs could pass CI unnoticed. Please keep the fixture schema with logicalType: "date" on the field type object so the test validates the intended path.

Useful? React with 👍 / 👎.

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

Labels

domain: external docs Anything related to Vector's external, public documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Avro decoder doesn't support Date values

3 participants