codeant-ai-for-open-source[bot] commented on code in PR #42899:
URL: https://github.com/apache/superset/pull/42899#discussion_r3738692031


##########
superset/db_engine_specs/presto.py:
##########
@@ -167,6 +167,13 @@ class PrestoBaseEngineSpec(BaseEngineSpec, 
metaclass=ABCMeta):
     supports_dynamic_schema = True
     supports_catalog = supports_dynamic_catalog = 
supports_cross_catalog_queries = True
 
+    # Presto and Trino require OFFSET to appear before LIMIT in the SQL 
grammar.
+    # Superset normalizes compiled SQL accordingly so pagination works even 
when
+    # the connection resolves to a driver whose dialect emits the ANSI
+    # ``LIMIT ... OFFSET`` ordering (e.g. PyHive). See
+    # ``BaseEngineSpec.apply_offset_before_limit``.
+    offset_before_limit = True

Review Comment:
   **Suggestion:** The flag is defined on `PrestoBaseEngineSpec`, but 
`HiveEngineSpec` inherits `PrestoEngineSpec`, and `SparkEngineSpec` and 
`DatabricksHiveEngineSpec` inherit `HiveEngineSpec`. Consequently, every 
compiled Hive, Spark, and Databricks Interactive Cluster query with `LIMIT` and 
`OFFSET` is reparsed and regenerated using that engine's sqlglot dialect, even 
though this change is intended only for Presto and Trino. This can rewrite 
valid engine-specific SQL or alter function semantics; define the flag only on 
`PrestoEngineSpec` and `TrinoEngineSpec`, or explicitly disable it on the 
Hive-family descendants. [api mismatch]
   
   <details>
   <summary><b>Severity Level:</b> Major ⚠️</summary>
   
   ```mdx
   - ⚠️ Hive pagination queries receive unintended SQL reformatting.
   - ⚠️ Spark pagination queries use the shared normalization path.
   - ⚠️ Databricks interactive-cluster SQL is reparsed unnecessarily.
   ```
   </details>
   
   [![Fix in 
Cursor](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-cursor-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=d7a50a01acb14b71b1d661b927f28d31&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
 [![Fix in VSCode 
Claude](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-vscode-claude-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=d7a50a01acb14b71b1d661b927f28d31&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
   
   *(Use Cmd/Ctrl + Click for best experience)*
   <details>
   <summary><b>Prompt for AI Agent 🤖 </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** superset/db_engine_specs/presto.py
   **Line:** 170:175
   **Comment:**
        *Api Mismatch: The flag is defined on `PrestoBaseEngineSpec`, but 
`HiveEngineSpec` inherits `PrestoEngineSpec`, and `SparkEngineSpec` and 
`DatabricksHiveEngineSpec` inherit `HiveEngineSpec`. Consequently, every 
compiled Hive, Spark, and Databricks Interactive Cluster query with `LIMIT` and 
`OFFSET` is reparsed and regenerated using that engine's sqlglot dialect, even 
though this change is intended only for Presto and Trino. This can rewrite 
valid engine-specific SQL or alter function semantics; define the flag only on 
`PrestoEngineSpec` and `TrinoEngineSpec`, or explicitly disable it on the 
Hive-family descendants.
   
   Validate the correctness of the flagged issue. If correct, How can I resolve 
this? If you propose a fix, implement it and please make it concise.
   Once fix is implemented, also check other comments on the same PR, and ask 
user if the user wants to fix the rest of the comments as well. if said yes, 
then fetch all the comments validate the correctness and implement a minimal fix
   ```
   </details>
   <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F42899&comment_hash=ab03574914149308491074499639b8a88d420f33fe7843bd8ea51aa2f392be3b&reaction=like'>👍</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F42899&comment_hash=ab03574914149308491074499639b8a88d420f33fe7843bd8ea51aa2f392be3b&reaction=dislike'>👎</a>



-- 
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