Skip to content

fix: support parsing Doris REFRESH MATERIALIZED VIEW, CLEAN PROFILE, and CREATE EXTERNAL RESOURCE#38557

Open
daguimu wants to merge 1 commit intoapache:masterfrom
daguimu:fix/doris-sql-parsing-31457
Open

fix: support parsing Doris REFRESH MATERIALIZED VIEW, CLEAN PROFILE, and CREATE EXTERNAL RESOURCE#38557
daguimu wants to merge 1 commit intoapache:masterfrom
daguimu:fix/doris-sql-parsing-31457

Conversation

@daguimu
Copy link
Copy Markdown

@daguimu daguimu commented Mar 25, 2026

Problem

ShardingSphere's Doris SQL parser does not support parsing the following SQL statements:

  • REFRESH MATERIALIZED VIEW mv1 AUTO
  • REFRESH MATERIALIZED VIEW mv1 COMPLETE
  • REFRESH MATERIALIZED VIEW mv1 PARTITIONS(p1, p2)
  • CLEAN PROFILE
  • CREATE EXTERNAL RESOURCE "name" PROPERTIES (...)

These are valid Doris SQL statements documented in the Doris official documentation.

Root Cause

The ANTLR grammar rules for these Doris-specific SQL statements were not defined in the parser.

Fix

Added complete parsing support including:

Grammar Changes

  • DorisKeyword.g4: Added EXTERNAL keyword
  • DDLStatement.g4: Added dorisRefreshMaterializedView rule with partitionSpec, COMPLETE, and AUTO variants
  • DALStatement.g4: Added cleanProfile and createExternalResource rules
  • DorisStatement.g4: Registered new rules in the execute block

Visitor & Statement Classes

  • DorisRefreshMaterializedViewStatement (DDL)
  • DorisCleanProfileStatement (DAL)
  • DorisCreateExternalResourceStatement (DAL)
  • Corresponding visitor methods in DorisDALStatementVisitor and DorisDDLStatementVisitor
  • SQLVisitorRule entries for all new statements

Tests Added

  • doris_refresh_materialized_view_auto - Tests REFRESH MATERIALIZED VIEW mv1 AUTO
  • doris_refresh_materialized_view_complete - Tests REFRESH MATERIALIZED VIEW mv1 COMPLETE
  • doris_refresh_materialized_view_partitions - Tests REFRESH MATERIALIZED VIEW mv1 PARTITIONS(p1, p2)
  • clean_profile - Tests CLEAN PROFILE
  • create_external_resource_spark - Tests CREATE EXTERNAL RESOURCE with Spark properties
  • create_external_resource_odbc - Tests CREATE EXTERNAL RESOURCE with ODBC properties
  • Test case classes, assert classes, and XML test definitions for all cases

Impact

Only affects Doris SQL parsing. No changes to other database dialects or core functionality.

Fixes #31457

…and CREATE EXTERNAL RESOURCE SQL

Add ANTLR grammar rules, visitor implementations, statement classes, and test
cases for the following Doris SQL statements:
- REFRESH MATERIALIZED VIEW with AUTO, COMPLETE, and PARTITIONS variants
- CLEAN PROFILE keyword
- CREATE EXTERNAL RESOURCE with PROPERTIES clause

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support parsing Doris sql

1 participant