bito-code-review[bot] commented on code in PR #38174:
URL: https://github.com/apache/superset/pull/38174#discussion_r2844512953
##########
superset/sql/parse.py:
##########
@@ -321,6 +321,37 @@ def qualify(
)
+@dataclass(eq=True, frozen=True)
+class Partition:
+ """
+ Partition object, with two attribute keys:
+ ispartitioned_table and partition_comlumn,
+ used to provide partition information
+ Here is an example of an object:
+ {"ispartitioned_table":true,"partition_column":["month","day"]}
+ """
+
+ is_partitioned_table: bool
+ partition_column: list[str] | None = None
+
+ def __str__(self) -> str:
+ """
+ Return the partition columns of table name.
+ """
+ partition_column_str = (
+ ", ".join(map(str, self.partition_column))
+ if self.partition_column
+ else "None"
+ )
+ return (
+ f"Partition(is_partitioned_table={self.is_partitioned_table}, "
+ f"partition_column=[{partition_column_str}])"
+ )
+
+ def __eq__(self, other: Any) -> bool:
+ return str(self) == str(other)
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>Incorrect equality implementation</b></div>
<div id="fix">
The custom __eq__ compares string representations, which is incorrect and
violates hash consistency for the frozen dataclass.
</div>
<details>
<summary>
<b>Code suggestion</b>
</summary>
<blockquote>Check the AI-generated fix before applying</blockquote>
<div id="code">
````suggestion
````
</div>
</details>
</div>
<small><i>Code Review Run #60811b</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]