apache / apache/texera

Empty Iceberg range returns records

Open
#8,193 1 comment 0 reactions 1 assignee Claimed by @carloea2 View on GitHub
Dominant language
Scala
Stars
314
Forks
187
Avg merge
1d 21h
Merged PRs (30d)
214

Description

### Feature Summary

IcebergIterator uses the truthiness of until_index to decide whether a range has an upper bound. An explicit upper bound of zero is false, so get_range(0, 0) is treated as unbounded and can return every available record instead of none.

Before: the documented empty half-open range has an infinite record limit and returns rows.

After: an explicit zero remains a zero limit, while an omitted upper bound remains unbounded.

Reproduction evidence:

1. Construct an Iceberg document containing at least one row.
2. Call get_range(0, 0).
3. Observe that the iterator computes total_records_to_return as infinity.
4. Iterate the result and observe that stored rows are returned even though the requested range is empty.

A catalog-free production iterator probe returned an injected row for the empty range before the fix.

Version and commit evidence:

1.3.0-incubating-SNAPSHOT (main)

**Commit Hash (Optional)**
70c21145887920528d7d5540e3fb790b43e8b759

## Relevant log output

requested=[0,0)
total_records_to_return=inf
first_result=unexpected row

### Proposed Solution or Design

Treat only an omitted upper bound as unbounded. Preserve an explicit zero so get_range(0, 0) returns no rows.

### Affected Area

Workflow Engine (Amber)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.