rusackas opened a new pull request, #40138: URL: https://github.com/apache/superset/pull/40138
### SUMMARY This is a **test-only PR** opened as a TDD-style validation of issue #25659. #25659 (filed 2023-10) reports that saving a virtual dataset built from a SELECT with a WITH clause containing UNION fails on Oracle with \`Only \`SELECT\` statements are allowed\`. The parser was misclassifying the WITH+UNION construct as DML. This PR adds two regression tests on \`SQLScript.has_mutation()\`: 1. **\`test_with_clause_containing_union_is_not_mutating\`** — parameterized across \`oracle\`, \`postgresql\`, \`trino\`, \`presto\`, \`hive\`, \`base\`. Multiple dialects because sqlglot's per-dialect AST shape can diverge: a fix touching only one dialect leaves the others exposed. 2. **\`test_with_clause_containing_union_all_is_not_mutating_oracle\`** — pins the exact verbatim repro from the bug report (\`SYSDATE FROM DUAL UNION SELECT SYSDATE FROM DUAL\`), guarding against an Oracle-specific regression that a generic test might miss. Existing \`test_has_mutation\` cases cover bare WITH+SELECT and bare UNION, but not their combination — exactly the gap #25659 sits in. ### How to interpret CI - **CI green** → WITH+UNION is correctly classified as non-mutating across all tested dialects; merging closes #25659 and locks in the regression guards. - **CI red** → bug is still live in at least one dialect. Likely fix: in \`superset/sql/parse.py:670\`, the \`is_mutating()\` heuristic needs to traverse CTE bodies more carefully so a UNION inside a \`WITH\` doesn't trip the DML detection. ### TESTING INSTRUCTIONS \`\`\`bash pytest tests/unit_tests/sql/parse_tests.py::test_with_clause_containing_union_is_not_mutating -v pytest tests/unit_tests/sql/parse_tests.py::test_with_clause_containing_union_all_is_not_mutating_oracle -v \`\`\` ### ADDITIONAL INFORMATION - [ ] Has associated issue: closes #25659 - [ ] Required feature flags: - [ ] Changes UI - [ ] Includes DB Migration - [ ] Introduces new feature or API - [ ] Removes existing feature or API 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- 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]
