Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Lance format Lance Java BTreeIndexParams

From Leeroopedia
Revision as of 15:27, 16 February 2026 by Admin (talk | contribs) (Auto-imported from implementations/Lance_format_Lance_Java_BTreeIndexParams.md)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


Knowledge Sources
Domains Java_SDK, Indexing
Last Updated 2026-02-08 19:33 GMT

Overview

Description

BTreeIndexParams is a final Java class in the org.lance.index.scalar package that provides a builder-style configuration for B-Tree scalar index parameters. It is a convenience wrapper that constructs a ScalarIndexParams instance with the index type set to "btree". The builder supports two optional parameters: zoneSize (number of rows per zone) and rangeId (ordinal ID for distributed BTree index builds). Parameters are serialized to JSON using JsonUtils and passed to ScalarIndexParams.create().

Usage

Use BTreeIndexParams.builder() to configure B-Tree index options. The build() method returns a ScalarIndexParams object (not a BTreeIndexParams instance), which can then be set on an IndexParams builder.

Code Reference

Source Location

java/src/main/java/org/lance/index/scalar/BTreeIndexParams.java

Signature

public final class BTreeIndexParams {
    public static Builder builder();

    public static final class Builder {
        public Builder zoneSize(long zoneSize);
        public Builder rangeId(int rangeId);
        public ScalarIndexParams build();
    }
}

Import

import org.lance.index.scalar.BTreeIndexParams;

I/O Contract

Builder Inputs
Parameter Type Required Default Validation Description
zoneSize long No Not set Must be positive Number of rows per zone in the B-Tree
rangeId int No Not set Must be non-negative Ordinal ID of a data partition for building a large, distributed BTree index
Build Output
Return Type Description
ScalarIndexParams A scalar index params object with type "btree" and optional JSON configuration
JSON Parameters (serialized internally)
Key Type Description
zone_size long Number of rows per zone
range_id int Range identifier for distributed builds

Usage Examples

import org.lance.index.scalar.BTreeIndexParams;
import org.lance.index.scalar.ScalarIndexParams;
import org.lance.index.IndexParams;

// Create a default BTree index (no custom zone size or range)
ScalarIndexParams defaultBTree = BTreeIndexParams.builder().build();

// Create a BTree index with a custom zone size
ScalarIndexParams customBTree = BTreeIndexParams.builder()
    .zoneSize(4096)
    .build();

// Create a distributed BTree with range partitioning
ScalarIndexParams distributedBTree = BTreeIndexParams.builder()
    .zoneSize(2048)
    .rangeId(3)
    .build();

// Wrap in IndexParams for use with IndexOptions
IndexParams params = IndexParams.builder()
    .setScalarIndexParams(customBTree)
    .build();

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment