From 983493dde76e1c9fea9bf0392358684a5f9a854c Mon Sep 17 00:00:00 2001 From: kqzh <35095889+kqzh@users.noreply.github.com> Date: Mon, 28 Mar 2022 20:12:54 +0800 Subject: [PATCH] fix execute full gc --- ccore/nebula/gateway/dao/dao.go | 15 +++++++++------ ccore/nebula/wrapper/result_set.go | 20 ++++++++++++++++++++ 2 files changed, 29 insertions(+), 6 deletions(-) diff --git a/ccore/nebula/gateway/dao/dao.go b/ccore/nebula/gateway/dao/dao.go index 1fc1f84..059ae7f 100644 --- a/ccore/nebula/gateway/dao/dao.go +++ b/ccore/nebula/gateway/dao/dao.go @@ -355,21 +355,24 @@ func Execute(nsid string, gql string, paramList types.ParameterList) (ExecuteRes return result, nil, errors.New(res.GetErrorMsg()) } if !res.IsEmpty() { - rowSize := res.GetRowSize() + records, err := res.GetRecords() + if err != nil { + return result, nil, err + } + + rowSize := len(records) colSize := res.GetColSize() colNames := res.GetColNames() result.Headers = colNames + for i := 0; i < rowSize; i++ { var rowValue = make(map[string]types.Any) - record, err := res.GetRowValuesByIndex(i) var _verticesParsedList = make(list, 0) var _edgesParsedList = make(list, 0) var _pathsParsedList = make(list, 0) - if err != nil { - return result, nil, err - } + for j := 0; j < colSize; j++ { - rowData, err := record.GetValueByIndex(j) + rowData, err := records[i].GetValueByIndex(j) if err != nil { return result, nil, err } diff --git a/ccore/nebula/wrapper/result_set.go b/ccore/nebula/wrapper/result_set.go index 3cf323f..cbd4e99 100644 --- a/ccore/nebula/wrapper/result_set.go +++ b/ccore/nebula/wrapper/result_set.go @@ -315,6 +315,26 @@ func (res ResultSet) GetRowValuesByIndex(index int) (*Record, error) { }, nil } +func (res ResultSet) GetRecords() ([]*Record, error) { + rows := res.resp.GetData().GetRows() + records := make([]*Record, len(rows)) + for i, row := range rows { + valWrap, err := GenValWraps(row, res.factory, res.timezoneInfo) + if err != nil { + return nil, err + } + records[i] = &Record{ + columnNames: &res.columnNames, + _record: valWrap, + colNameIndexMap: &res.colNameIndexMap, + factory: res.factory, + timezoneInfo: res.timezoneInfo, + } + } + + return records, nil +} + // Returns the number of total rows func (res ResultSet) GetRowSize() int { if res.resp.GetData() == nil {