diff --git a/ChangeLog.md b/ChangeLog.md index 18f42eb3..8561ea34 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -6,7 +6,8 @@ Starting with v1.31.6, this file will contain a record of major features and upd - New notebooks showing Telco examples leveraging GNN and LLM ([Link to PR](https://github.com/aws/graph-notebook/pull/587)) - Path: 02-Neptune-ML > 03-Sample-Applications > 04-Telco-Networks -- Added KMS encryption support to NeptuneDB Notebook CloudFormation template (https://github.com/aws/graph-notebook/pull/590) +- Added KMS encryption support to NeptuneDB Notebook CloudFormation template ([Link to PR]https://github.com/aws/graph-notebook/pull/590) +- Improved handling of mixed type Gremlin results ([Link to PR]https://github.com/aws/graph-notebook/pull/592) ## Release 4.2.0 (April 4, 2024) diff --git a/src/graph_notebook/magics/graph_magic.py b/src/graph_notebook/magics/graph_magic.py index 0d28cc96..e6d83d03 100644 --- a/src/graph_notebook/magics/graph_magic.py +++ b/src/graph_notebook/magics/graph_magic.py @@ -1200,10 +1200,11 @@ def gremlin(self, line, cell, local_ns: dict = None): mixed_results = False if query_res: - # If the results set contains multiple datatypes, and the first result is a map, we need to insert a - # temp non-map first element, or we will get an error when creating the Dataframe. - if isinstance(query_res[0], dict) and len(query_res) > 1: - if not all(isinstance(x, dict) for x in query_res[1:]): + # If the results set contains multiple datatypes, and the first result is a map or list, we need to + # insert a temp string first element, or we will get an error when creating the Dataframe. + first_res_type = type(query_res[0]) + if first_res_type in [dict, list, set] and len(query_res) > 1: + if not all(isinstance(x, first_res_type) for x in query_res[1:]): mixed_results = True query_res_deque = deque(query_res) query_res_deque.appendleft('x')