Underscore does not work as expected

Open Beginner friendly
#6,518 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 3 days

@prql-bot is already working on this.

Since Nov 2, 2026.

  • #6520 by @prql-bot — open

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
rust
Domain
compilers

Research direction

The bug is in how the PRQL parser lexes binary integer literals, so start in the Rust parser crate where numeric literals are tokenized and find the binary branch, which accepts _ directly after the 0b prefix but not between digits. Reproduce it by running the four filter foo == 0b... lines from the issue through the compiler and check which ones fail. Done means all four compile to SQL and the existing literal tests still pass.

Written by the indexing model from the issue text.

Description

bug
What happened?

I can do 0b11110000 and 0b_11110000 but not 0b1111_0000.

PRQL input
filter foo == 0b11110000  # Works
filter foo == 0b_11110000  # Works
filter foo == 0b1111_0000  # Does not work
filter foo == 0b1111_0000_1111_0000  # Does not work
SQL output
-
Expected SQL output

MVCE confirmation
  • Minimal example
  • New issue
Anything else?

I expect it to work like Python and Rust.

fn main() {
    println!("Hello, world! {}", 0x1111_0000);
}
Dominant language
Rust
Stars
10.9k
Forks
261
Avg merge
3d 21h
Merged PRs (30d)
84

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

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.

More from PRQL/prql

All issues in PRQL/prql

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.