Skip to content

fix(rag): assign PDF parser tables to tbls in book chunking method (#19557) - #19559

Merged
JinHai-CN merged 1 commit into
infiniflow:mainfrom
Ritiky23:fix/book-chunk-dropped-tables
Sep 14, 2026
Merged

JinHai-CN merged 1 commit into
infiniflow:mainfrom
Ritiky23:fix/book-chunk-dropped-tables

Conversation

@Ritiky23

Copy link
Copy Markdown
Contributor

Summary of Changes

Fixes #19557

In rag/app/book.py, the PDF parsing branch receives (sections, tables, pdf_parser) from parser(...), but previously omitted assigning tables to tbls. As a result, tbls remained [] and tokenize_table(tbls, ...) silently dropped all figure, table, and formula chunks for PDF documents using the book chunking method.

Changes Made:

  • Assigned tbls = tables following the PDF parser invocation in rag/app/book.py.
  • Verified that tokenize_table(tbls, ...) properly emits table and image chunks for PDF inputs with DeepDOC and other layout parsers.

Verification:

  • Chunked a sample PDF with figures/tables using book chunk method and verified non-zero doc_type_kwd in {"table", "image"} chunks are preserved.

@coderabbitai

coderabbitai Bot commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 7c84ead6-6203-48a0-98a8-ef8949167342

📥 Commits

Reviewing files that changed from the base of the PR and between 1f5d333 and e0e3a4a.

📒 Files selected for processing (1)
  • rag/app/book.py

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

The PDF branch of the book chunk method now assigns parser-returned tables to tbls. Downstream tokenize_table calls can process extracted figures and tables.

Changes

Book PDF table preservation

Layer / File(s) Summary
Retain parsed PDF tables
rag/app/book.py
The PDF branch assigns tables to tbls, preserving extracted table and figure entries for tokenize_table.

Priority: ➖ Normal

Estimated code review effort: 1 (Trivial) | ~5 minutes

Change: Bug fix · Severity of issue fixed: Medium

Suggested reviewers: jinhai-cn

Merge Risk: ⚪ Minimal · up to e0e3a

This change restores standalone PDF table and figure chunk preservation without introducing a merge-blocking risk.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely identifies the main fix: assigning PDF parser tables to tbls in the book chunking method.
Description check ✅ Passed The description includes the required Summary section and clearly explains the bug, fix, affected code, expected behavior, and verification performed.
Linked Issues check ✅ Passed The change satisfies #19557. In the PDF branch of rag/app/book.py, the parser result tables is assigned to tbls before the existing tokenize_table(tbls, ...) call. This preserves the parser en…
Out of Scope Changes check ✅ Passed The only change is the two-line PDF-branch assignment in rag/app/book.py. It directly fixes the dropped tables channel described in #19557. No unrelated behavior or file changes are shown.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

A rabbit found tables tucked out of sight
Now figures hop into chunks just right
The parser keeps what it once knew
Tokenized tables join the queue
Book pages thump with data bright

Comment @coderabbitai help to get the list of available commands.

@xugangqiang xugangqiang added the ci Continue Integration label Sep 14, 2026
@xugangqiang

Copy link
Copy Markdown
Contributor

Nice catch! LGTM

@codecov

codecov Bot commented Sep 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 37.33%. Comparing base (1f5d333) to head (e0e3a4a).
⚠️ Report is 19 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #19559      +/-   ##
==========================================
+ Coverage   29.92%   37.33%   +7.41%     
==========================================
  Files          54       54              
  Lines       15383    15383              
  Branches      125      125              
==========================================
+ Hits         4603     5743    +1140     
+ Misses      10767     9613    -1154     
- Partials       13       27      +14     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@JinHai-CN
JinHai-CN merged commit 58c80cb into infiniflow:main Sep 14, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci Continue Integration

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] book chunk method silently drops the figure/table channel (PDF branch never assigns tables to tbls)

3 participants