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

rusackas pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git


The following commit(s) were added to refs/heads/master by this push:
     new 319ebbeaeb2 chore(deps): bump sqlglot from 30.24.0 to 30.31.0 (#46207)
319ebbeaeb2 is described below

commit 319ebbeaeb23e2e44c7a674e0b850cbefa6ad37a
Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
AuthorDate: Mon Nov 16 05:55:09 2026 -0800

    chore(deps): bump sqlglot from 30.24.0 to 30.31.0 (#46207)
    
    Signed-off-by: dependabot[bot] <[email protected]>
    Signed-off-by: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
    Co-authored-by: dependabot[bot] 
<49699333+dependabot[bot]@users.noreply.github.com>
    Co-authored-by: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
    Co-authored-by: Evan Rusackas <[email protected]>
    Co-authored-by: Evan Rusackas <[email protected]>
    Co-authored-by: Claude Sonnet 5.5 <[email protected]>
---
 pyproject.toml                      |  2 +-
 requirements/base.txt               |  2 +-
 requirements/development.txt        |  2 +-
 superset/sql/dialects/databend.py   |  4 ++++
 superset/sql/dialects/pinot.py      |  9 +++++++-
 superset/sql/dialects/starrocks.py  | 41 -------------------------------------
 superset/sql/parse.py               |  4 +++-
 tests/unit_tests/sql/parse_tests.py | 20 ++++++++----------
 8 files changed, 26 insertions(+), 58 deletions(-)

diff --git a/pyproject.toml b/pyproject.toml
index 76145513fe0..a2a74f1cbcd 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -115,7 +115,7 @@ dependencies = [
     # Dialect-specific gaps/bugs against this pin are worked around in
     # superset/sql/dialects/ (e.g. starrocks.py); check there for anything
     # that can be cleaned up when bumping
-    "sqlglot>=30.23.0, <31", # 30.16.0 adds Trino inline UDF IF/CASE routine 
statement parsing
+    "sqlglot>=30.31.0, <31", # 30.16.0 adds Trino inline UDF IF/CASE routine 
statement parsing
     # newer pandas needs 0.9+
     "tabulate>=0.10.0, <1.0",
     "typing-extensions>=4.16.0, <5",
diff --git a/requirements/base.txt b/requirements/base.txt
index 743ba247946..dab7b4d9333 100644
--- a/requirements/base.txt
+++ b/requirements/base.txt
@@ -392,7 +392,7 @@ sqlalchemy-utils==0.43.0
     #   apache-superset (pyproject.toml)
     #   apache-superset-core
     #   flask-appbuilder
-sqlglot==30.24.0
+sqlglot==30.31.0
     # via
     #   apache-superset (pyproject.toml)
     #   apache-superset-core
diff --git a/requirements/development.txt b/requirements/development.txt
index 62d2afa4d5b..f879ce84053 100644
--- a/requirements/development.txt
+++ b/requirements/development.txt
@@ -1109,7 +1109,7 @@ sqlalchemy-utils==0.43.0
     #   apache-superset
     #   apache-superset-core
     #   flask-appbuilder
-sqlglot==30.24.0
+sqlglot==30.31.0
     # via
     #   -c requirements/base-constraint.txt
     #   apache-superset
diff --git a/superset/sql/dialects/databend.py 
b/superset/sql/dialects/databend.py
index 4cd1502c5ba..67511f4d84a 100644
--- a/superset/sql/dialects/databend.py
+++ b/superset/sql/dialects/databend.py
@@ -101,6 +101,10 @@ LEFT_UNPARSED = {
     # interval. Postgres renders the node as TIMESTAMPDIFF, which is not a
     # name Databend has, so its own spelling is kept instead.
     "TIMESTAMP_DIFF",
+    # Postgres' REGEXP_REPLACE takes a replacement; newer sqlglot pads a 
missing
+    # one with '' on generation, so the call gains an argument the caller never
+    # wrote. Left unparsed, the arguments reach the server exactly as written.
+    "REGEXP_REPLACE",
 }
 
 
diff --git a/superset/sql/dialects/pinot.py b/superset/sql/dialects/pinot.py
index 6344fee4a0d..398aa2377fd 100644
--- a/superset/sql/dialects/pinot.py
+++ b/superset/sql/dialects/pinot.py
@@ -53,7 +53,14 @@ class Pinot(MySQL):
 
     class Parser(MySQL.Parser):
         FUNCTIONS = {
-            **MySQL.Parser.FUNCTIONS,
+            **{
+                name: func
+                for name, func in MySQL.Parser.FUNCTIONS.items()
+                # MySQL's TIMESTAMPADD(unit, n, ts) is generated back as
+                # DATE_ADD(ts, INTERVAL n unit), which Pinot does not accept;
+                # leaving it anonymous keeps Pinot's own call shape.
+                if name != "TIMESTAMPADD"
+            },
             "DATE_ADD": lambda args: exp.DateAdd(
                 this=seq_get(args, 2),
                 expression=seq_get(args, 1),
diff --git a/superset/sql/dialects/starrocks.py 
b/superset/sql/dialects/starrocks.py
index 1f22bd72f2f..1de9d37327a 100644
--- a/superset/sql/dialects/starrocks.py
+++ b/superset/sql/dialects/starrocks.py
@@ -675,47 +675,6 @@ class StarRocksParser(_StarRocksParser):
             )
         )
 
-    def _parse_statement(self) -> exp.Expr | None:
-        # `ADD SQLBLACKLIST|BACKEND BLACKLIST|COMPUTE NODE BLACKLIST` and the
-        # matching `DELETE ...` forms manage cluster-wide denylists. ADD and
-        # DELETE already have dedicated meanings elsewhere in the grammar
-        # (ALTER TABLE ADD ..., the DML DELETE statement), so -- unlike the
-        # keywords in _STARROCKS_COMMAND_KEYWORDS -- they can't be remapped to
-        # TokenType.COMMAND outright; this peeks for the specific StarRocks
-        # phrasing instead and only then treats it as an opaque command.
-        # 
https://docs.starrocks.io/docs/sql-reference/sql-statements/cluster-management/sql_blacklist/
-        # 
https://docs.starrocks.io/docs/administration/management/BE_blacklist/
-        if self._match_texts(("ADD", "DELETE"), advance=False):
-            index = self._index
-            start = self._curr
-            self._advance()
-            is_blacklist_command = (
-                self._match_text_seq("SQLBLACKLIST")
-                or self._match_text_seq("BACKEND", "BLACKLIST")
-                or self._match_text_seq("COMPUTE", "NODE", "BLACKLIST")
-            )
-            self._retreat(index)
-
-            if is_blacklist_command:
-                self._advance()
-                return self._parse_as_command(start)
-
-        # `TRANSLATE TRINO <select_statement>` translates a Trino SELECT into
-        # StarRocks SQL and returns it as a result set -- a read, not a
-        # mutation. Like ADD/DELETE above, this can't be remapped to
-        # TokenType.COMMAND outright: TRANSLATE is also the ordinary
-        # TRANSLATE(string, from, to) scalar function, and mapping the
-        # keyword globally would corrupt every call to it anywhere in a
-        # query, not just at statement start. Peeking for the literal
-        # two-word phrase is safe because a bare `TRANSLATE(...)` call can
-        # never be the first token of a top-level statement on its own --
-        # it only ever appears nested inside an expression.
-        # 
https://docs.starrocks.io/docs/sql-reference/sql-statements/TRANSLATE_TRINO/
-        if self._match_text_seq("TRANSLATE", "TRINO", advance=False):
-            return self._parse_as_command(self._curr)
-
-        return super()._parse_statement()
-
 
 class StarRocksGenerator(_StarRocksGenerator):
     # sqlglot's SQLStatement.format()/SQLScript.format() -- used both for
diff --git a/superset/sql/parse.py b/superset/sql/parse.py
index 65d94e6e20e..1db8c00b2b3 100644
--- a/superset/sql/parse.py
+++ b/superset/sql/parse.py
@@ -2212,7 +2212,9 @@ class SQLStatement(BaseSQLStatement[exp.Expression]):
         if isinstance(self._parsed, exp.Command):
             command_name = self._parsed.name.upper()
 
-            if command_name in self._MUTATING_COMMAND_NAMES:
+            # Newer sqlglot releases fold multi-word heads into ``name``
+            # (e.g. ``ADD SQLBLACKLIST``), so match on the leading keyword.
+            if command_name.partition(" ")[0] in self._MUTATING_COMMAND_NAMES:
                 return True
 
             if (
diff --git a/tests/unit_tests/sql/parse_tests.py 
b/tests/unit_tests/sql/parse_tests.py
index 95eace37843..698a9928ec8 100644
--- a/tests/unit_tests/sql/parse_tests.py
+++ b/tests/unit_tests/sql/parse_tests.py
@@ -3978,25 +3978,21 @@ def test_show_binlog_events_in_log_name_still_parses() 
-> None:
         "SUBMIT TASK etl0 AS CREATE TABLE tbl1 AS SELECT * FROM src_tbl",
         "SUBMIT TASK AS INSERT OVERWRITE tbl2 SELECT * FROM src_tbl",
         "DEALLOCATE PREPARE select_by_id_stmt",
-        # StarRocks blacklist management. ADD/DELETE already mean something
-        # else in the grammar (ALTER TABLE ADD ..., the DML DELETE
-        # statement), so these need the specific-phrase peek in
-        # `_parse_statement`, not a blanket keyword remap.
+        # StarRocks blacklist management. sqlglot tokenizes these multi-word
+        # heads as a single COMMAND token.
         'ADD SQLBLACKLIST "select count(*) from .+"',
         "DELETE SQLBLACKLIST 3, 4",
         "ADD BACKEND BLACKLIST 10001",
         "DELETE BACKEND BLACKLIST 10001",
         "ADD COMPUTE NODE BLACKLIST 10005",
-        # Ordinary ADD/DELETE must be unaffected by the blacklist peek.
+        # Ordinary ADD/DELETE must be unaffected by the blacklist commands.
         "ALTER TABLE t ADD COLUMN c INT",
         "DELETE FROM my_table WHERE k1 = 3",
-        # TRANSLATE TRINO translates a Trino SELECT into StarRocks SQL. Like
-        # ADD/DELETE, TRANSLATE can't be remapped to TokenType.COMMAND
-        # outright -- it also names the ordinary TRANSLATE(string, from, to)
-        # scalar function -- so this needs the same specific-phrase peek.
+        # TRANSLATE TRINO translates a Trino SELECT into StarRocks SQL; sqlglot
+        # tokenizes the two-word head as a COMMAND.
         "TRANSLATE TRINO SELECT 1",
         "TRANSLATE TRINO SELECT id, name FROM products WHERE category = 
'Electronics'",
-        # Ordinary use of the scalar function must be unaffected by the peek.
+        # Ordinary use of the scalar function must be unaffected.
         "SELECT TRANSLATE(col, 'a', 'b') FROM t",
     ],
 )
@@ -4320,12 +4316,12 @@ def 
test_starrocks_create_alter_table_clauses_parse(sql: str) -> None:
             'ADMIN SET FRONTEND CONFIG ("disable_balance" = "true")',
             True,
         ),
-        # StarRocks blacklist management via the ADD/DELETE peek.
+        # StarRocks blacklist management as COMMAND statements.
         ('ADD SQLBLACKLIST "select count(*) from .+"', True),
         ("DELETE SQLBLACKLIST 3, 4", True),
         ("ADD BACKEND BLACKLIST 10001", True),
         ("DELETE BACKEND BLACKLIST 10001", True),
-        # Ordinary DELETE (and the ADD/DELETE peek generally) must not
+        # Ordinary DELETE must not
         # misclassify unrelated statements.
         ("DELETE FROM my_table WHERE k1 = 3", True),
         ("DELETE FROM my_table PARTITION p1 WHERE k1 = 3", True),

Reply via email to