feat(query): add timediff function

TD-14243
This commit is contained in:
Ganlin Zhao 2022-04-13 12:38:57 +08:00 committed by Ganlin Zhao
parent 9a09f15de8
commit eabfc7d31c
1 changed files with 6 additions and 4 deletions

View File

@ -1168,12 +1168,14 @@ int32_t timeDiffFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *p
} }
} }
if (pInput[k].numOfRows != 1) {
if (IS_VAR_DATA_TYPE(type)) { if (IS_VAR_DATA_TYPE(type)) {
input[k] += varDataTLen(input[k]); input[k] += varDataTLen(input[k]);
} else { } else {
input[k] += tDataTypes[type].bytes; input[k] += tDataTypes[type].bytes;
} }
} }
}
int64_t result = (timeVal[0] >= timeVal[1]) ? (timeVal[0] - timeVal[1]) : int64_t result = (timeVal[0] >= timeVal[1]) ? (timeVal[0] - timeVal[1]) :
(timeVal[1] - timeVal[0]); (timeVal[1] - timeVal[0]);