bito-code-review[bot] commented on PR #42597:
URL: https://github.com/apache/superset/pull/42597#issuecomment-5125088258
<!-- Bito Reply -->
The flagged issue is correct. The current regression test uses only strings,
which masks potential `TypeError` exceptions that occur when sorting
heterogeneous types (e.g., strings, integers, and `None`) in production. To
resolve this, update the test case to include a mixed-type list in
`extra_cache_keys` to ensure the sorting logic handles them correctly.
Here is the updated test case:
```python
query_object1 = QueryObject(row_limit=1)
query_object2 = QueryObject(row_limit=1)
# Mixed types to test sorting robustness
mixed_values_different_order = ["CAR_IDS=1,2,3", 123, None]
cache_key1 =
query_object1.cache_key(extra_cache_keys=mixed_values_different_order)
cache_key2 = query_object2.cache_key(
extra_cache_keys=list(reversed(mixed_values_different_order))
)
assert cache_key1 == cache_key2
```
Would you like me to check the rest of the comments on this PR and implement
fixes for them as well?
**tests/unit_tests/queries/query_object_test.py**
```
query_object1 = QueryObject(row_limit=1)
query_object2 = QueryObject(row_limit=1)
# Mixed types to test sorting robustness
mixed_values_different_order = ["CAR_IDS=1,2,3", 123, None]
cache_key1 =
query_object1.cache_key(extra_cache_keys=mixed_values_different_order)
cache_key2 = query_object2.cache_key(
extra_cache_keys=list(reversed(mixed_values_different_order))
)
assert cache_key1 == cache_key2
```
--
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]