(sql string, columnNameList []string, columnTypeList []string, columnNameIndex map[string]int32, ignoreTimestamp bool, moreData bool, queryId int64, statementId int64, client *rpc.IClientRPCServiceClient, sessionId int64, queryResult [][]byte, fetchSize int32, timeout *int64, zoneId string, timeFormat string, timeFactor int32, columnIndex2TsBlockColumnIndexList []int32)
| 54 | } |
| 55 | |
| 56 | func NewIoTDBRpcDataSet(sql string, columnNameList []string, columnTypeList []string, columnNameIndex map[string]int32, ignoreTimestamp bool, moreData bool, queryId int64, statementId int64, client *rpc.IClientRPCServiceClient, sessionId int64, queryResult [][]byte, fetchSize int32, timeout *int64, zoneId string, timeFormat string, timeFactor int32, columnIndex2TsBlockColumnIndexList []int32) (rpcDataSet *IoTDBRpcDataSet, err error) { |
| 57 | ds := &IoTDBRpcDataSet{ |
| 58 | sessionId: sessionId, |
| 59 | statementId: statementId, |
| 60 | ignoreTimestamp: ignoreTimestamp, |
| 61 | sql: sql, |
| 62 | queryId: queryId, |
| 63 | client: client, |
| 64 | fetchSize: fetchSize, |
| 65 | timeout: timeout, |
| 66 | moreData: moreData, |
| 67 | columnSize: int32(len(columnNameList)), |
| 68 | columnNameList: make([]string, 0, len(columnNameList)+1), |
| 69 | columnTypeList: make([]string, 0, len(columnTypeList)+1), |
| 70 | columnOrdinalMap: make(map[string]int32), |
| 71 | columnName2TsBlockColumnIndexMap: make(map[string]int32), |
| 72 | } |
| 73 | columnStartIndex := int32(1) |
| 74 | resultSetColumnSize := int32(len(columnNameList)) |
| 75 | // newly generated or updated columnIndex2TsBlockColumnIndexList.size() may not be equal to |
| 76 | // columnNameList.size() |
| 77 | // so we need startIndexForColumnIndex2TsBlockColumnIndexList to adjust the mapping relation |
| 78 | startIndexForColumnIndex2TsBlockColumnIndexList := int32(0) |
| 79 | |
| 80 | // for Time Column in tree model which should always be the first column and its index for |
| 81 | // TsBlockColumn is -1 |
| 82 | if !ignoreTimestamp { |
| 83 | ds.columnNameList = append(ds.columnNameList, TimestampColumnName) |
| 84 | ds.columnTypeList = append(ds.columnTypeList, "INT64") |
| 85 | ds.columnName2TsBlockColumnIndexMap[TimestampColumnName] = -1 |
| 86 | ds.columnOrdinalMap[TimestampColumnName] = 1 |
| 87 | if columnIndex2TsBlockColumnIndexList != nil { |
| 88 | newColumnIndex2TsBlockColumnIndexList := make([]int32, 0, len(columnIndex2TsBlockColumnIndexList)+1) |
| 89 | newColumnIndex2TsBlockColumnIndexList = append(newColumnIndex2TsBlockColumnIndexList, -1) |
| 90 | newColumnIndex2TsBlockColumnIndexList = append(newColumnIndex2TsBlockColumnIndexList, columnIndex2TsBlockColumnIndexList...) |
| 91 | columnIndex2TsBlockColumnIndexList = newColumnIndex2TsBlockColumnIndexList |
| 92 | startIndexForColumnIndex2TsBlockColumnIndexList = 1 |
| 93 | } |
| 94 | columnStartIndex += 1 |
| 95 | resultSetColumnSize += 1 |
| 96 | } |
| 97 | |
| 98 | ds.columnNameList = append(ds.columnNameList, columnNameList...) |
| 99 | ds.columnTypeList = append(ds.columnTypeList, columnTypeList...) |
| 100 | |
| 101 | if columnIndex2TsBlockColumnIndexList == nil { |
| 102 | columnIndex2TsBlockColumnIndexList = make([]int32, 0, resultSetColumnSize) |
| 103 | if !ignoreTimestamp { |
| 104 | startIndexForColumnIndex2TsBlockColumnIndexList = 1 |
| 105 | columnIndex2TsBlockColumnIndexList = append(columnIndex2TsBlockColumnIndexList, -1) |
| 106 | } |
| 107 | for i := 0; i < len(columnNameList); i++ { |
| 108 | columnIndex2TsBlockColumnIndexList = append(columnIndex2TsBlockColumnIndexList, int32(i)) |
| 109 | } |
| 110 | } |
| 111 | |
| 112 | tsBlockColumnSize := int32(0) |
| 113 | for _, value := range columnIndex2TsBlockColumnIndexList { |
no test coverage detected
searching dependent graphs…