refactor: do some internal refactor.

This commit is contained in:
Haojun Liao 2022-06-12 00:31:34 +08:00
parent f5dacec38d
commit c2e8aa9659
2 changed files with 4 additions and 4 deletions

View File

@ -338,7 +338,7 @@ int32_t parseLocaltime(char* timestr, int32_t len, int64_t* time, int32_t timePr
struct tm tm = {0};
char* str = taosStrpTime(timestr, "%Y-%m-%d %H:%M:%S", &tm);
if (str == NULL || ((str - timestr) < len) || !validateTm(&tm)) {
if (str == NULL || (((str - timestr) < len) && (*str != '.')) || !validateTm(&tm)) {
return -1;
}
@ -373,7 +373,7 @@ int32_t parseLocaltimeDst(char* timestr, int32_t len, int64_t* time, int32_t tim
tm.tm_isdst = -1;
char* str = taosStrpTime(timestr, "%Y-%m-%d %H:%M:%S", &tm);
if (str == NULL || ((str - timestr) < len) || !validateTm(&tm)) {
if (str == NULL || (((str - timestr) < len) && (*str != '.')) || !validateTm(&tm)) {
return -1;
}

View File

@ -4201,13 +4201,13 @@ int32_t sampleFunction(SqlFunctionCtx* pCtx) {
doReservoirSample(pInfo, data, tsList[i], i);
}
for (int32_t i = alreadySampled; i < pInfo->numSampled; ++i) {
for (int32_t i = 0; i < pInfo->numSampled; ++i) {
int32_t pos = startOffset + i;
colDataAppend(pOutput, pos, pInfo->data + i * pInfo->colBytes, false);
//TODO: handle ts output
}
return pInfo->numSampled - alreadySampled;
return pInfo->numSampled;
}
bool getTailFuncEnv(SFunctionNode* pFunc, SFuncExecEnv* pEnv) {