Skip to content

[core][c] Decode Java IndexedSplits and project scores explicitly - #1520

Open
miomiocat wants to merge 1 commit into
apache:mainfrom
miomiocat:codex/indexed-split-score-projection
Open

miomiocat wants to merge 1 commit into
apache:mainfrom
miomiocat:codex/indexed-split-score-projection

Conversation

@miomiocat

Copy link
Copy Markdown

Purpose

Closes #1519.

Allow callers to pass a Java-planned indexed split to the reader and retrieve its optional scores alongside projected table fields.

Brief change log

  • Decode raw and framed IndexedSplit bodies through the same parser and preserve the row selection and score payload.
  • Add an opt-in score projection to the Rust table reader and C read builder. Match surviving tracked rows by row ID, and account for deletions when reading by file position.

Tests

Added raw/framed decoding comparisons and C read cases for score projection, output names and score alignment after filtering.

Local verification passed with cargo build --locked -p paimon-c --lib and cargo fmt --all -- --check. Test execution is left to upstream CI.

API and Format

Adds TableRead::to_arrow_with_index_score and paimon_read_builder_with_index_score. An explicit score name appends a nullable Float32 column. A projected table field and the score must have distinct names.

Documentation

The C binding guide documents accepted split encodings, score projection and the constraints on file-position reads.

Accept raw and framed splits with the same range and score validation.
Let callers name the score column independently of table projections.
Match tracked rows by row ID and file-position selections through the
deletion-vector-aware reader.

Co-Authored-By: Codex <noreply@openai.com>
AI-Model: gpt-6
AI-Contributed/Feature: 590/590
AI-Contributed/UT: 0/0

@JingsongLi JingsongLi 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.

Java IndexedSplit support addresses the planning-to-read handoff in #1519. I checked raw and framed decoding, built the C header, and ran 109 C tests and 20 related core tests. Two additional end-to-end cases reproduced the issues below.

"A scored primary-key split must select one physical file",
));
}
read_positions(read, split, ranges, scores, name)

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.

[P1] Preserve managed BLOB payloads when projecting scores on a primary-key split. This branch skips resolving_primary_key_blobs, so the position reader returns the stored descriptor as the value of a projected BLOB column. I wrote b"two" to a PK table with blob-as-descriptor=false and read the same position through the C API. Both unscored reads returned b"two", including with a null score column. Adding a real score changed the BLOB value to a .managed.blob descriptor. Reuse the normal PK payload resolution while retaining score alignment, and cover this in a scored split round trip.

name: String,
) -> crate::Result<ArrowRecordBatchStream> {
let count = read.read_type.len();
let reader = PkVectorIndexedSplitRead::new(read.new_data_file_reader()?);

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.

[P2] Do not expose the position reader's internal metadata name restrictions through this API. I wrote an ordinary append table with a user column named __paimon_search_score and requested similarity as the scored output name. The first batch failed with a reserved metadata name error even though the projected names are distinct. Reuse the physical selection and DV logic without appending the internal metadata fields under fixed names, or pass the selected output name all the way through.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Read raw Java IndexedSplit bytes and project their scores

2 participants