sadpandajoe commented on code in PR #42733:
URL: https://github.com/apache/superset/pull/42733#discussion_r3739988396


##########
tests/unit_tests/sql/parse_tests.py:
##########
@@ -938,6 +938,27 @@ def test_sqlscript() -> None:
     assert query.get_settings() == {"querytrace": True}
 
 
+def test_sqlscript_format_preserves_optimizer_hint_block() -> None:
+    """
+    Regression for #38189: an inline `--` comment trailing a query with a
+    `/*+ SET_VAR(...) */` optimizer hint must not get repositioned inside
+    the hint block during `format()` -- that would corrupt the hint syntax
+    (StarRocks and other engines using the `/*+ ... */` convention reject
+    a nested `/* */` inside it). `format()` is what Superset's execution
+    path actually sends to the engine (see `executor.py`/`celery_task.py`).
+    """
+    sql = """SELECT /*+ SET_VAR(query_timeout = 3000) */ col1, col2
+FROM my_table
+LIMIT 100

Review Comment:
   This omits the terminating semicolon that reaches the still-broken 
relocation branch: with `LIMIT 100;`, this head formats the query as 
`SET_VAR(query_timeout /* ... */ = 3000)`, reproducing #38189 and yielding 
invalid StarRocks SQL. Could this cover the semicolon form and keep the issue 
open until that path is fixed?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to