apache / apache/gluten

[VL] Translate Velox bitmap_construct_agg exceptions to Spark-native exception types

Open
#12,238 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Scala
Stars
1.6k
Forks
657
Avg merge
2d 21h
Merged PRs (30d)
85

Description

## Background

When `bitmap_construct_agg` is offloaded to native Velox execution, invalid bitmap positions throw a `GlutenException` (wrapping `VeloxUserError`) instead of the expected `SparkArrayIndexOutOfBoundsException` with error condition `INVALID_BITMAP_POSITION`.

## Current State

In PR #12142, we excluded the following error-path tests from `VeloxTestSettings` as a workaround:
- `INVALID_BITMAP_POSITION: position out of bounds`
- `INVALID_BITMAP_POSITION: negative position`

These tests verify that Spark throws `SparkArrayIndexOutOfBoundsException` for out-of-bounds and negative positions in `bitmap_construct_agg`. Since Velox produces its own error format (`VeloxUserError`), the JVM receives a `GlutenException` instead.

## Expected Behavior

The JVM-side error translation layer should detect Velox errors for invalid bitmap positions and re-throw them as `SparkArrayIndexOutOfBoundsException` with the appropriate `INVALID_BITMAP_POSITION` error condition, preserving Spark error API compatibility.

## References

- PR: #12142
- Error condition: `INVALID_BITMAP_POSITION` (introduced in Spark 3.5)
- Relevant test: `QueryExecutionErrorsSuite` lines 952, 966

Contributor guide

Open the contributing guide

Research direction

Start with QueryExecutionErrorsSuite around lines 952 and 966, then inspect the JVM-side error translation layer and the VeloxTestSettings exclusions introduced in PR #12142. Trace how invalid bitmap positions reach the JVM and verify that both out-of-bounds cases produce SparkArrayIndexOutOfBoundsException with INVALID_BITMAP_POSITION; restore the relevant tests when they pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
scala
Domain
backend-api-design
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.