korbit-ai[bot] commented on code in PR #32290: URL: https://github.com/apache/superset/pull/32290#discussion_r1958664176
########## superset/viz.py: ########## @@ -2293,10 +2293,14 @@ def nest_values( ] if level >= len(levels): return [] - dim_level = levels[level][metric][[dims[0]]] + + dim_level = levels[level][metric] + for d in dims: + dim_level = dim_level[d] + return [ { - "name": i, + "name": dims + [i], Review Comment: ### Invalid list concatenation <sub></sub> <details> <summary>Tell me more</summary> ###### What is the issue? Concatenating the list of dimensions with a single value will fail if 'i' is not a list type. ###### Why this matters This would raise a TypeError when attempting to concatenate a list with a non-list type, breaking the visualization logic. ###### Suggested change ∙ *Feature Preview* Ensure proper list concatenation: ```python "name": [*dims, i] # or dims + [str(i)] if i needs to be converted to string ``` </details> <sub> [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/f8a1f7b9-f89b-4dc1-b309-59f67456cb1c?suggestedFixEnabled=true) 💬 Chat with Korbit by mentioning @korbit-ai. </sub> <!--- korbi internal id:88eab4d4-06d5-4fba-b842-761a2bc86ed0 --> ########## superset/viz.py: ########## @@ -2293,10 +2293,14 @@ ] if level >= len(levels): return [] - dim_level = levels[level][metric][[dims[0]]] + + dim_level = levels[level][metric] + for d in dims: + dim_level = dim_level[d] Review Comment: ### Missing dimension validation in nested structure <sub></sub> <details> <summary>Tell me more</summary> ###### What is the issue? The code fails to validate if each dimension exists in the nested data structure before attempting to access it. ###### Why this matters This could lead to KeyError exceptions when a dimension is not found in the nested data, causing the visualization to crash. ###### Suggested change ∙ *Feature Preview* Add validation to check if each dimension exists in the data structure: ```python dim_level = levels[level][metric] for d in dims: if d not in dim_level: return [] # or handle the missing dimension gracefully dim_level = dim_level[d] ``` </details> <sub> [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/97aa1aa6-88c6-460a-8b53-ade2e8162552?suggestedFixEnabled=true) 💬 Chat with Korbit by mentioning @korbit-ai. </sub> <!--- korbi internal id:63060da1-96f9-43ab-abf6-632116447f20 --> -- 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: notifications-unsubscr...@superset.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org For additional commands, e-mail: notifications-h...@superset.apache.org