Skip to content

fix(docling): stringify binary_hash to prevent OpenSearch long overflow - #3698

Closed
SyedShahmeerAli12 wants to merge 21 commits into
deepset-ai:mainfrom
SyedShahmeerAli12:fix/docling-binary-hash-stringify
Closed

fix(docling): stringify binary_hash to prevent OpenSearch long overflow#3698
SyedShahmeerAli12 wants to merge 21 commits into
deepset-ai:mainfrom
SyedShahmeerAli12:fix/docling-binary-hash-stringify

Conversation

@SyedShahmeerAli12

Copy link
Copy Markdown
Contributor

Related Issues

Proposed Changes

MetaExtractor previously stored Docling's origin.binary_hash as an integer in document metadata. Since binary_hash is an unsigned 64-bit integer, values greater than 2^63 - 1 break document stores that map numeric metadata to signed 64-bit types (e.g. OpenSearch long), causing:

failed to parse field [dl_meta.origin.binary_hash] of type [long]
Numeric value (9768961288489567249) out of range of long

Following @julian-risch's guidance on #3604, binary_hash is now always stored as a string via a new _stringify_binary_hash() recursive helper applied in both extract_dl_doc_meta and extract_chunk_meta.

Reproduction

Before fix — binary_hash returned as int, overflows OpenSearch long:

# model_dump() returns: {binary_hash: 9768961288489567249}  � int, rejected by OpenSearch

After fix — stored as str, no overflow:

# _stringify_binary_hash() returns: {binary_hash: 9768961288489567249}  � safe keyword

Testing

  • Added 3 new unit tests: oversized hash in doc meta, chunk meta, and nested structures
  • All 8 TestMetaExtractor tests pass
  • ruff check clean

Notes

  • Breaking metadata-type change for callers that assumed binary_hash was int — aligns with maintainer suggestion for a major release
  • Both small and large hashes are stringified for consistency

Implements MariaDBDocumentStore backed by MariaDB 11.7+ native VECTOR
support with MHNSW indexing and full-text keyword search.

- Full DocumentStore protocol: write_documents (FAIL/OVERWRITE/SKIP),
  filter_documents, delete_documents, count_documents
- Vector similarity via VEC_DISTANCE_COSINE / VEC_DISTANCE_EUCLIDEAN
- Full-text keyword search via MATCH ... AGAINST (NATURAL LANGUAGE MODE)
- Haystack metadata filtering converted to JSON_EXTRACT SQL expressions
- MariaDBEmbeddingRetriever and MariaDBKeywordRetriever with FilterPolicy
- 80 tests: 68 unit + 12 integration (all verified against MariaDB 11.7)
- GitHub Actions workflow with MariaDB 11.7 service container

Closes deepset-ai#2340
- Make mariadb C extension import lazy so API reference builds without
  requiring libmariadb-dev in the docs environment
- Fix Docker health check to use --su-mysql flag required by MariaDB 11.7
- Add mariadb (LGPL-2.1) to license compliance exclusion list
- Add skip-install=true to default hatch env so docs build does not
  attempt to compile the mariadb C extension (libmariadb-dev not
  available in the API reference runner). The pydoc search_path already
  points to src/ so modules are importable without installation.
- Switch service container health check from healthcheck.sh (unreliable
  in some MariaDB 11.7 images) to mysqladmin ping which is more robust.
…THCHECK

The mariadb:11.7 Docker image ships with a HEALTHCHECK instruction.
GitHub Actions automatically waits for it when no custom options override it.
Custom health-cmd variants (healthcheck.sh, mysqladmin) were failing because
the slim runner environment handles them differently.
@SyedShahmeerAli12
SyedShahmeerAli12 requested a review from a team as a code owner July 30, 2026 11:41
@SyedShahmeerAli12
SyedShahmeerAli12 requested review from sjrl and removed request for a team July 30, 2026 11:41
@github-actions

Copy link
Copy Markdown
Contributor

Hi @SyedShahmeerAli12, thanks for your interest in contributing to Haystack! 🙏

⚠️ Issue #3604 is already being addressed by open pull request(s) #3607. Before opening a PR for an issue, please check whether a PR is already linked to it, and consider contributing to the existing PR instead. We may close duplicate PRs to keep the review queue manageable.

⚠️ You currently have 4 open pull requests in this repository (#3565, #3483, #3254 and this one). Our review capacity is limited, so please hold off opening more PRs until we've had a chance to review your first 2 open PRs. This helps us give each contribution the attention it deserves. Thank you!

This is an automated message to help us keep the review queue healthy.

@github-actions github-actions Bot added topic:CI integration:docling type:documentation Improvements or additions to documentation labels Jul 30, 2026
@socket-security

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedpypi/​mariadb@​1.1.149810010010070

View full report

@SyedShahmeerAli12

SyedShahmeerAli12 commented Jul 30, 2026

Copy link
Copy Markdown
Contributor Author

Closing reopening with a clean branch that doesn't carry unrelated MariaDB commits.

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

Labels

integration:docling topic:CI type:documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DoclingConverter: binary_hash metadata can exceed signed 64-bit integer range

1 participant