bito-code-review[bot] commented on PR #42899:
URL: https://github.com/apache/superset/pull/42899#issuecomment-5221884097
<!-- Bito Reply -->
The flagged issue is correct. The `offset_before_limit` flag is currently
defined on `PrestoBaseEngineSpec`, which is inherited by `HiveEngineSpec` and
its descendants (`SparkEngineSpec`, `DatabricksHiveEngineSpec`). This causes
unnecessary SQL re-parsing for these engines, which do not require the `OFFSET`
before `LIMIT` reordering.
To resolve this, you should move the flag definition from
`PrestoBaseEngineSpec` to `PrestoEngineSpec` and `TrinoEngineSpec`
specifically, or explicitly set `offset_before_limit = False` in
`HiveEngineSpec`.
### Proposed Fix
1. **In `superset/db_engine_specs/presto.py`:** Remove the flag from
`PrestoBaseEngineSpec` and add it to the specific engine classes.
2. **In `superset/db_engine_specs/hive.py`:** Explicitly set
`offset_before_limit = False` to ensure descendants inherit the correct
behavior.
Would you like me to fetch all other comments on this PR to validate and
implement fixes for them as well?
**superset/db_engine_specs/presto.py**
```
class PrestoBaseEngineSpec(BaseEngineSpec, metaclass=ABCMeta):
# ...
# Remove offset_before_limit = True from here
class PrestoEngineSpec(PrestoBaseEngineSpec):
offset_before_limit = True
class TrinoEngineSpec(PrestoBaseEngineSpec):
offset_before_limit = True
```
--
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]