mirror of
https://github.com/apache/superset.git
synced 2026-05-22 00:05:15 +00:00
fix(bigquery): address deferred review follow-ups
Cache persistence: persist bq_memory_limited flag in QueryCacheManager so truncation warnings survive cache hits. The flag is now saved into the cache value dict in set_query_result (reading from g and resetting it there), and restored from cache in get(). get_df_payload now reads cache.bq_memory_limited instead of g, removing the need for g entirely in query_context_processor.py. Frontend test: add two tests to chartActions.test.ts verifying that addWarningToast is dispatched (with noDuplicate: true) when a query response carries a warning field, and not dispatched when it doesn't. Updated existing test_query_context_processor tests to set the flag on mock_cache directly rather than patching g. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -21,7 +21,7 @@ import re
|
||||
from typing import Any, cast, ClassVar, Sequence, TYPE_CHECKING
|
||||
|
||||
import pandas as pd
|
||||
from flask import current_app, g
|
||||
from flask import current_app
|
||||
from flask_babel import gettext as _
|
||||
|
||||
from superset.common.chart_data import ChartDataResultFormat
|
||||
@@ -191,12 +191,8 @@ class QueryContextProcessor:
|
||||
cache.df.columns = [unescape_separator(col) for col in cache.df.columns.values]
|
||||
|
||||
warning: str | None = None
|
||||
if getattr(g, "bq_memory_limited", False):
|
||||
row_count = getattr(g, "bq_memory_limited_row_count", len(cache.df))
|
||||
# Reset flags immediately so subsequent queries in the same request
|
||||
# don't inherit this warning
|
||||
g.bq_memory_limited = False
|
||||
g.bq_memory_limited_row_count = 0
|
||||
if cache.bq_memory_limited:
|
||||
row_count = cache.bq_memory_limited_row_count
|
||||
chart_id = (self._query_context.form_data or {}).get("slice_id", "")
|
||||
prefix = f"Chart {chart_id}: " if chart_id else ""
|
||||
warning = _(
|
||||
|
||||
Reference in New Issue
Block a user