Skip to content

Databricks, Hive: parse 1L as a long literal - #2771

Open
moshap-firebolt wants to merge 2 commits into
apache:mainfrom
moshap-firebolt:databricks-long-literal
Open

moshap-firebolt wants to merge 2 commits into
apache:mainfrom
moshap-firebolt:databricks-long-literal

Conversation

@moshap-firebolt

Copy link
Copy Markdown
Contributor

Databricks and Hive both write a BIGINT literal with an L suffix (Databricks, Hive), but both dialects read it as an identifier:

SELECT 1L
-- Databricks, Hive: Identifier(Ident { value: "1L", .. })

Their numeric-prefix rule, which allows table names like 59901_user_login, runs before the tokenizer looks for the suffix. Hive's long_numerics test passed only because the identifier 1L prints back unchanged.

This adds Dialect::supports_long_suffix_before_numeric_prefix, enabled for both: an L that ends the number makes it a long, and 1La is still an identifier. MySQL, which has a numeric prefix but no long literal, keeps reading 1L as an identifier. As elsewhere in the tokenizer, only an uppercase L is a suffix. Databricks DIV, CREATE TABLE ... USING and LONG are left to #2425.

Tests in sqlparser_common.rs cover dialects with and without the method; they fail without the change.

This PR was prepared with AI assistance (Claude).

Dialects: Databricks, Hive

🤖 Generated with Claude Code

moshap-firebolt and others added 2 commits October 29, 2026 14:06
Both dialects read `1L` as an identifier, since the numeric-prefix rule
(tables named `59901_user_login`) ran before the long suffix. A new
dialect method, supports_long_suffix_before_numeric_prefix, lets an `L`
that ends the number win; `1La` is still an identifier. MySQL, which has
no long literal, keeps reading `1L` as an identifier.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.55%. Comparing base (b22bf61) to head (ccf327d).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2771      +/-   ##
==========================================
+ Coverage   82.52%   82.55%   +0.03%     
==========================================
  Files          42       42              
  Lines       35533    35573      +40     
  Branches    35533    35573      +40     
==========================================
+ Hits        29323    29368      +45     
+ Misses       2675     2672       -3     
+ Partials     3535     3533       -2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants