refactor: remove one function.
This commit is contained in:
parent
13028744df
commit
55724157c4
|
@ -177,7 +177,6 @@ static FORCE_INLINE void colDataSetDouble(SColumnInfoData* pColumnInfoData, uint
|
||||||
int32_t getJsonValueLen(const char* data);
|
int32_t getJsonValueLen(const char* data);
|
||||||
|
|
||||||
int32_t colDataSetVal(SColumnInfoData* pColumnInfoData, uint32_t rowIndex, const char* pData, bool isNull);
|
int32_t colDataSetVal(SColumnInfoData* pColumnInfoData, uint32_t rowIndex, const char* pData, bool isNull);
|
||||||
int32_t colDataAppend(SColumnInfoData* pColumnInfoData, uint32_t rowIndex, const char* pData, bool isNull);
|
|
||||||
int32_t colDataReassignVal(SColumnInfoData* pColumnInfoData, uint32_t dstRowIdx, uint32_t srcRowIdx, const char* pData);
|
int32_t colDataReassignVal(SColumnInfoData* pColumnInfoData, uint32_t dstRowIdx, uint32_t srcRowIdx, const char* pData);
|
||||||
int32_t colDataSetNItems(SColumnInfoData* pColumnInfoData, uint32_t rowIndex, const char* pData, uint32_t numOfRows, bool trimValue);
|
int32_t colDataSetNItems(SColumnInfoData* pColumnInfoData, uint32_t rowIndex, const char* pData, uint32_t numOfRows, bool trimValue);
|
||||||
int32_t colDataMergeCol(SColumnInfoData* pColumnInfoData, int32_t numOfRow1, int32_t* capacity,
|
int32_t colDataMergeCol(SColumnInfoData* pColumnInfoData, int32_t numOfRow1, int32_t* capacity,
|
||||||
|
|
|
@ -74,10 +74,6 @@ int32_t getJsonValueLen(const char* data) {
|
||||||
return dataLen;
|
return dataLen;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t colDataAppend(SColumnInfoData* pColumnInfoData, uint32_t rowIndex, const char* pData, bool isNull) {
|
|
||||||
return colDataSetVal(pColumnInfoData, rowIndex, pData, isNull);
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t colDataSetVal(SColumnInfoData* pColumnInfoData, uint32_t rowIndex, const char* pData, bool isNull) {
|
int32_t colDataSetVal(SColumnInfoData* pColumnInfoData, uint32_t rowIndex, const char* pData, bool isNull) {
|
||||||
if (isNull) {
|
if (isNull) {
|
||||||
// There is a placehold for each NULL value of binary or nchar type.
|
// There is a placehold for each NULL value of binary or nchar type.
|
||||||
|
|
|
@ -542,32 +542,32 @@ int32_t mndRetrieveTagIdx(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, i
|
||||||
STR_TO_VARSTR(n3, (char *)tNameGetTableName(&stbName));
|
STR_TO_VARSTR(n3, (char *)tNameGetTableName(&stbName));
|
||||||
|
|
||||||
SColumnInfoData *pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
SColumnInfoData *pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||||
colDataAppend(pColInfo, numOfRows, (const char *)n1, false);
|
colDataSetVal(pColInfo, numOfRows, (const char *)n1, false);
|
||||||
|
|
||||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||||
colDataAppend(pColInfo, numOfRows, (const char *)n2, false);
|
colDataSetVal(pColInfo, numOfRows, (const char *)n2, false);
|
||||||
|
|
||||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||||
colDataAppend(pColInfo, numOfRows, (const char *)n3, false);
|
colDataSetVal(pColInfo, numOfRows, (const char *)n3, false);
|
||||||
|
|
||||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||||
|
|
||||||
colDataAppend(pColInfo, numOfRows, (const char *)&invalid, false);
|
colDataSetVal(pColInfo, numOfRows, (const char *)&invalid, false);
|
||||||
|
|
||||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||||
colDataAppend(pColInfo, numOfRows, (const char *)&pIdx->createdTime, false);
|
colDataSetVal(pColInfo, numOfRows, (const char *)&pIdx->createdTime, false);
|
||||||
|
|
||||||
char col[TSDB_TABLE_FNAME_LEN + VARSTR_HEADER_SIZE] = {0};
|
char col[TSDB_TABLE_FNAME_LEN + VARSTR_HEADER_SIZE] = {0};
|
||||||
STR_TO_VARSTR(col, (char *)pIdx->colName);
|
STR_TO_VARSTR(col, (char *)pIdx->colName);
|
||||||
|
|
||||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||||
colDataAppend(pColInfo, numOfRows, (const char *)col, false);
|
colDataSetVal(pColInfo, numOfRows, (const char *)col, false);
|
||||||
|
|
||||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||||
|
|
||||||
char tag[TSDB_TABLE_FNAME_LEN + VARSTR_HEADER_SIZE] = {0};
|
char tag[TSDB_TABLE_FNAME_LEN + VARSTR_HEADER_SIZE] = {0};
|
||||||
STR_TO_VARSTR(tag, (char *)"tag_index");
|
STR_TO_VARSTR(tag, (char *)"tag_index");
|
||||||
colDataAppend(pColInfo, numOfRows, (const char *)tag, false);
|
colDataSetVal(pColInfo, numOfRows, (const char *)tag, false);
|
||||||
|
|
||||||
numOfRows++;
|
numOfRows++;
|
||||||
sdbRelease(pSdb, pIdx);
|
sdbRelease(pSdb, pIdx);
|
||||||
|
|
|
@ -1278,13 +1278,13 @@ static int32_t mndRetrieveSma(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBloc
|
||||||
STR_TO_VARSTR(col, (char *)"");
|
STR_TO_VARSTR(col, (char *)"");
|
||||||
|
|
||||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||||
colDataAppend(pColInfo, numOfRows, (const char *)col, false);
|
colDataSetVal(pColInfo, numOfRows, (const char *)col, false);
|
||||||
|
|
||||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||||
|
|
||||||
char tag[TSDB_TABLE_FNAME_LEN + VARSTR_HEADER_SIZE] = {0};
|
char tag[TSDB_TABLE_FNAME_LEN + VARSTR_HEADER_SIZE] = {0};
|
||||||
STR_TO_VARSTR(tag, (char *)"sma_index");
|
STR_TO_VARSTR(tag, (char *)"sma_index");
|
||||||
colDataAppend(pColInfo, numOfRows, (const char *)tag, false);
|
colDataSetVal(pColInfo, numOfRows, (const char *)tag, false);
|
||||||
|
|
||||||
numOfRows++;
|
numOfRows++;
|
||||||
sdbRelease(pSdb, pSma);
|
sdbRelease(pSdb, pSma);
|
||||||
|
|
|
@ -874,7 +874,7 @@ static int32_t mndRetrieveVgroups(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *p
|
||||||
// if (pDb == NULL || pDb->compactStartTime <= 0) {
|
// if (pDb == NULL || pDb->compactStartTime <= 0) {
|
||||||
// colDataSetNULL(pColInfo, numOfRows);
|
// colDataSetNULL(pColInfo, numOfRows);
|
||||||
// } else {
|
// } else {
|
||||||
// colDataAppend(pColInfo, numOfRows, (const char *)&pDb->compactStartTime, false);
|
// colDataSetVal(pColInfo, numOfRows, (const char *)&pDb->compactStartTime, false);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
numOfRows++;
|
numOfRows++;
|
||||||
|
|
|
@ -392,7 +392,7 @@ static int32_t setAliveResultIntoDataBlock(int64_t* pConnId, SSDataBlock* pBlock
|
||||||
int32_t status = 0;
|
int32_t status = 0;
|
||||||
int32_t code = getAliveStatusFromApi(pConnId, dbName, &status);
|
int32_t code = getAliveStatusFromApi(pConnId, dbName, &status);
|
||||||
if (code == TSDB_CODE_SUCCESS) {
|
if (code == TSDB_CODE_SUCCESS) {
|
||||||
colDataAppend(pCol1, 0, (const char*)&status, false);
|
colDataSetVal(pCol1, 0, (const char*)&status, false);
|
||||||
}
|
}
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1033,7 +1033,7 @@ void appendCreateTableRow(void* pState, SExprSupp* pTableSup, SExprSupp* pTagSup
|
||||||
}
|
}
|
||||||
|
|
||||||
void* pGpIdCol = taosArrayGet(pDestBlock->pDataBlock, UD_GROUPID_COLUMN_INDEX);
|
void* pGpIdCol = taosArrayGet(pDestBlock->pDataBlock, UD_GROUPID_COLUMN_INDEX);
|
||||||
colDataAppend(pGpIdCol, pDestBlock->info.rows, (const char*)&groupId, false);
|
colDataSetVal(pGpIdCol, pDestBlock->info.rows, (const char*)&groupId, false);
|
||||||
pDestBlock->info.rows++;
|
pDestBlock->info.rows++;
|
||||||
blockDataDestroy(pTmpBlock);
|
blockDataDestroy(pTmpBlock);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -966,20 +966,20 @@ static int32_t sysTableUserColsFillOneTableCols(const SSysTableScanInfo* pInfo,
|
||||||
|
|
||||||
// table name
|
// table name
|
||||||
pColInfoData = taosArrayGet(dataBlock->pDataBlock, 0);
|
pColInfoData = taosArrayGet(dataBlock->pDataBlock, 0);
|
||||||
colDataAppend(pColInfoData, numOfRows, tName, false);
|
colDataSetVal(pColInfoData, numOfRows, tName, false);
|
||||||
|
|
||||||
// database name
|
// database name
|
||||||
pColInfoData = taosArrayGet(dataBlock->pDataBlock, 1);
|
pColInfoData = taosArrayGet(dataBlock->pDataBlock, 1);
|
||||||
colDataAppend(pColInfoData, numOfRows, dbname, false);
|
colDataSetVal(pColInfoData, numOfRows, dbname, false);
|
||||||
|
|
||||||
pColInfoData = taosArrayGet(dataBlock->pDataBlock, 2);
|
pColInfoData = taosArrayGet(dataBlock->pDataBlock, 2);
|
||||||
colDataAppend(pColInfoData, numOfRows, tableType, false);
|
colDataSetVal(pColInfoData, numOfRows, tableType, false);
|
||||||
|
|
||||||
// col name
|
// col name
|
||||||
char colName[TSDB_COL_NAME_LEN + VARSTR_HEADER_SIZE] = {0};
|
char colName[TSDB_COL_NAME_LEN + VARSTR_HEADER_SIZE] = {0};
|
||||||
STR_TO_VARSTR(colName, schemaRow->pSchema[i].name);
|
STR_TO_VARSTR(colName, schemaRow->pSchema[i].name);
|
||||||
pColInfoData = taosArrayGet(dataBlock->pDataBlock, 3);
|
pColInfoData = taosArrayGet(dataBlock->pDataBlock, 3);
|
||||||
colDataAppend(pColInfoData, numOfRows, colName, false);
|
colDataSetVal(pColInfoData, numOfRows, colName, false);
|
||||||
|
|
||||||
// col type
|
// col type
|
||||||
int8_t colType = schemaRow->pSchema[i].type;
|
int8_t colType = schemaRow->pSchema[i].type;
|
||||||
|
@ -994,10 +994,10 @@ static int32_t sysTableUserColsFillOneTableCols(const SSysTableScanInfo* pInfo,
|
||||||
(int32_t)((schemaRow->pSchema[i].bytes - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE));
|
(int32_t)((schemaRow->pSchema[i].bytes - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE));
|
||||||
}
|
}
|
||||||
varDataSetLen(colTypeStr, colTypeLen);
|
varDataSetLen(colTypeStr, colTypeLen);
|
||||||
colDataAppend(pColInfoData, numOfRows, (char*)colTypeStr, false);
|
colDataSetVal(pColInfoData, numOfRows, (char*)colTypeStr, false);
|
||||||
|
|
||||||
pColInfoData = taosArrayGet(dataBlock->pDataBlock, 5);
|
pColInfoData = taosArrayGet(dataBlock->pDataBlock, 5);
|
||||||
colDataAppend(pColInfoData, numOfRows, (const char*)&schemaRow->pSchema[i].bytes, false);
|
colDataSetVal(pColInfoData, numOfRows, (const char*)&schemaRow->pSchema[i].bytes, false);
|
||||||
|
|
||||||
for (int32_t j = 6; j <= 8; ++j) {
|
for (int32_t j = 6; j <= 8; ++j) {
|
||||||
pColInfoData = taosArrayGet(dataBlock->pDataBlock, j);
|
pColInfoData = taosArrayGet(dataBlock->pDataBlock, j);
|
||||||
|
|
|
@ -270,7 +270,7 @@ static bool genInterpolationResult(STimeSliceOperatorInfo* pSliceInfo, SExprSupp
|
||||||
continue;
|
continue;
|
||||||
} else if (isIsfilledPseudoColumn(pExprInfo)) {
|
} else if (isIsfilledPseudoColumn(pExprInfo)) {
|
||||||
bool isFilled = true;
|
bool isFilled = true;
|
||||||
colDataAppend(pDst, pResBlock->info.rows, (char*)&isFilled, false);
|
colDataSetVal(pDst, pResBlock->info.rows, (char*)&isFilled, false);
|
||||||
continue;
|
continue;
|
||||||
} else if (!isInterpFunc(pExprInfo)) {
|
} else if (!isInterpFunc(pExprInfo)) {
|
||||||
if (isGroupKeyFunc(pExprInfo)) {
|
if (isGroupKeyFunc(pExprInfo)) {
|
||||||
|
|
|
@ -1712,7 +1712,7 @@ int32_t percentileFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
|
||||||
SColumnInfoData* pCol = taosArrayGet(pBlock->pDataBlock, slotId);
|
SColumnInfoData* pCol = taosArrayGet(pBlock->pDataBlock, slotId);
|
||||||
|
|
||||||
varDataSetLen(buf, len);
|
varDataSetLen(buf, len);
|
||||||
colDataAppend(pCol, pBlock->info.rows, buf, false);
|
colDataSetVal(pCol, pBlock->info.rows, buf, false);
|
||||||
|
|
||||||
tMemBucketDestroy(pMemBucket);
|
tMemBucketDestroy(pMemBucket);
|
||||||
return pResInfo->numOfRes;
|
return pResInfo->numOfRes;
|
||||||
|
|
|
@ -145,7 +145,7 @@ int32_t executeMakePointFunc(SColumnInfoData *pInputData[], int32_t iLeft, int32
|
||||||
goto _exit;
|
goto _exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
colDataAppend(pOutputData, TMAX(iLeft, iRight), output, (output == NULL));
|
colDataSetVal(pOutputData, TMAX(iLeft, iRight), output, (output == NULL));
|
||||||
|
|
||||||
_exit:
|
_exit:
|
||||||
if (output) {
|
if (output) {
|
||||||
|
@ -165,7 +165,7 @@ int32_t executeGeomFromTextFunc(SColumnInfoData *pInputData, int32_t i, SColumnI
|
||||||
goto _exit;
|
goto _exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
colDataAppend(pOutputData, i, output, (output == NULL));
|
colDataSetVal(pOutputData, i, output, (output == NULL));
|
||||||
|
|
||||||
_exit:
|
_exit:
|
||||||
if (output) {
|
if (output) {
|
||||||
|
@ -185,7 +185,7 @@ int32_t executeAsTextFunc(SColumnInfoData *pInputData, int32_t i, SColumnInfoDat
|
||||||
goto _exit;
|
goto _exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
colDataAppend(pOutputData, i, output, (output == NULL));
|
colDataSetVal(pOutputData, i, output, (output == NULL));
|
||||||
|
|
||||||
_exit:
|
_exit:
|
||||||
if (output) {
|
if (output) {
|
||||||
|
@ -213,7 +213,7 @@ int32_t executeRelationFunc(const GEOSGeometry *geom1, const GEOSPreparedGeometr
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
colDataAppend(pOutputData, i, &res, (res==-1));
|
colDataSetVal(pOutputData, i, &res, (res==-1));
|
||||||
|
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,7 +84,7 @@ void setScalarParam(SScalarParam *sclParam, int32_t type, void *valueArray, TDRo
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
const char *val = (const char *)valueArray + (i * bytes);
|
const char *val = (const char *)valueArray + (i * bytes);
|
||||||
colDataAppend(sclParam->columnData, i, val, false);
|
colDataSetVal(sclParam->columnData, i, val, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue