diff --git a/csst_dfs_api_cluster/common/catalog.py b/csst_dfs_api_cluster/common/catalog.py index 687c2da23257c2fc9c021a8acfa8624ebc3f0cc3..a21987854a5d0739dbe5f8bbd7c063f332fedb6e 100644 --- a/csst_dfs_api_cluster/common/catalog.py +++ b/csst_dfs_api_cluster/common/catalog.py @@ -31,7 +31,14 @@ class CatalogApi(object): return Result.error(message = str(resp.error.detail)) datas.flush() records = pickle.loads(datas.getvalue()) + records, cols = records[0], records[1] + columns = [] + for col in cols: + if col in columns: + columns.append("%s_1" % (col, )) + else: + columns.append(col) - return Result.ok_data(data = records).append("totalCount", totalCount).append("columns", kwargs['columns']) + return Result.ok_data(data = records).append("totalCount", totalCount).append("columns", columns) except grpc.RpcError as e: return Result.error(message="%s:%s" % (e.code().value, e.details())) diff --git a/csst_dfs_api_cluster/common/utils.py b/csst_dfs_api_cluster/common/utils.py index 691cf6a843db9f8258d2dbf63dbee4cfb87bc557..1c1047f1dda51db0bdf4753691b3c770cf2e456f 100644 --- a/csst_dfs_api_cluster/common/utils.py +++ b/csst_dfs_api_cluster/common/utils.py @@ -114,8 +114,15 @@ def find_req(function, kwargs): else: records = pickle.loads(datas.getvalue()) records, cols = records[0], records[1] + columns = [] + for col in cols: + if col in columns: + columns.append("%s_1" % (col, )) + else: + columns.append(col) + return Result.ok_data(data = records).append("totalCount", totalCount)\ - .append("columns", cols) + .append("columns", columns) except grpc.RpcError as e: return Result.error(message="%s:%s" % (e.code().value, e.details())) diff --git a/csst_dfs_api_cluster/facility/level1.py b/csst_dfs_api_cluster/facility/level1.py index 238f6580ee54a0320ba1c75f188f070c69adb7bb..02d07bf325d54161feb256ab602eb8fcd36444d4 100644 --- a/csst_dfs_api_cluster/facility/level1.py +++ b/csst_dfs_api_cluster/facility/level1.py @@ -16,7 +16,13 @@ class Level1DataApi(object): if not isinstance(get_parameter(kwargs, "brick_ids"), list): return Result.error(message="brick_ids is not a list") return find_req("Level1Servicer.FindByBrickIds", kwargs) - + + @grpc_channel + def find_refs_by_ids(self, **kwargs): + if not isinstance(get_parameter(kwargs, "ids"), list): + return Result.error(message="ids is not a list") + return find_req("Level1Servicer.FindRefsByIds", kwargs) + @grpc_channel def find_by_ids(self, **kwargs): if not isinstance(get_parameter(kwargs, "ids"), list):