Implementation:Lance format Lance Java AppendOp
| Knowledge Sources | |
|---|---|
| Domains | Java_SDK, Dataset_Management |
| Last Updated | 2026-02-08 19:33 GMT |
Overview
Description
The Append class is an immutable operation that represents appending new data fragments to an existing Lance dataset. It implements the Operation interface, aligning with the Rust transaction model via JNI. The class uses the builder pattern to construct instances and validates that the provided fragment list is neither null nor empty.
An Append operation records a list of FragmentMetadata objects that describe the new data fragments to be added to the dataset. Each fragment contains metadata about data files, row counts, and physical file locations.
Usage
Use Append when adding new rows to an existing Lance dataset without modifying the schema or existing data. This is the standard write path for incremental ingestion workloads. The operation is submitted as part of a dataset commit transaction.
Code Reference
Source Location
java/src/main/java/org/lance/operation/Append.java
Signature
public class Append implements Operation {
public static Builder builder();
public List<FragmentMetadata> fragments();
public String name(); // returns "Append"
}
Import
import org.lance.operation.Append;
I/O Contract
| Parameter | Type | Required | Description |
|---|---|---|---|
| fragments | List<FragmentMetadata> |
Yes | Non-empty list of fragment metadata describing new data to append |
| Return | Type | Description |
|---|---|---|
| fragments() | List<FragmentMetadata> |
The list of fragment metadata provided at construction |
| name() | String |
Returns "Append" to identify the operation type for JNI dispatch
|
Usage Examples
// Build an Append operation with a list of new fragments
List<FragmentMetadata> newFragments = writeNewData(arrowBatches);
Append appendOp = Append.builder()
.fragments(newFragments)
.build();
// The operation name is used by the JNI layer to route to the Rust Append handler
String opName = appendOp.name(); // "Append"
Related Pages
- Lance_format_Lance_Java_OverwriteOp -- Overwrites the entire dataset with new fragments and schema
- Lance_format_Lance_Java_MergeOp -- Merges new fragments with a specific schema for column modifications
- Lance_format_Lance_Java_RewriteOp -- Rewrites existing data for compaction without changing content