Adds unit tests for the two Trino dialect branches the CI coverage gate
flagged as untested: a RETURN body with no following expression, and a
statement-terminating semicolon that carries an attached comment or has
no trailing statement.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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>