JSON FTS query fails with "Invalid triple format" when the searched value contains ';' (or the key contains ',')
Maintainers usually reply within 3 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 35/100
Research direction
Start with rust/lance-index/src/scalar/inverted/tokenizer/document_tokenizer.rs around flatten_triplet at lines 180-181, then run the repros in $S/hunt/datashapes/json1.py and json2.py. Review the public MatchQuery and create_scalar_index documentation before resolving the query-syntax choice. Done means JSON triplet queries can represent values containing semicolons and keys containing commas without errors, with the grammar documented.
Written by the indexing model from the issue text.
Description
Bug bash: Needs team input — design question
Bug bash priority: Medium · critical-fix: no
From the FTS for Code bug bash (2026-10-01), findings: datashapes-2.md. Repros ran against released artifacts (pylance 12.0.0 / 13.0.0b18, lancedb 0.39.0 / 0.40.0b12, @lancedb/lancedb 0.40.0-beta.12) unless stated. $S is the bug bash scratch dir.
Decision needed: the query syntax (public API).
Options:
- Add escaping to the triple syntax.
- Add a structured (path, type, value) query object alongside the string form.
Recommendation: 2.
- Category: bug
- Environment: pylance local, Python 3.12, Linux arm64
- Artifacts: pylance 13.0.0b18 (lance 13.0.0-beta.18); pylance 12.0.0 for comparison
- Target tracker: GitHub
lance-format/lance
Repro
Scripts: $S/hunt/datashapes/json1.py, json2.py. JSON column indexed with analyzer="code", split_identifiers=True, with_position=True.
ds.to_table(full_text_query=MatchQuery("code,str,return x;", "j"))
ds.to_table(full_text_query=MatchQuery("code,str,x;y", "j"))
ds.to_table(full_text_query=MatchQuery("a,b,str,getUserName", "j")) # doc {"a,b": "getUserName"}
pylance 13.0.0b18:
match 'code,str,return x;' -> ERROR ArrowInvalid: External error: Invalid user input: Invalid triple format: , /rustc/2d8144b7880597b6e6d3dfd63a9a9efae3f533d3/library/core/src/ops/function.rs:250:5
match 'code,str,x;y' -> ERROR ArrowInvalid: External error: Invalid user input: Invalid triple format: y, /rustc/2d8144b7880597b6e6d3dfd63a9a9efae3f533d3/library/core/src/ops/function.rs:250:5
match 'a,b,str,getUserName' -> ERROR ArrowInvalid: External error: Invalid user input: Invalid triple type: b, /rustc/.../function.rs:250:5
pylance 12.0.0 panicked (document_tokenizer.rs:147:71 ... Result::unwrap() on an Err value, then Lance reader producer terminated before end of stream), so lance#8813 holds: it is now a clean error, not a panic. But there is still no way to search a code value containing ; (common in code: return x;, for (i=0; i<n; i++)) or a key containing ,. The error location points at a rustc std path, not lance code.
Expected behavior
A user can pass an arbitrary code snippet as the value of a JSON triplet. With the code analyzer ; is never indexed anyway, so code,str,return x; should behave like code,str,return x.
Evidence: the text column accepts MatchQuery("return x;") without error.
Suspected root cause
flatten_triplet splits the whole query on ; before parsing path,type,value (lance rust/lance-index/src/scalar/inverted/tokenizer/document_tokenizer.rs:180), and splits each triple on the first two commas (:181). There is no escaping, so ; in a value starts a new (invalid) triple and , in a key shifts the type field. Not documented in the pylance create_scalar_index / MatchQuery docstrings.
Fix direction
Triage: either add an escape / structured (non-string) JSON query form, or only split on ; that is followed by a valid path,type, prefix; at minimum document the triplet grammar and its reserved characters.
- Dominant language
- Rust
- Stars
- 7.2k
- Forks
- 900
- Avg merge
- 4d 22h
- Merged PRs (30d)
- 366
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- Ships a Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from lance-format/lance
-
documentation
Difficulty 1/5 Under an hour Newbie friendliness 78/100
lance-format/lance#10225 ·
Maintainers usually reply within 3 days
-
feature performance
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
lance-format/lance#10137 ·
Maintainers usually reply within 3 days
-
After initialize_mem_wal, every FTS query logs "ERROR Index __lance_mem_wal has no fields"Possibly taken @lance-gatefixer claimed this 24 days ago. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
lance-format/lance#9655 ·
Maintainers usually reply within 3 days
-
Upgrade DataFusion for the unparser stack-overflow fixMay be free again A pull request for this issue was closed without being merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
lance-format/lance#8225 ·
Maintainers usually reply within 3 days
-
enhancement
Difficulty 1/5 Under an hour Newbie friendliness 84/100
lance-format/lance#6425 · 2 comments ·
Maintainers usually reply within 3 days
All issues in lance-format/lance
Similar issues
-
area/tools bug session-analysis
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 84/100
nix-community/fenix#262 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
GabrieleLozupone/kokon#41 ·
Maintainers usually reply within 1 day
-
Small glitchOpenpriority: medium
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
storytold/photocraft#9538 ·
Maintainers usually reply within 1 day
-
bug P2 rust
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day