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


##########
superset/models/helpers.py:
##########
@@ -3322,7 +3335,22 @@ def values_for_column(  # pylint: disable=too-many-locals
             sql = self.database.mutate_sql_based_on_config(sql)
 
             with engine.connect() as con:
-                df = pd.read_sql_query(sql=self.text(sql), con=con)
+
+                def run_query(query_sql: str) -> pd.DataFrame:
+                    return pd.read_sql_query(sql=self.text(query_sql), con=con)
+
+                if not self.sql:
+                    # Physical-table dataset: the filter-values statement is
+                    # generated by Superset, so a read-limit rejection (e.g.
+                    # ClickHouse max_rows_to_read) is retried once with the
+                    # engine's bounded-read override. Virtual datasets embed
+                    # user-authored SQL and stay governed by operator read
+                    # limits.
+                    df = self.database.run_with_sampling_read_limit_retry(
+                        sql, run_query
+                    )

Review Comment:
   ✅ **Customized review instruction saved!**
   
   **Instruction:**
   > For physical-table filter-value queries, allow bounded read-limit retries 
to return and cache partial results; do not require preserving the error or 
adding a truncation signal unless the user-facing payload/UI contract supports 
it.
   
   **Applied to:**
     - `superset/models/helpers.py`
   
   ---
   💡 *To manage or update this instruction, visit: [CodeAnt AI 
Settings](https://app.codeant.ai/org/settings/learnings)*



-- 
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