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


##########
superset/semantic_layers/mapper.py:
##########
@@ -390,12 +390,22 @@ def _get_filters_from_query_object(
     extras_filters = _get_filters_from_extras(query_object.extras)
     filters.update(extras_filters)
 
-    # 4. Add all other filters from query_object.filter
+    # 4. Add all other filters from query_object.filter.
+    # ``TEMPORAL_RANGE`` filters are skipped only when ``_get_time_filter``
+    # actually emitted bounds — that path takes over both the base range and
+    # the ``time_offset`` shift, so pass-through would duplicate the bounds
+    # (or, worse, ship the un-shifted literal bounds into the offset query).
+    # When it did not emit anything (e.g. an open-ended range like
+    # ``"2020-01-01 : "``, where ``_get_time_filter`` requires both
+    # ``from_dttm`` and ``to_dttm``), we fall through to
+    # ``_convert_query_object_filter``'s TEMPORAL_RANGE handler so the one-
+    # sided predicate still lands on the query instead of silently widening
+    # the scan.
+    time_bounds_emitted = bool(time_filters)

Review Comment:
   **Suggestion:** Add an explicit boolean type annotation to this newly 
introduced local variable to satisfy the type-hint requirement for relevant 
variables. [custom_rule]
   
   **Severity Level:** Minor ⚠️
   <details>
   <summary><b>Why it matters? 🤔 </b></summary>
   
   The custom rule requires type hints for relevant new Python variables. This 
newly introduced local boolean flag is unannotated, so the suggestion correctly 
identifies a real rule violation.
   </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=3d4b1d09b3484659bb62be725e38c257&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=3d4b1d09b3484659bb62be725e38c257&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/semantic_layers/mapper.py
   **Line:** 404:404
   **Comment:**
        *Custom Rule: Add an explicit boolean type annotation to this newly 
introduced local variable to satisfy the type-hint requirement for relevant 
variables.
   
   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%2F41556&comment_hash=0b1977f1ed0b2ca40132b42870586e64b65af4be802d2f65452bcc1c6841db20&reaction=like'>👍</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41556&comment_hash=0b1977f1ed0b2ca40132b42870586e64b65af4be802d2f65452bcc1c6841db20&reaction=dislike'>👎</a>



##########
superset/semantic_layers/mapper.py:
##########
@@ -845,31 +909,32 @@ def _get_group_limit_filters(
 
     # Create separate filters for the group limit subquery
     filters: set[Filter] = set()
-
-    # Add time range filter using inner bounds
-    if query_object.granularity:
-        time_dimension = all_dimensions.get(query_object.granularity)
-        if (
-            time_dimension
-            and query_object.inner_from_dttm
-            and query_object.inner_to_dttm
-        ):
-            filters.update(
-                {
-                    Filter(
-                        type=PredicateType.WHERE,
-                        column=time_dimension,
-                        operator=Operator.GREATER_THAN_OR_EQUAL,
-                        value=query_object.inner_from_dttm,
-                    ),
-                    Filter(
-                        type=PredicateType.WHERE,
-                        column=time_dimension,
-                        operator=Operator.LESS_THAN,
-                        value=query_object.inner_to_dttm,
-                    ),
-                }
-            )
+    time_bounds_emitted = False

Review Comment:
   **Suggestion:** Add an explicit boolean type annotation to this new local 
state flag so the added code consistently includes type hints for relevant 
variables. [custom_rule]
   
   **Severity Level:** Minor ⚠️
   <details>
   <summary><b>Why it matters? 🤔 </b></summary>
   
   This is another newly added local boolean variable in modified Python code 
without a type annotation, which violates the type-hint requirement for 
relevant variables.
   </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=eb366b72d3c04a7ba17749988d7171aa&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=eb366b72d3c04a7ba17749988d7171aa&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/semantic_layers/mapper.py
   **Line:** 912:912
   **Comment:**
        *Custom Rule: Add an explicit boolean type annotation to this new local 
state flag so the added code consistently includes type hints for relevant 
variables.
   
   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%2F41556&comment_hash=437c37f9c06ee0aba0665be18182dc775225a594d8bc01b17c30b2fa76d0b815&reaction=like'>👍</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41556&comment_hash=437c37f9c06ee0aba0665be18182dc775225a594d8bc01b17c30b2fa76d0b815&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