bito-code-review[bot] commented on code in PR #41580:
URL: https://github.com/apache/superset/pull/41580#discussion_r3498748192
##########
superset/daos/datasource.py:
##########
@@ -130,6 +135,30 @@ def build_dataset_query(
if database_id is not None:
ds_q = ds_q.where(SqlaTable.database_id == database_id)
+ if schema_filter is not None:
+ ds_q = ds_q.where(SqlaTable.schema == schema_filter)
+
+ if owners_filter is not None:
+ ds_q = ds_q.join(
+ sqla_models.sqlatable_user,
+ sqla_models.sqlatable_user.c.table_id == ds_table.c.id,
+ ).where(sqla_models.sqlatable_user.c.user_id.in_(owners_filter))
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>Duplicate rows from owner join</b></div>
<div id="fix">
The `owners_filter` join on `sqla_models.sqlatable_user` can produce
duplicate dataset rows when a table has multiple owners, since the SELECT lacks
GROUP BY or DISTINCT. This may cause incorrect pagination or result duplication
unless caller deduplicates.
</div>
</div>
<small><i>Code Review Run #579160</i></small>
</div>
---
Should Bito avoid suggestions like this for future reviews? (<a
href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
- [ ] Yes, avoid them
--
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]