lance-format / lance-format/lance

Upgrade DataFusion for the unparser stack-overflow fix

Open Beginner friendly
#8,225 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
7.1k
Forks
852
Avg merge
3d 18h
Merged PRs (30d)
272

Description

Description

Lance main pins the DataFusion crate family to 54.0.0. In that dependency graph, datafusion_sql::unparser::Unparser::expr_to_sql can exhaust the process stack while converting a deeply nested expression to SQL.

DataFusion tracks this as apache/datafusion#23056, and the fix was merged in apache/datafusion#23058 at commit f9c1e9ed. The latest released DataFusion tag, 54.1.0, does not contain that fix, so Lance will need to update to the first release that includes it or temporarily carry an equivalent patch.

The upstream stack protection is gated by DataFusion's recursive_protection feature. DataFusion includes this feature in its default feature set, but Lance disables DataFusion default features and does not currently enable recursive_protection. The dependency update should enable that feature explicitly; changing only the version would not activate the protection.

No direct call from Lance to Unparser was identified in the pinned Lance source. This report requests dependency hardening and does not claim a demonstrated Lance API path to the crash.

Steps to reproduce

Create an empty directory with these two files.

Cargo.toml:

[package]
name = "repro-datafusion-unparser-stack-overflow"
version = "0.1.0"
edition = "2021"

[dependencies]
datafusion-expr = "=54.0.0"
datafusion-sql = "=54.0.0"

src/main.rs:

use datafusion_expr::{col, lit, Expr};
use datafusion_sql::unparser::Unparser;

const DEPTH: usize = 100_000;

fn main() {
    let mut expr: Expr = col("value");
    for _ in 0..DEPTH {
        expr = expr + lit(1_i64);
    }

    let _ = Unparser::default().expr_to_sql(&expr);
}

Run:

cargo run
Expected behavior

Lance should use a DataFusion version containing #23058 and enable recursive_protection, so dependency consumers that unparse deeply nested expressions do not abort the process.

Lance version

v10.1.0-beta.2 (94cca93d13b1c731afd6660d46ad2f8d4b4345c4); Lance main at 51da66d4b21990e3af28a4ea5b8be8166dd529a4 still pins DataFusion 54.0.0.

Language binding

Rust

Environment

Fedora Linux 44, x86_64, rustc 1.97.1

Logs / traceback
thread 'main' has overflowed its stack
fatal runtime error: stack overflow, aborting

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in Cargo.toml at the DataFusion dependency pins and feature configuration, then inspect the linked upstream fix and identify the first release that contains it. Use the supplied Cargo.toml and src/main.rs reproduction to verify the deeply nested expression no longer aborts; done means Lance enables recursive_protection and uses a fixed DataFusion release.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
build-system
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.