8000 [Bug]: QA text chunker reads a comma CSV as TAB when a quoted field spans lines and any TAB is present · Issue #22807 · infiniflow/ragflow · GitHub
[go: up one dir, main page]

Skip to content

[Bug]: QA text chunker reads a comma CSV as TAB when a quoted field spans lines and any TAB is present #22807

Backlog

Description

@ccclucky

Describe the bug

A comma-separated Q&A text file is read as TAB separated when two conditions hold together:

  1. any character in the payload is a TAB (for example inside a quoted answer), and
  2. a quoted field spans physical lines, which RFC 4180 allows and the extractor itself supports.

The whole file is then parsed with the TAB reader, every physical line becomes a single field, and the ingestion produces no Q&A pairs. The failure is silent: the document is ingested with zero chunks and no error is reported.

Steps to reproduce

Ingest this faq.txt (commas, one quoted answer over two lines, one TAB inside a later answer):

"Q1","first line
second line"
"Q2","plain"
"Q3","has<TAB>tab"

Expected: three Q&A chunks, with Q1's answer containing the embedded newline.

Actual: no Q&A pair is extracted.

Root cause

detectDelimiter in internal/ingestion/component/chunker/qa.go splits the payload into physical lines and parses each line with its own csv.Reader. On this payload the fragments do not look like two-value comma records, so the heuristic settles on TAB.

The reference it mirrors (csv_pair_delimiter from the removed rag/app/qa.py) reads the payload with one csv.reader over all lines, and the Go extractor extractQATextCSV also reads the full text with one csv.Reader so quoted fields spanning lines form one record. Only the delimiter detection still reads line by line, so it can disagree with the parser it is choosing for.

Differential check against the reference over 3000 generated well-formed comma CSVs with embedded newlines and TAB characters: 171 files are classified as TAB; after reading the payload with one reader, 0 differ from the reference.

Version

main (the per-line detectDelimiter comes from #22749, merge commit 0534824)

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0