mirror of
https://github.com/apache/superset.git
synced 2026-07-28 09:32:28 +00:00
Compare commits
1 Commits
master
...
chore/helm
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0155e329ff |
1
.github/actions/chart-releaser-action
vendored
1
.github/actions/chart-releaser-action
vendored
Submodule .github/actions/chart-releaser-action deleted from a917fd15b2
@@ -38,6 +38,11 @@ jobs:
|
||||
with:
|
||||
install-superset: "false"
|
||||
|
||||
# Still vendored (not de-vendored like chart-releaser-action below): the
|
||||
# allowlisted helm/chart-testing-action@v2.8.0 depends internally on
|
||||
# astral-sh/setup-uv@v7.0.0, which isn't itself on the ASF Actions
|
||||
# allowlist (only v8.1.0+ are, at apache/infrastructure-actions'
|
||||
# actions.yml). Needs an INFRA request before this can de-vendor too.
|
||||
- name: Set up chart-testing
|
||||
uses: ./.github/actions/chart-testing-action
|
||||
|
||||
|
||||
7
.github/workflows/superset-helm-release.yml
vendored
7
.github/workflows/superset-helm-release.yml
vendored
@@ -86,13 +86,8 @@ jobs:
|
||||
# Return to the original branch
|
||||
git checkout local_gha_temp
|
||||
|
||||
- name: Fetch/list all tags
|
||||
run: |
|
||||
git submodule update
|
||||
cat .github/actions/chart-releaser-action/action.yml
|
||||
|
||||
- name: Run chart-releaser
|
||||
uses: ./.github/actions/chart-releaser-action
|
||||
uses: helm/chart-releaser-action@cae68fefc6b5f367a0275617c9f83181ba54714f # v1.7.0
|
||||
with:
|
||||
version: v1.6.0
|
||||
charts_dir: helm
|
||||
|
||||
3
.gitmodules
vendored
3
.gitmodules
vendored
@@ -30,9 +30,6 @@
|
||||
[submodule ".github/actions/chart-testing-action"]
|
||||
path = .github/actions/chart-testing-action
|
||||
url = https://github.com/helm/chart-testing-action
|
||||
[submodule ".github/actions/chart-releaser-action"]
|
||||
path = .github/actions/chart-releaser-action
|
||||
url = https://github.com/helm/chart-releaser-action
|
||||
[submodule ".github/actions/github-action-push-to-another-repository"]
|
||||
path = .github/actions/github-action-push-to-another-repository
|
||||
url = https://github.com/cpina/github-action-push-to-another-repository
|
||||
|
||||
@@ -318,7 +318,7 @@ class QueryContextFactory: # pylint: disable=too-few-public-methods
|
||||
# another temporal filter. A new filter based on the value of
|
||||
# the granularity will be added later in the code.
|
||||
# In practice, this is replacing the previous default temporal filter.
|
||||
if filter_to_remove and is_adhoc_column(filter_to_remove): # type: ignore
|
||||
if is_adhoc_column(filter_to_remove): # type: ignore
|
||||
filter_to_remove = filter_to_remove.get("sqlExpression")
|
||||
|
||||
if filter_to_remove:
|
||||
|
||||
@@ -206,9 +206,11 @@ class QueryCacheManager:
|
||||
)
|
||||
query_cache.status = QueryStatus.SUCCESS
|
||||
query_cache.is_loaded = True
|
||||
query_cache.is_cached = True
|
||||
query_cache.is_cached = cache_value is not None
|
||||
query_cache.sql_rowcount = cache_value.get("sql_rowcount", None)
|
||||
query_cache.cache_dttm = cache_value["dttm"]
|
||||
query_cache.cache_dttm = (
|
||||
cache_value["dttm"] if cache_value is not None else None
|
||||
)
|
||||
query_cache.queried_dttm = cache_value.get(
|
||||
"queried_dttm", cache_value.get("dttm")
|
||||
)
|
||||
|
||||
@@ -397,8 +397,7 @@ class DashboardDAO(BaseDAO[Dashboard]):
|
||||
md["color_namespace"] = data.get("color_namespace")
|
||||
|
||||
md["expanded_slices"] = data.get("expanded_slices", {})
|
||||
if "refresh_frequency" in data:
|
||||
md["refresh_frequency"] = data["refresh_frequency"]
|
||||
md["refresh_frequency"] = data.get("refresh_frequency", 0)
|
||||
md["color_scheme"] = data.get("color_scheme", "")
|
||||
md["label_colors"] = data.get("label_colors", {})
|
||||
md["shared_label_colors"] = data.get("shared_label_colors", [])
|
||||
|
||||
@@ -534,7 +534,6 @@ class DatabricksDynamicBaseEngineSpec(BasicParametersMixin, DatabricksBaseEngine
|
||||
],
|
||||
) -> list[SupersetError]:
|
||||
errors: list[SupersetError] = []
|
||||
connect_args: dict[str, Any] = {}
|
||||
if extra := json.loads(properties.get("extra")): # type: ignore
|
||||
engine_params = extra.get("engine_params", {})
|
||||
connect_args = engine_params.get("connect_args", {})
|
||||
|
||||
@@ -1235,7 +1235,6 @@ class PrestoEngineSpec(PrestoBaseEngineSpec):
|
||||
all_columns: list[ResultSetColumnType] = []
|
||||
expanded_columns = []
|
||||
current_array_level = None
|
||||
unnested_rows: dict[int, int] = defaultdict(int)
|
||||
while to_process:
|
||||
column, level = to_process.popleft()
|
||||
if column["column_name"] not in [
|
||||
@@ -1249,7 +1248,7 @@ class PrestoEngineSpec(PrestoBaseEngineSpec):
|
||||
# added by the first. every time we change a level in the nested arrays
|
||||
# we reinitialize this.
|
||||
if level != current_array_level:
|
||||
unnested_rows = defaultdict(int)
|
||||
unnested_rows: dict[int, int] = defaultdict(int)
|
||||
current_array_level = level
|
||||
|
||||
name = column["column_name"]
|
||||
|
||||
@@ -532,42 +532,6 @@ class TestQueryContextFactory:
|
||||
|
||||
assert query_object.columns == ["ds", "other_col"]
|
||||
|
||||
def test_apply_granularity_no_filter_to_remove(self):
|
||||
"""No x-axis and no temporal filters leaves the filters untouched."""
|
||||
query_object = Mock(spec=QueryObject)
|
||||
query_object.granularity = "P1D"
|
||||
query_object.columns = ["other_col"]
|
||||
query_object.post_processing = []
|
||||
query_object.filter = [{"col": "other_col", "op": "==", "val": "value"}]
|
||||
|
||||
datasource = Mock()
|
||||
datasource.columns = [{"column_name": "ds", "is_dttm": True}]
|
||||
|
||||
self.factory._apply_granularity(query_object, {}, datasource)
|
||||
|
||||
assert query_object.filter == [{"col": "other_col", "op": "==", "val": "value"}]
|
||||
|
||||
def test_apply_granularity_with_adhoc_temporal_filter(self):
|
||||
"""An adhoc temporal filter is matched on its SQL expression."""
|
||||
adhoc_column = {"label": "ds_expr", "sqlExpression": "DATE(ds)"}
|
||||
query_object = Mock(spec=QueryObject)
|
||||
query_object.granularity = "P1D"
|
||||
query_object.columns = ["other_col"]
|
||||
query_object.post_processing = []
|
||||
query_object.filter = [
|
||||
{"col": adhoc_column, "op": "TEMPORAL_RANGE", "val": "a : b"},
|
||||
{"col": "DATE(ds)", "op": "TEMPORAL_RANGE", "val": "a : b"},
|
||||
]
|
||||
|
||||
datasource = Mock()
|
||||
datasource.columns = [{"column_name": "ds", "is_dttm": True}]
|
||||
|
||||
self.factory._apply_granularity(query_object, {}, datasource)
|
||||
|
||||
assert query_object.filter == [
|
||||
{"col": adhoc_column, "op": "TEMPORAL_RANGE", "val": "a : b"}
|
||||
]
|
||||
|
||||
def test_apply_filters_with_time_range(self):
|
||||
"""Test _apply_filters with time_range"""
|
||||
query_object = Mock(spec=QueryObject)
|
||||
|
||||
@@ -24,7 +24,6 @@ from superset.connectors.sqla.models import Database, SqlaTable
|
||||
from superset.daos.dashboard import DashboardDAO
|
||||
from superset.models.dashboard import Dashboard
|
||||
from superset.models.slice import Slice
|
||||
from superset.utils import json
|
||||
from tests.unit_tests.conftest import with_feature_flags
|
||||
|
||||
|
||||
@@ -118,53 +117,3 @@ def test_set_dash_metadata_preserves_soft_deleted_members(
|
||||
)
|
||||
# And the position slot kept its UUID rather than being nulled.
|
||||
assert positions["CHART-trashed"]["meta"]["uuid"] == str(trashed_chart.uuid)
|
||||
|
||||
|
||||
def test_set_dash_metadata_preserves_refresh_frequency(session: Session) -> None:
|
||||
"""set_dash_metadata must not reset refresh_frequency when absent from data.
|
||||
|
||||
Regression test for #42116: ``data.get("refresh_frequency", 0)`` would
|
||||
unconditionally overwrite the existing value with 0 whenever the caller
|
||||
did not include ``refresh_frequency`` in the data dict.
|
||||
"""
|
||||
Dashboard.metadata.create_all(session.get_bind())
|
||||
|
||||
dashboard = Dashboard(
|
||||
dashboard_title="refresh_test_dash",
|
||||
json_metadata=json.dumps({"refresh_frequency": 30}),
|
||||
)
|
||||
db.session.add(dashboard)
|
||||
db.session.flush()
|
||||
|
||||
# Simulate a save that does NOT include refresh_frequency
|
||||
# (e.g. changing only the title via the PropertiesModal).
|
||||
DashboardDAO.set_dash_metadata(dashboard, {"color_scheme": "superset"})
|
||||
|
||||
md = json.loads(dashboard.json_metadata)
|
||||
assert md["refresh_frequency"] == 30, (
|
||||
"refresh_frequency should be preserved when not present in data"
|
||||
)
|
||||
|
||||
|
||||
def test_set_dash_metadata_updates_refresh_frequency_when_present(
|
||||
session: Session,
|
||||
) -> None:
|
||||
"""set_dash_metadata must update refresh_frequency when it IS in data."""
|
||||
Dashboard.metadata.create_all(session.get_bind())
|
||||
|
||||
dashboard = Dashboard(
|
||||
dashboard_title="refresh_test_dash_2",
|
||||
json_metadata=json.dumps({"refresh_frequency": 30}),
|
||||
)
|
||||
db.session.add(dashboard)
|
||||
db.session.flush()
|
||||
|
||||
# Simulate a save that explicitly sets refresh_frequency to 0.
|
||||
DashboardDAO.set_dash_metadata(
|
||||
dashboard, {"refresh_frequency": 0, "color_scheme": "superset"}
|
||||
)
|
||||
|
||||
md = json.loads(dashboard.json_metadata)
|
||||
assert md["refresh_frequency"] == 0, (
|
||||
"refresh_frequency should be updated when present in data"
|
||||
)
|
||||
|
||||
@@ -571,53 +571,3 @@ def test_stringify_values_non_serializable_dict_falls_back_to_str() -> None:
|
||||
# Must not raise — falls back to str()
|
||||
result = stringify_values(data)
|
||||
assert result[0] == str({"key": _Unserializable()})
|
||||
|
||||
|
||||
def test_empty_result_set_preserves_column_metadata() -> None:
|
||||
"""
|
||||
Test that column metadata is preserved when query returns zero rows.
|
||||
|
||||
When a query returns no data but has a valid cursor description, the
|
||||
column names and types from cursor_description should be preserved
|
||||
in the result set. This allows downstream consumers (like the UI)
|
||||
to display column headers even for empty result sets.
|
||||
"""
|
||||
data: DbapiResult = []
|
||||
description = [
|
||||
("id", "int", None, None, None, None, True),
|
||||
("name", "varchar", None, None, None, None, True),
|
||||
("created_at", "timestamp", None, None, None, None, True),
|
||||
]
|
||||
|
||||
result_set = SupersetResultSet(
|
||||
data,
|
||||
description, # type: ignore
|
||||
BaseEngineSpec,
|
||||
)
|
||||
|
||||
# Verify column count
|
||||
assert len(result_set.columns) == 3
|
||||
|
||||
# Verify column names are preserved
|
||||
column_names = [col["column_name"] for col in result_set.columns]
|
||||
assert column_names == ["id", "name", "created_at"]
|
||||
|
||||
assert result_set.columns[0]["type"] == BaseEngineSpec.get_datatype(
|
||||
description[0][1]
|
||||
)
|
||||
assert result_set.columns[1]["type"] == BaseEngineSpec.get_datatype(
|
||||
description[1][1]
|
||||
)
|
||||
assert result_set.columns[2]["type"] == BaseEngineSpec.get_datatype(
|
||||
description[2][1]
|
||||
)
|
||||
|
||||
# Verify the PyArrow table has the correct schema
|
||||
assert result_set.table.num_rows == 0
|
||||
assert len(result_set.table.column_names) == 3
|
||||
assert list(result_set.table.column_names) == ["id", "name", "created_at"]
|
||||
|
||||
# Verify DataFrame conversion works
|
||||
df = result_set.to_pandas_df()
|
||||
assert len(df) == 0
|
||||
assert list(map(str, df.columns)) == ["id", "name", "created_at"]
|
||||
|
||||
Reference in New Issue
Block a user