From 68c9f5d480a59d23e55efc4231cd87cf726042ea Mon Sep 17 00:00:00 2001 From: ChihYu Yeh Date: Mon, 8 Jul 2024 09:50:02 +0800 Subject: [PATCH] fix groupByKeys bug --- .../src/pipelines/sql_explanation/generation.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/wren-ai-service/src/pipelines/sql_explanation/generation.py b/wren-ai-service/src/pipelines/sql_explanation/generation.py index 5223964238..695d36e225 100644 --- a/wren-ai-service/src/pipelines/sql_explanation/generation.py +++ b/wren-ai-service/src/pipelines/sql_explanation/generation.py @@ -41,8 +41,13 @@ def _compose_sql_expression_of_filter_type(filter_analysis: Dict) -> str: return "" -def _compose_sql_expression_of_groupby_type(groupby_keys: List[List[str]]) -> List[str]: - return [f"{','.join(groupby_key)}" for groupby_key in groupby_keys] +def _compose_sql_expression_of_groupby_type( + groupby_keys: List[List[dict]], +) -> List[str]: + return [ + ", ".join([expression["expression"] for expression in groupby_key]) + for groupby_key in groupby_keys + ] def _compose_sql_expression_of_relation_type(relation: Dict) -> List[str]: