diff --git a/source/client/inc/clientLog.h b/source/client/inc/clientLog.h index 541717c7eb4bf9719e49ce0482b0df95625199c6..0cb36ff61db570f2c6fb488d2964fc38c2cfd7f4 100644 --- a/source/client/inc/clientLog.h +++ b/source/client/inc/clientLog.h @@ -30,7 +30,7 @@ extern "C" { #define tscDebug(...) do { if (cDebugFlag & DEBUG_DEBUG) { taosPrintLog("TSC ", DEBUG_DEBUG, cDebugFlag, __VA_ARGS__); }} while(0) #define tscTrace(...) do { if (cDebugFlag & DEBUG_TRACE) { taosPrintLog("TSC ", DEBUG_TRACE, cDebugFlag, __VA_ARGS__); }} while(0) #define tscDebugL(...) do { if (cDebugFlag & DEBUG_DEBUG) { taosPrintLongString("TSC ", DEBUG_DEBUG, cDebugFlag, __VA_ARGS__); }} while(0) -#define tscPerf(...) do { taosPrintLog("TSC ", 0, cDebugFlag, __VA_ARGS__); } while(0) +//#define tscPerf(...) do { if (cDebugFlag & DEBUG_INFO) { taosPrintLog("TSC ", DEBUG_INFO, cDebugFlag, __VA_ARGS__); }} while(0) // clang-format on #ifdef __cplusplus diff --git a/source/client/src/clientEnv.c b/source/client/src/clientEnv.c index be0e6d50dc66f272c03fed5eab79edc84b36b247..0f6d394611504828e48766c9b471b02fb04b3916 100644 --- a/source/client/src/clientEnv.c +++ b/source/client/src/clientEnv.c @@ -77,19 +77,19 @@ static void deregisterRequest(SRequestObj *pRequest) { pRequest->self, pTscObj->id, pRequest->requestId, duration / 1000.0, num, currentInst); if (QUERY_NODE_VNODE_MODIF_STMT == pRequest->stmtType) { - tscPerf("insert duration %" PRId64 "us: syntax:%" PRId64 "us, ctg:%" PRId64 "us, semantic:%" PRId64 - "us, exec:%" PRId64 "us", - duration, pRequest->metric.syntaxEnd - pRequest->metric.syntaxStart, - pRequest->metric.ctgEnd - pRequest->metric.ctgStart, pRequest->metric.semanticEnd - pRequest->metric.ctgEnd, - pRequest->metric.execEnd - pRequest->metric.semanticEnd); +// tscPerf("insert duration %" PRId64 "us: syntax:%" PRId64 "us, ctg:%" PRId64 "us, semantic:%" PRId64 +// "us, exec:%" PRId64 "us", +// duration, pRequest->metric.syntaxEnd - pRequest->metric.syntaxStart, +// pRequest->metric.ctgEnd - pRequest->metric.ctgStart, pRequest->metric.semanticEnd - pRequest->metric.ctgEnd, +// pRequest->metric.execEnd - pRequest->metric.semanticEnd); atomic_add_fetch_64((int64_t *)&pActivity->insertElapsedTime, duration); } else if (QUERY_NODE_SELECT_STMT == pRequest->stmtType) { - tscPerf("select duration %" PRId64 "us: syntax:%" PRId64 "us, ctg:%" PRId64 "us, semantic:%" PRId64 - "us, planner:%" PRId64 "us, exec:%" PRId64 "us, reqId:0x%" PRIx64, - duration, pRequest->metric.syntaxEnd - pRequest->metric.syntaxStart, - pRequest->metric.ctgEnd - pRequest->metric.ctgStart, pRequest->metric.semanticEnd - pRequest->metric.ctgEnd, - pRequest->metric.planEnd - pRequest->metric.semanticEnd, - pRequest->metric.resultReady - pRequest->metric.planEnd, pRequest->requestId); +// tscPerf("select duration %" PRId64 "us: syntax:%" PRId64 "us, ctg:%" PRId64 "us, semantic:%" PRId64 +// "us, planner:%" PRId64 "us, exec:%" PRId64 "us, reqId:0x%" PRIx64, +// duration, pRequest->metric.syntaxEnd - pRequest->metric.syntaxStart, +// pRequest->metric.ctgEnd - pRequest->metric.ctgStart, pRequest->metric.semanticEnd - pRequest->metric.ctgEnd, +// pRequest->metric.planEnd - pRequest->metric.semanticEnd, +// pRequest->metric.resultReady - pRequest->metric.planEnd, pRequest->requestId); atomic_add_fetch_64((int64_t *)&pActivity->queryElapsedTime, duration); } diff --git a/source/common/src/ttime.c b/source/common/src/ttime.c index e0cc5bd311926a7beb76a1bf9cf6e257a7805fa4..1b140e6c042783c31180a7f1d8cfc80312052fc7 100644 --- a/source/common/src/ttime.c +++ b/source/common/src/ttime.c @@ -507,29 +507,29 @@ int64_t convertTimeFromPrecisionToUnit(int64_t time, int32_t fromPrecision, char double tmp = time; switch (toUnit) { case 's': { - tmp /= (NANOSECOND_PER_SEC / factors[fromPrecision]); // the result of division is an integer time /= (NANOSECOND_PER_SEC / factors[fromPrecision]); + tmp = (double)time; break; } case 'm': - tmp /= (NANOSECOND_PER_MINUTE / factors[fromPrecision]); // the result of division is an integer time /= (NANOSECOND_PER_MINUTE / factors[fromPrecision]); + tmp = (double)time; break; case 'h': - tmp /= (NANOSECOND_PER_HOUR / factors[fromPrecision]); // the result of division is an integer time /= (NANOSECOND_PER_HOUR / factors[fromPrecision]); + tmp = (double)time; break; case 'd': - tmp /= (NANOSECOND_PER_DAY / factors[fromPrecision]); // the result of division is an integer time /= (NANOSECOND_PER_DAY / factors[fromPrecision]); + tmp = (double)time; break; case 'w': - tmp /= (NANOSECOND_PER_WEEK / factors[fromPrecision]); // the result of division is an integer time /= (NANOSECOND_PER_WEEK / factors[fromPrecision]); + tmp = (double)time; break; case 'a': - tmp /= (NANOSECOND_PER_MSEC / factors[fromPrecision]); // the result of division is an integer time /= (NANOSECOND_PER_MSEC / factors[fromPrecision]); + tmp = (double)time; break; case 'u': // the result of (NANOSECOND_PER_USEC/(double)factors[fromPrecision]) maybe a double @@ -540,13 +540,13 @@ int64_t convertTimeFromPrecisionToUnit(int64_t time, int32_t fromPrecision, char break; } case TSDB_TIME_PRECISION_MICRO: { - tmp /= 1; time /= 1; + tmp = (double)time; break; } case TSDB_TIME_PRECISION_NANO: { - tmp /= 1000; time /= 1000; + tmp = (double)time; break; } } diff --git a/source/libs/scalar/src/filter.c b/source/libs/scalar/src/filter.c index e7f3fe7b4909d55df38b7e750164fc5982073bc4..426274a20fbf0a2c5cc1393f341b72f9ca57fff3 100644 --- a/source/libs/scalar/src/filter.c +++ b/source/libs/scalar/src/filter.c @@ -248,9 +248,9 @@ int8_t filterGetCompFuncIdx(int32_t type, int32_t optr) { } } - if (optr == OP_TYPE_JSON_CONTAINS && type == TSDB_DATA_TYPE_JSON) { - return 28; - } +// if (optr == OP_TYPE_JSON_CONTAINS && type == TSDB_DATA_TYPE_JSON) { +// return 28; +// } switch (type) { case TSDB_DATA_TYPE_BOOL: diff --git a/source/libs/scalar/src/sclvector.c b/source/libs/scalar/src/sclvector.c index 415ceeb2bda1c32439566a676bd99c5d702dd686..4cf4862136592fc5f367e56b2585dc6c6dbe0162 100644 --- a/source/libs/scalar/src/sclvector.c +++ b/source/libs/scalar/src/sclvector.c @@ -505,7 +505,7 @@ bool convertJsonValue(__compar_fn_t *fp, int32_t optr, int8_t typeLeft, int8_t t (*pLeftData)++; } if (typeRight == TSDB_DATA_TYPE_JSON) { - if (tTagIsJson(*pLeftData)) { + if (tTagIsJson(*pRightData)) { terrno = TSDB_CODE_QRY_JSON_NOT_SUPPORT_ERROR; return false; } diff --git a/source/util/src/tstrbuild.c b/source/util/src/tstrbuild.c index c87b889e82ece82c251ddabad1964bc1f0b3ab2f..915f877fe861a909ef334d4b3c3deb1ee3ba129c 100644 --- a/source/util/src/tstrbuild.c +++ b/source/util/src/tstrbuild.c @@ -58,6 +58,7 @@ void taosStringBuilderAppendChar(SStringBuilder* sb, char c) { void taosStringBuilderAppendStringLen(SStringBuilder* sb, const char* str, size_t len) { taosStringBuilderEnsureCapacity(sb, len); + if(!sb->buf) return; memcpy(sb->buf + sb->pos, str, len); sb->pos += len; } diff --git a/utils/test/c/sml_test.c b/utils/test/c/sml_test.c index ab520e66387f9b7644d9dd64aeb1ae811d97fcf5..83dfa1fc576cc883a205e891ca4dc1c8258daf12 100644 --- a/utils/test/c/sml_test.c +++ b/utils/test/c/sml_test.c @@ -1084,6 +1084,35 @@ int sml_19221_Test() { return code; } +int sml_time_Test() { + TAOS *taos = taos_connect("localhost", "root", "taosdata", NULL, 0); + + TAOS_RES *pRes = taos_query(taos, "create database if not exists sml_db schemaless 1"); + taos_free_result(pRes); + + const char *sql[] = { + "meters,location=California.LosAngeles,groupid=2 current=11.8,voltage=221,phase='2022-02-02 10:22:22' 1626006833639000000", + }; + + pRes = taos_query(taos, "use sml_db"); + taos_free_result(pRes); + + char* tmp = (char*)taosMemoryCalloc(1024, 1); + memcpy(tmp, sql[0], strlen(sql[0])); + *(char*)(tmp+44) = 0; + int32_t totalRows = 0; + pRes = taos_schemaless_insert_raw(taos, tmp, strlen(sql[0]), &totalRows, TSDB_SML_LINE_PROTOCOL, TSDB_SML_TIMESTAMP_NANO_SECONDS); + + ASSERT(totalRows == 3); + printf("%s result:%s\n", __FUNCTION__, taos_errstr(pRes)); + int code = taos_errno(pRes); + taos_free_result(pRes); + taos_close(taos); + taosMemoryFree(tmp); + + return code; +} + int main(int argc, char *argv[]) { int ret = 0; ret = smlProcess_influx_Test();