mirror of
https://github.com/apache/superset.git
synced 2026-05-07 08:54:23 +00:00
taking care of PR comments
This commit is contained in:
@@ -800,7 +800,7 @@ async def get_chart_data( # noqa: C901
|
||||
# Use SQL-derived GenericDataType when available,
|
||||
# fall back to Python isinstance heuristic
|
||||
data_type = "string"
|
||||
if idx < len(coltypes):
|
||||
if coltypes:
|
||||
data_type = _GENERIC_TYPE_MAP.get(coltypes[idx], "string")
|
||||
elif sample_values:
|
||||
if all(isinstance(v, bool) for v in sample_values):
|
||||
|
||||
@@ -30,12 +30,14 @@ from superset.mcp_service.chart.schemas import (
|
||||
PerformanceMetadata,
|
||||
)
|
||||
from superset.mcp_service.chart.tool.get_chart_data import (
|
||||
_GENERIC_TYPE_MAP,
|
||||
_MAX_RECOMMENDATIONS,
|
||||
_recommend_visualizations,
|
||||
_sanitize_chart_data_for_llm_context,
|
||||
)
|
||||
from superset.mcp_service.utils import sanitize_for_llm_context
|
||||
from superset.mcp_service.utils.sanitization import LLM_CONTEXT_ESCAPED_CLOSE_DELIMITER
|
||||
from superset.utils.core import GenericDataType
|
||||
|
||||
|
||||
def _collect_groupby_extras(
|
||||
@@ -1099,9 +1101,6 @@ def test_recommend_single_numeric_high_cardinality_suggests_histogram():
|
||||
|
||||
def test_coltypes_populates_data_type():
|
||||
"""Verify that GenericDataType values from coltypes are mapped correctly."""
|
||||
from superset.mcp_service.chart.tool.get_chart_data import _GENERIC_TYPE_MAP
|
||||
from superset.utils.core import GenericDataType
|
||||
|
||||
assert _GENERIC_TYPE_MAP[GenericDataType.NUMERIC] == "numeric"
|
||||
assert _GENERIC_TYPE_MAP[GenericDataType.STRING] == "string"
|
||||
assert _GENERIC_TYPE_MAP[GenericDataType.TEMPORAL] == "temporal"
|
||||
|
||||
Reference in New Issue
Block a user