You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datafusion.apache.org by gi...@apache.org on 2026/05/15 07:22:22 UTC

(datafusion-sqlparser-rs) branch gh-readonly-queue/main/pr-2302-7c78d138ae4b69359ad38b0996eda7de5e1a356b created (now ab8e6ada)

This is an automated email from the ASF dual-hosted git repository.

github-merge-queue[bot] pushed a change to branch gh-readonly-queue/main/pr-2302-7c78d138ae4b69359ad38b0996eda7de5e1a356b
in repository https://gitbox.apache.org/repos/asf/datafusion-sqlparser-rs.git


      at ab8e6ada Add ASYNC keyword support for CREATE INDEX (#2302)

This branch includes the following new commits:

     new ab8e6ada Add ASYNC keyword support for CREATE INDEX (#2302)

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datafusion.apache.org
For additional commands, e-mail: commits-help@datafusion.apache.org


(datafusion-sqlparser-rs) 01/01: Add ASYNC keyword support for CREATE INDEX (#2302)

Posted by gi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

github-merge-queue[bot] pushed a commit to branch gh-readonly-queue/main/pr-2302-7c78d138ae4b69359ad38b0996eda7de5e1a356b
in repository https://gitbox.apache.org/repos/asf/datafusion-sqlparser-rs.git

commit ab8e6adade1568ee7e40a60f1548ba6a070f1e21
Author: Aleksandar Maksimovic <am...@hotmail.com>
AuthorDate: Fri May 15 00:21:57 2026 -0700

    Add ASYNC keyword support for CREATE INDEX (#2302)
    
    Co-authored-by: Ifeanyi Ubah <if...@yahoo.com>
---
 src/ast/ddl.rs              |  7 ++++++-
 src/ast/spans.rs            |  1 +
 src/keywords.rs             |  1 +
 src/parser/mod.rs           |  2 ++
 tests/sqlparser_common.rs   | 10 ++++++++++
 tests/sqlparser_postgres.rs | 18 ++++++++++++++++++
 6 files changed, 38 insertions(+), 1 deletion(-)

diff --git a/src/ast/ddl.rs b/src/ast/ddl.rs
index 0a93f5b7..da348e3a 100644
--- a/src/ast/ddl.rs
+++ b/src/ast/ddl.rs
@@ -2817,6 +2817,10 @@ pub struct CreateIndex {
     pub unique: bool,
     /// whether the index is created concurrently
     pub concurrently: bool,
+    /// whether the index is created asynchronously ([DSQL]).
+    ///
+    /// [DSQL]: https://docs.aws.amazon.com/aurora-dsql/latest/userguide/working-with-create-index-async.html
+    pub r#async: bool,
     /// IF NOT EXISTS clause
     pub if_not_exists: bool,
     /// INCLUDE clause: <https://www.postgresql.org/docs/current/sql-createindex.html>
@@ -2842,13 +2846,14 @@ impl fmt::Display for CreateIndex {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         write!(
             f,
-            "CREATE {unique}INDEX {concurrently}{if_not_exists}",
+            "CREATE {unique}INDEX {concurrently}{async_}{if_not_exists}",
             unique = if self.unique { "UNIQUE " } else { "" },
             concurrently = if self.concurrently {
                 "CONCURRENTLY "
             } else {
                 ""
             },
+            async_ = if self.r#async { "ASYNC " } else { "" },
             if_not_exists = if self.if_not_exists {
                 "IF NOT EXISTS "
             } else {
diff --git a/src/ast/spans.rs b/src/ast/spans.rs
index f6ba8954..81d75b7c 100644
--- a/src/ast/spans.rs
+++ b/src/ast/spans.rs
@@ -694,6 +694,7 @@ impl Spanned for CreateIndex {
             columns,
             unique: _,        // bool
             concurrently: _,  // bool
+            r#async: _,       // bool
             if_not_exists: _, // bool
             include,
             nulls_distinct: _, // bool
diff --git a/src/keywords.rs b/src/keywords.rs
index a0a65be6..8c846017 100644
--- a/src/keywords.rs
+++ b/src/keywords.rs
@@ -131,6 +131,7 @@ define_keywords!(
     ASOF,
     ASSERT,
     ASYMMETRIC,
+    ASYNC,
     AT,
     ATOMIC,
     ATTACH,
diff --git a/src/parser/mod.rs b/src/parser/mod.rs
index 07497b04..9655a580 100644
--- a/src/parser/mod.rs
+++ b/src/parser/mod.rs
@@ -8043,6 +8043,7 @@ impl<'a> Parser<'a> {
     /// Parse a `CREATE INDEX` statement.
     pub fn parse_create_index(&mut self, unique: bool) -> Result<CreateIndex, ParserError> {
         let concurrently = self.parse_keyword(Keyword::CONCURRENTLY);
+        let r#async = self.parse_keyword(Keyword::ASYNC);
         let if_not_exists = self.parse_keywords(&[Keyword::IF, Keyword::NOT, Keyword::EXISTS]);
 
         let mut using = None;
@@ -8122,6 +8123,7 @@ impl<'a> Parser<'a> {
             columns,
             unique,
             concurrently,
+            r#async,
             if_not_exists,
             include,
             nulls_distinct,
diff --git a/tests/sqlparser_common.rs b/tests/sqlparser_common.rs
index 326fbf67..b36998bf 100644
--- a/tests/sqlparser_common.rs
+++ b/tests/sqlparser_common.rs
@@ -9626,6 +9626,7 @@ fn test_create_index_with_using_function() {
             columns,
             unique,
             concurrently,
+            r#async,
             if_not_exists,
             include,
             nulls_distinct: None,
@@ -9640,6 +9641,7 @@ fn test_create_index_with_using_function() {
             assert_eq!(indexed_columns, columns);
             assert!(unique);
             assert!(!concurrently);
+            assert!(!r#async);
             assert!(if_not_exists);
             assert!(include.is_empty());
             assert!(with.is_empty());
@@ -9681,6 +9683,7 @@ fn test_create_index_with_with_clause() {
             columns,
             unique,
             concurrently,
+            r#async,
             if_not_exists,
             include,
             nulls_distinct: None,
@@ -9694,6 +9697,7 @@ fn test_create_index_with_with_clause() {
             pretty_assertions::assert_eq!(indexed_columns, columns);
             assert!(unique);
             assert!(!concurrently);
+            assert!(!r#async);
             assert!(!if_not_exists);
             assert!(include.is_empty());
             pretty_assertions::assert_eq!(with_parameters, with);
@@ -9704,6 +9708,12 @@ fn test_create_index_with_with_clause() {
     }
 }
 
+#[test]
+fn parse_create_index_async() {
+    verified_stmt("CREATE INDEX ASYNC my_index ON my_table(col1)");
+    verified_stmt("CREATE UNIQUE INDEX ASYNC my_index ON my_table(col1)");
+}
+
 #[test]
 fn parse_drop_index() {
     let sql = "DROP INDEX idx_a";
diff --git a/tests/sqlparser_postgres.rs b/tests/sqlparser_postgres.rs
index 11e76dbc..274988be 100644
--- a/tests/sqlparser_postgres.rs
+++ b/tests/sqlparser_postgres.rs
@@ -2806,6 +2806,7 @@ fn parse_create_index() {
             columns,
             unique,
             concurrently,
+            r#async,
             if_not_exists,
             nulls_distinct: None,
             include,
@@ -2819,6 +2820,7 @@ fn parse_create_index() {
             assert_eq!(None, using);
             assert!(!unique);
             assert!(!concurrently);
+            assert!(!r#async);
             assert!(if_not_exists);
             assert_eq_vec(&["col1", "col2"], &columns);
             assert!(include.is_empty());
@@ -2841,6 +2843,7 @@ fn parse_create_anonymous_index() {
             columns,
             unique,
             concurrently,
+            r#async,
             if_not_exists,
             include,
             nulls_distinct: None,
@@ -2854,6 +2857,7 @@ fn parse_create_anonymous_index() {
             assert_eq!(None, using);
             assert!(!unique);
             assert!(!concurrently);
+            assert!(!r#async);
             assert!(!if_not_exists);
             assert_eq_vec(&["col1", "col2"], &columns);
             assert!(include.is_empty());
@@ -2959,6 +2963,7 @@ fn parse_create_indices_with_operator_classes() {
                     columns,
                     unique: false,
                     concurrently: false,
+                    r#async: false,
                     if_not_exists: false,
                     include,
                     nulls_distinct: None,
@@ -2987,6 +2992,7 @@ fn parse_create_indices_with_operator_classes() {
                     columns,
                     unique: false,
                     concurrently: false,
+                    r#async: false,
                     if_not_exists: false,
                     include,
                     nulls_distinct: None,
@@ -3070,6 +3076,7 @@ fn parse_create_bloom() {
             columns,
             unique: false,
             concurrently: false,
+            r#async: false,
             if_not_exists: false,
             include,
             nulls_distinct: None,
@@ -3126,6 +3133,7 @@ fn parse_create_brin() {
             columns,
             unique: false,
             concurrently: false,
+            r#async: false,
             if_not_exists: false,
             include,
             nulls_distinct: None,
@@ -3193,6 +3201,7 @@ fn parse_create_index_concurrently() {
             columns,
             unique,
             concurrently,
+            r#async,
             if_not_exists,
             include,
             nulls_distinct: None,
@@ -3206,6 +3215,7 @@ fn parse_create_index_concurrently() {
             assert_eq!(None, using);
             assert!(!unique);
             assert!(concurrently);
+            assert!(!r#async);
             assert!(if_not_exists);
             assert_eq_vec(&["col1", "col2"], &columns);
             assert!(include.is_empty());
@@ -3228,6 +3238,7 @@ fn parse_create_index_with_predicate() {
             columns,
             unique,
             concurrently,
+            r#async,
             if_not_exists,
             include,
             nulls_distinct: None,
@@ -3241,6 +3252,7 @@ fn parse_create_index_with_predicate() {
             assert_eq!(None, using);
             assert!(!unique);
             assert!(!concurrently);
+            assert!(!r#async);
             assert!(if_not_exists);
             assert_eq_vec(&["col1", "col2"], &columns);
             assert!(include.is_empty());
@@ -3263,6 +3275,7 @@ fn parse_create_index_with_include() {
             columns,
             unique,
             concurrently,
+            r#async,
             if_not_exists,
             include,
             nulls_distinct: None,
@@ -3276,6 +3289,7 @@ fn parse_create_index_with_include() {
             assert_eq!(None, using);
             assert!(!unique);
             assert!(!concurrently);
+            assert!(!r#async);
             assert!(if_not_exists);
             assert_eq_vec(&["col1", "col2"], &columns);
             assert_eq_vec(&["col3", "col4"], &include);
@@ -3298,6 +3312,7 @@ fn parse_create_index_with_nulls_distinct() {
             columns,
             unique,
             concurrently,
+            r#async,
             if_not_exists,
             include,
             nulls_distinct: Some(nulls_distinct),
@@ -3311,6 +3326,7 @@ fn parse_create_index_with_nulls_distinct() {
             assert_eq!(None, using);
             assert!(!unique);
             assert!(!concurrently);
+            assert!(!r#async);
             assert!(if_not_exists);
             assert_eq_vec(&["col1", "col2"], &columns);
             assert!(include.is_empty());
@@ -3331,6 +3347,7 @@ fn parse_create_index_with_nulls_distinct() {
             columns,
             unique,
             concurrently,
+            r#async,
             if_not_exists,
             include,
             nulls_distinct: Some(nulls_distinct),
@@ -3344,6 +3361,7 @@ fn parse_create_index_with_nulls_distinct() {
             assert_eq!(None, using);
             assert!(!unique);
             assert!(!concurrently);
+            assert!(!r#async);
             assert!(if_not_exists);
             assert_eq_vec(&["col1", "col2"], &columns);
             assert!(include.is_empty());


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datafusion.apache.org
For additional commands, e-mail: commits-help@datafusion.apache.org