Skip to content

refactor: decouple index build utilities for shared use - #821

Merged
geruh merged 3 commits into
lance-format:mainfrom
ivscheianu:feat/refresh-index-rebased
Sep 16, 2026
Merged

geruh merged 3 commits into
lance-format:mainfrom
ivscheianu:feat/refresh-index-rebased

Conversation

@ivscheianu

@ivscheianu ivscheianu commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

Part of #789 (1/2). Prepares the index build infrastructure for REFRESH INDEX (#784).

Summary

  • ScalarSegmentIndexJob takes a SparkContext and primitive parameters instead of the AddIndexExec instance, so REFRESH INDEX can share the same distributed build path without coupling to CREATE INDEX.
  • extractNamespaceInfo and isSystemIndex move to IndexUtils; parseNumSegments is extracted there as well.
  • New IndexUtils methods for the refresh path: methodForIndexType (reverse IndexType → SQL method lookup), resolveRetainedSegments (commit-time index re-resolution to catch concurrent DROP INDEX), requireUniformSegmentDetails (FTS segment compatibility guard).
  • balancedRunLengths improved to split the heaviest splittable run first via a priority queue, so the extra batches land where they help most.

No new SQL commands or grammar changes; existing behavior is preserved. 19 new unit tests for the extracted and added methods (61 total in IndexUtilsTest, all pure JVM, no native deps).

lance-gatekeeper[bot]

This comment was marked as outdated.

@lance-gatekeeper lance-gatekeeper Bot added the K-approved Latest Gatekeeper recommendation permits acceptance. label Sep 13, 2026
ScalarSegmentIndexJob now takes a SparkContext and primitive parameters
instead of the AddIndexExec instance, so REFRESH INDEX can share the
same distributed build path without coupling to CREATE INDEX.

Move extractNamespaceInfo and isSystemIndex to IndexUtils, extract
parseNumSegments, and add methodForIndexType (reverse IndexType lookup),
resolveRetainedSegments (commit-time index re-resolution),
requireUniformSegmentDetails (FTS segment compatibility guard), and
improve balancedRunLengths to split the heaviest run first via a
priority queue instead of left-to-right.
@ivscheianu
ivscheianu force-pushed the feat/refresh-index-rebased branch from 4de5461 to 11e9659 Compare September 14, 2026 15:40
Trim ~40 lines of prose comments down to constraint-only notes,
add a test for retainedSegments returning empty when all segments
cover only retired fragments, and remove the empty ShowIndexesExec
companion object.
@lance-gatekeeper lance-gatekeeper Bot removed the K-approved Latest Gatekeeper recommendation permits acceptance. label Sep 16, 2026

@lance-gatekeeper lance-gatekeeper 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.

Gate recommendation: approve.

This remains a coherent prerequisite split for PR #822: the distributed segment job takes explicit build inputs, and shared resolution, validation, and batching stay centralized without changing CREATE INDEX behavior. The rebase preserves that implementation; this revision only trims comments, removes an empty companion object, and adds coverage for the all-retired-segments case. The remaining atomic drop/commit window is still isolated to lance#6806.

@lance-gatekeeper lance-gatekeeper Bot added the K-approved Latest Gatekeeper recommendation permits acceptance. label Sep 16, 2026
@ivscheianu

Copy link
Copy Markdown
Contributor Author

hey @geruh, can we continue with this one? thanks a lot for all the support in reviewing all these PRs!

@geruh geruh left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM!

@geruh
geruh merged commit 893bc60 into lance-format:main Sep 16, 2026
17 of 20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

K-approved Latest Gatekeeper recommendation permits acceptance.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants