Merge branch '3.0' into enh/idxFilter
This commit is contained in:
commit
69f1960e2e
|
@ -180,8 +180,11 @@ typedef struct {
|
|||
} \
|
||||
} while (0)
|
||||
|
||||
// TODO: use varchar(0) to represent NULL type
|
||||
|
||||
//TODO: use varchar(0) to represent NULL type
|
||||
#define IS_VAR_NULL_TYPE(_t, _b) ((_t) == TSDB_DATA_TYPE_VARCHAR && (_b) == 0)
|
||||
#define IS_NULL_TYPE(_t) ((_t) == TSDB_DATA_TYPE_NULL)
|
||||
|
||||
#define IS_SIGNED_NUMERIC_TYPE(_t) ((_t) >= TSDB_DATA_TYPE_TINYINT && (_t) <= TSDB_DATA_TYPE_BIGINT)
|
||||
#define IS_UNSIGNED_NUMERIC_TYPE(_t) ((_t) >= TSDB_DATA_TYPE_UTINYINT && (_t) <= TSDB_DATA_TYPE_UBIGINT)
|
||||
#define IS_FLOAT_TYPE(_t) ((_t) == TSDB_DATA_TYPE_FLOAT || (_t) == TSDB_DATA_TYPE_DOUBLE)
|
||||
|
|
|
@ -923,7 +923,7 @@ void doSetOneRowPtr(SReqResultInfo* pResultInfo) {
|
|||
int32_t bytes = pResultInfo->fields[i].bytes;
|
||||
|
||||
if (IS_VAR_DATA_TYPE(type)) {
|
||||
if (pCol->offset[pResultInfo->current] != -1) {
|
||||
if (!IS_VAR_NULL_TYPE(type, bytes) && pCol->offset[pResultInfo->current] != -1) {
|
||||
char* pStart = pResultInfo->pCol[i].offset[pResultInfo->current] + pResultInfo->pCol[i].pData;
|
||||
|
||||
pResultInfo->length[i] = varDataLen(pStart);
|
||||
|
|
|
@ -846,7 +846,7 @@ static int32_t translateConcatImpl(SFunctionNode* pFunc, char* pErrBuf, int32_t
|
|||
for (int32_t i = 0; i < numOfParams; ++i) {
|
||||
SNode* pPara = nodesListGetNode(pFunc->pParameterList, i);
|
||||
uint8_t paraType = ((SExprNode*)pPara)->resType.type;
|
||||
if (!IS_VAR_DATA_TYPE(paraType) && TSDB_DATA_TYPE_NULL != paraType) {
|
||||
if (!IS_VAR_DATA_TYPE(paraType) && !IS_NULL_TYPE(paraType)) {
|
||||
return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName);
|
||||
}
|
||||
if (TSDB_DATA_TYPE_NCHAR == paraType) {
|
||||
|
@ -859,6 +859,12 @@ static int32_t translateConcatImpl(SFunctionNode* pFunc, char* pErrBuf, int32_t
|
|||
uint8_t paraType = ((SExprNode*)pPara)->resType.type;
|
||||
int32_t paraBytes = ((SExprNode*)pPara)->resType.bytes;
|
||||
int32_t factor = 1;
|
||||
if (IS_NULL_TYPE(paraType)) {
|
||||
resultType = TSDB_DATA_TYPE_VARCHAR;
|
||||
resultBytes = 0;
|
||||
sepBytes = 0;
|
||||
break;
|
||||
}
|
||||
if (TSDB_DATA_TYPE_NCHAR == resultType && TSDB_DATA_TYPE_VARCHAR == paraType) {
|
||||
factor *= TSDB_NCHAR_SIZE;
|
||||
}
|
||||
|
|
|
@ -449,7 +449,7 @@ int32_t concatFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOu
|
|||
bool hasNull = false;
|
||||
for (int32_t i = 0; i < inputNum; ++i) {
|
||||
if (colDataIsNull_s(pInputData[i], k) ||
|
||||
GET_PARAM_TYPE(&pInput[i]) == TSDB_DATA_TYPE_NULL) {
|
||||
IS_NULL_TYPE(GET_PARAM_TYPE(&pInput[i]))) {
|
||||
colDataAppendNULL(pOutputData, k);
|
||||
hasNull = true;
|
||||
break;
|
||||
|
@ -526,7 +526,7 @@ int32_t concatWsFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *p
|
|||
|
||||
for (int32_t k = 0; k < numOfRows; ++k) {
|
||||
if (colDataIsNull_s(pInputData[0], k) ||
|
||||
GET_PARAM_TYPE(&pInput[0]) == TSDB_DATA_TYPE_NULL) {
|
||||
IS_NULL_TYPE(GET_PARAM_TYPE(&pInput[0]))) {
|
||||
colDataAppendNULL(pOutputData, k);
|
||||
continue;
|
||||
}
|
||||
|
@ -535,7 +535,7 @@ int32_t concatWsFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *p
|
|||
bool hasNull = false;
|
||||
for (int32_t i = 1; i < inputNum; ++i) {
|
||||
if (colDataIsNull_s(pInputData[i], k) ||
|
||||
GET_PARAM_TYPE(&pInput[i]) == TSDB_DATA_TYPE_NULL) {
|
||||
IS_NULL_TYPE(GET_PARAM_TYPE(&pInput[i]))) {
|
||||
hasNull = true;
|
||||
break;
|
||||
}
|
||||
|
@ -1221,8 +1221,8 @@ int32_t timeDiffFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *p
|
|||
if (IS_VAR_DATA_TYPE(type)) { /* datetime format strings */
|
||||
int32_t ret = convertStringToTimestamp(type, input[k], TSDB_TIME_PRECISION_NANO, &timeVal[k]);
|
||||
if (ret != TSDB_CODE_SUCCESS) {
|
||||
colDataAppendNULL(pOutput->columnData, i);
|
||||
continue;
|
||||
hasNull = true;
|
||||
break;
|
||||
}
|
||||
} else if (type == TSDB_DATA_TYPE_BIGINT || type == TSDB_DATA_TYPE_TIMESTAMP) { /* unix timestamp or ts column*/
|
||||
GET_TYPED_DATA(timeVal[k], int64_t, type, input[k]);
|
||||
|
@ -1247,8 +1247,8 @@ int32_t timeDiffFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *p
|
|||
} else if (tsDigits == TSDB_TIME_PRECISION_NANO_DIGITS) {
|
||||
timeVal[k] = timeVal[k];
|
||||
} else {
|
||||
colDataAppendNULL(pOutput->columnData, i);
|
||||
continue;
|
||||
hasNull = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue