mirror of
https://github.com/apache/superset.git
synced 2026-07-18 20:55:47 +00:00
sqlglot cannot parse Trino SQL routine syntax, so queries declaring inline UDFs failed to parse in SQL Lab: the parser splits statements on every semicolon (including the ones inside BEGIN ... END routine bodies) and has no grammar for FUNCTION specifications in a WITH clause. The upstream issue (tobymao/sqlglot#5178) was closed as low priority, so this extends the Trino dialect on the Superset side. The custom dialect keeps routine bodies intact when splitting statements and parses inline function specifications into opaque InlineUDF nodes that regenerate verbatim. Trino does not allow queries inside SQL UDF bodies, so the opaque representation hides no table references from Superset's security checks. The extensions only activate on syntax that fails to parse today, so existing queries are unaffected. Fixes #26162 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>