Skip to content

Spark: Parse negative numeric literals before casts - #3069

Open
benjibunbun wants to merge 1 commit into
apache:mainfrom
benjibunbun:fix/spark-signed-literals
Open

benjibunbun wants to merge 1 commit into
apache:mainfrom
benjibunbun:fix/spark-signed-literals

Conversation

@benjibunbun

Copy link
Copy Markdown

Dialects: Spark

Fixes #3055.

SELECT -128::TINYINT now casts the negative literal instead of negating a cast of positive 128, which overflows TINYINT.

Spark now treats a leading minus as part of a numeric literal, matching its number grammar. Nonliteral unary minus, unary plus and other dialects retain their existing grouping.

Added AST assertions for integer boundaries, numeric forms, spans, preserved operators, errors and round trips, plus a minimal fuzz seed.

Local checks passed on macOS: default tests, stable/beta/nightly all-feature tests, fmt, Clippy, docs, no_std, RAT and coverage. Changed executable lines have 100% coverage. Parser and display/reparse fuzz runs completed over 210,000 inputs without reported failures.

Assisted by Codex.

@github-actions github-actions Bot added the Spark label Nov 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Spark dialect: a minus sign before a number literal should bind tighter than ::

1 participant