Skip to content

fix(python): reject unknown optimize_indices options - #11266

Merged
Xuanwo merged 2 commits into
lance-format:mainfrom
LuciferYang:fix/python-optimize-indices-reject-unknown-options
Nov 20, 2026
Merged

Xuanwo merged 2 commits into
lance-format:mainfrom
LuciferYang:fix/python-optimize-indices-reject-unknown-options

Conversation

@LuciferYang

Copy link
Copy Markdown
Contributor

Closes #11265

What changes

  • optimize_options() raises ValueError: Invalid optimize_indices option: <key> for a key it does not know, as parse_compaction_options does. DatasetOptimizer.optimize_indices, OptimizeIndices.plan and OptimizeIndices.commit all parse through it.
  • DatasetOptimizer.optimize_indices takes its six options as keyword-only parameters, like compact_files, so a typo raises TypeError before reaching the binding.
  • A known option set to None means unset in every entry point. Before, retrain=None and index_names=None raised TypeError or ValueError.
  • The retrain docs in Rust, Python and Java say that only vector indices are retrained. The Rust note "only supported for v3 vector indices" predates the current rebuild-from-source retrain. A legacy-format vector index panics on retrain until fix(index): optimize legacy IVF segments and uint8 IVF_HNSW_FLAT indexes without panicking #11263 lands.

A caller that passed an option name optimize_indices does not know now gets an error instead of a default optimize. No option in the repository or in lance-ray does.

Tests

test_optimize_indices_rejects_unknown_options passes a misspelled index_name to all four entry points (the Python method, the binding, plan, commit) and checks that each raises and nothing is committed. It then checks that None values are accepted by plan and by optimize_indices, and that the correctly spelled option optimizes.

🤖 Generated with Claude Opus

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@github-actions github-actions Bot added A-python Python bindings A-index Vector index, linalg, tokenizer A-java Java bindings + JNI bug Something isn't working labels Nov 19, 2026

@lance-gatekeeper lance-gatekeeper Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Gate recommendation: approve.

No blocking issues found. The shared parser validates both regular and distributed entry points before index work or commit.

@lance-gatekeeper lance-gatekeeper Bot added the K-approved Latest Gatekeeper recommendation permits acceptance. label Nov 19, 2026
@Xuanwo
Xuanwo merged commit 41e0c9f into lance-format:main Nov 20, 2026
44 of 48 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-index Vector index, linalg, tokenizer A-java Java bindings + JNI A-python Python bindings bug Something isn't working K-approved Latest Gatekeeper recommendation permits acceptance.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: optimize_indices silently ignores option names it does not know

2 participants