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


##########
superset/utils/core.py:
##########
@@ -1820,7 +1831,9 @@ def get_metric_type_from_column(column: Any, datasource: 
Explorable) -> str:
     expression: str = metric.expression
 
     match = re.match(
-        r"(SUM|AVG|COUNT|COUNT_DISTINCT|MIN|MAX|FIRST|LAST)\((.*)\)", 
expression
+        r"(SUM|AVG|COUNT|COUNT_DISTINCT|MIN|MAX|FIRST|LAST"
+        r"|MEDIAN|STDDEV_SAMP|VAR_SAMP)\((.*)\)",

Review Comment:
   **Suggestion:** The new aggregate recognizer is case- and 
whitespace-sensitive, so valid saved expressions such as `stddev_samp(sales)` 
or `STDDEV_SAMP (sales)` are treated as unknown and their columns fall back to 
the default string type. Normalize the expression or allow optional whitespace 
and case-insensitive matching before extracting the operation. [type error]
   
   <details>
   <summary><b>Severity Level:</b> Major ⚠️</summary>
   
   ```mdx
   - ❌ All-null MEDIAN/STDDEV_SAMP/VAR_SAMP results can be classified as 
strings.
   - ⚠️ Numeric column metadata becomes incorrect for formatted saved 
expressions.
   ```
   </details>
   
   [![Use CodeAnt 
Skill](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/use-codeant-skill-flat-v2.svg)](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
   <details>
   <summary><b>Prompt for AI Agent 🤖 </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** superset/utils/core.py
   **Line:** 1834:1835
   **Comment:**
        *Type Error: The new aggregate recognizer is case- and 
whitespace-sensitive, so valid saved expressions such as `stddev_samp(sales)` 
or `STDDEV_SAMP (sales)` are treated as unknown and their columns fall back to 
the default string type. Normalize the expression or allow optional whitespace 
and case-insensitive matching before extracting the operation.
   
   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%2F42895&comment_hash=67585f4d2b76e5c84e22cd00a7a38ddb32d5d82e343fa32eaed519f95086044c&reaction=like'>👍</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F42895&comment_hash=67585f4d2b76e5c84e22cd00a7a38ddb32d5d82e343fa32eaed519f95086044c&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