Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
d212be8a
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
Star
22015
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
d212be8a
编写于
10月 26, 2022
作者:
wmmhello
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix:defects in coverity
上级
212c7825
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
54 addition
and
24 deletion
+54
-24
source/client/inc/clientLog.h
source/client/inc/clientLog.h
+1
-1
source/client/src/clientEnv.c
source/client/src/clientEnv.c
+11
-11
source/common/src/ttime.c
source/common/src/ttime.c
+8
-8
source/libs/scalar/src/filter.c
source/libs/scalar/src/filter.c
+3
-3
source/libs/scalar/src/sclvector.c
source/libs/scalar/src/sclvector.c
+1
-1
source/util/src/tstrbuild.c
source/util/src/tstrbuild.c
+1
-0
utils/test/c/sml_test.c
utils/test/c/sml_test.c
+29
-0
未找到文件。
source/client/inc/clientLog.h
浏览文件 @
d212be8a
...
...
@@ -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
...
...
source/client/src/clientEnv.c
浏览文件 @
d212be8a
...
...
@@ -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
);
}
...
...
source/common/src/ttime.c
浏览文件 @
d212be8a
...
...
@@ -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
;
}
}
...
...
source/libs/scalar/src/filter.c
浏览文件 @
d212be8a
...
...
@@ -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
:
...
...
source/libs/scalar/src/sclvector.c
浏览文件 @
d212be8a
...
...
@@ -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
(
*
p
Lef
tData
))
{
if
(
tTagIsJson
(
*
p
Righ
tData
))
{
terrno
=
TSDB_CODE_QRY_JSON_NOT_SUPPORT_ERROR
;
return
false
;
}
...
...
source/util/src/tstrbuild.c
浏览文件 @
d212be8a
...
...
@@ -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
;
}
...
...
utils/test/c/sml_test.c
浏览文件 @
d212be8a
...
...
@@ -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
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录