Skip to content

Doris SQL: add Doris Dialect - #2380

Open
finchxxia wants to merge 9 commits into
apache:mainfrom
finchxxia:draft/doris-dialect-support
Open

finchxxia wants to merge 9 commits into
apache:mainfrom
finchxxia:draft/doris-dialect-support

Conversation

@finchxxia

@finchxxia finchxxia commented Jun 17, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Introduce DorisDialect as the first step toward Apache Doris support (#2379).
Previously, callers could not select a Doris dialect by name.

  • Register Doris in dialect lookup, the CLI example, and shared tests.
  • Delegate shared identifier, string, LIMIT, DIV, and GROUP BY behavior to MySQL.
  • Enable Doris nested block comments and add regression tests.
  • Include Doris in both fuzz targets and automatic dialect labeling.

CREATE TABLE extensions and load statements are left to follow-up PRs.

Reference: Doris lexer.

Validation

Passed all-feature tests, formatting, Clippy, labeler tests, and compilation checks for both fuzz targets.
Fuzzing was not run locally.

AI assistance was used for implementation and validation.

@finchxxia
finchxxia marked this pull request as draft June 17, 2026 08:28
@finchxxia
finchxxia force-pushed the draft/doris-dialect-support branch from fc16163 to a55690c Compare June 17, 2026 08:35
@LucaCappelletti94

Copy link
Copy Markdown
Contributor

2500 lines of a PR are a bit too many, could you fracture this down into smaller reviewable units?

@finchxxia

Copy link
Copy Markdown
Contributor Author

2500 lines of a PR are a bit too many, could you fracture this down into smaller reviewable units?

@LucaCappelletti94 Of course, I would do that later and add more info in issue link #2379

@finchxxia
finchxxia force-pushed the draft/doris-dialect-support branch from ecca2d6 to bffa3fd Compare June 18, 2026 05:21
@finchxxia
finchxxia marked this pull request as ready for review June 18, 2026 06:15
@finchxxia

Copy link
Copy Markdown
Contributor Author

2500 lines of a PR are a bit too many, could you fracture this down into smaller reviewable units?

@LucaCappelletti94 Done. Could you please take a look?

@finchxxia
finchxxia force-pushed the draft/doris-dialect-support branch from 8f0906f to 7ff24be Compare July 3, 2026 06:47
@finchxxia

Copy link
Copy Markdown
Contributor Author

@alamb @benesch @LucaCappelletti94 Hi team, any improvement should I have?

@LucaCappelletti94 LucaCappelletti94 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the sort of PR that would really benefit from GitHub stabilizing stacked PR also for forks' branches. Let's hope that happens soon. In the meantime, here are a few notes on this first PR in the chain.

Comment thread src/dialect/doris.rs
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct DorisDialect {}

impl Dialect for DorisDialect {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe you are still currently missing:

  • supports_limit_comma
  • parse_infix (the DIV)
  • supports_group_by_with_modifier

I am not familiar enough with Doris to say anything about the other methods, but I suggest you audit them against the engine.

Comment thread src/dialect/doris.rs Outdated
}

fn is_identifier_start(&self, ch: char) -> bool {
ch.is_ascii_alphabetic() || ch == '_' || !ch.is_ascii()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since these methods at this time are extensively identical and meant to be identical to the MySqlDialect, I suggest they are kept aligned by using the same approach used with redshift and postgres and dispatch the method call to MySqlDialect. When they are strictly distinct, a comment with a documentation link may be desirable.

Comment thread tests/sqlparser_doris.rs Outdated
}

#[test]
fn doris_identifier_and_string_literal_gates() {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am unsure such a test is necessary

Comment thread tests/sqlparser_doris.rs Outdated

#[test]
fn parse_doris_strings_and_identifiers() {
doris().verified_stmt(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe here you may want to use verified_only_select

Comment thread tests/sqlparser_doris.rs Outdated

#[test]
fn doris_and_generic_parse_common_sql_identically() {
doris_and_generic().verified_stmt("SELECT 1 AS properties FROM t");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I imagine this will be more relevant in a later PR in this series where you add the keyword PROPERTIES?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I imagine this will be more relevant in a later PR in this series where you add the keyword PROPERTIES?

@LucaCappelletti94 sorry for the late reply. I've read all your comments here and try to improve these points. Could you take an another look plz?

@tempusari tempusari mentioned this pull request Aug 25, 2026
sabir-akhadov-localstack pushed a commit to localstack/datafusion-sqlparser-rs that referenced this pull request Aug 28, 2026
…ESC / GET_DDL (apache#2380)

* task LAV-1891: WIP — commit stranded agent work

* task LAV-1891: WIP — commit stranded agent work

* Task LAV-1891: emit queryContext + error positions for ALERT drop/desc/schedule/undrop
@codecov-commenter

codecov-commenter commented Sep 23, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.11%. Comparing base (560a13c) to head (d728af4).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2380      +/-   ##
==========================================
+ Coverage   81.09%   81.11%   +0.02%     
==========================================
  Files          42       43       +1     
  Lines       33684    33726      +42     
  Branches    33684    33726      +42     
==========================================
+ Hits        27316    27358      +42     
  Misses       2798     2798              
  Partials     3570     3570              

☔ 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.

@LucaCappelletti94 LucaCappelletti94 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should trim the description to what this PR contains. It still lists CREATE TABLE models, LOAD DATA INFILE, CREATE ROUTINE LOAD and new AST structures, none of which are in this diff.

Comment thread src/dialect/doris.rs
Comment thread tests/sqlparser_doris.rs
Comment thread src/dialect/doris.rs
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct DorisDialect {}

impl Dialect for DorisDialect {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should also add DorisDialect to the dialect arrays in fuzz/fuzz_targets/fuzz_parse_sql.rs and fuzz/fuzz_targets/fuzz_parse_roundtrip.rs, and bump the [&dyn Dialect; 16] length. Without that, Doris is the only dialect that is never fuzzed.

Comment thread src/dialect/doris.rs
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct DorisDialect {}

impl Dialect for DorisDialect {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should add a { label: "Doris", stems: ["doris"], pattern: /\bdoris\b/i } entry to DIALECTS in .github/workflows/labeler/label_dialects.js. Otherwise the follow-up PRs titled Doris: ... get no dialect label and the bot asks their author for one.

@LucaCappelletti94 LucaCappelletti94 added the waiting on contributor The review needs further refinements by its author label Sep 24, 2026
finchxxia and others added 2 commits September 28, 2026 08:58
Co-authored-by: Luca Cappelletti <cappelletti.luca94@gmail.com>
Co-authored-by: Luca Cappelletti <cappelletti.luca94@gmail.com>
@github-actions github-actions Bot added the MySQL label Sep 28, 2026
@LucaCappelletti94 LucaCappelletti94 removed the waiting on contributor The review needs further refinements by its author label Sep 28, 2026
@LucaCappelletti94 LucaCappelletti94 added the waiting on reviewer PR needs to be reviewed label Sep 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

MySQL waiting on reviewer PR needs to be reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants