Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
7522fb75
TDengine
项目概览
taosdata
/
TDengine
接近 2 年 前同步成功
通知
1191
Star
22018
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
7522fb75
编写于
11月 21, 2021
作者:
Z
zyyang-taosdata
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' into release/TS-453
上级
5685a776
3907637d
变更
92
展开全部
隐藏空白更改
内联
并排
Showing
92 changed file
with
2301 addition
and
1719 deletion
+2301
-1719
Jenkinsfile
Jenkinsfile
+77
-1
cmake/version.inc
cmake/version.inc
+1
-1
deps/MsvcLibX/src/filetime.c
deps/MsvcLibX/src/filetime.c
+12
-12
deps/cJson/src/cJSON.c
deps/cJson/src/cJSON.c
+11
-11
deps/iconv/gentranslit.c
deps/iconv/gentranslit.c
+8
-8
deps/iconv/iconv.c
deps/iconv/iconv.c
+6
-6
deps/jni/windows/win32/bridge/AccessBridgeCalls.c
deps/jni/windows/win32/bridge/AccessBridgeCalls.c
+17
-17
deps/lua/src/loadlib.c
deps/lua/src/loadlib.c
+3
-3
deps/regex/regcomp.c
deps/regex/regcomp.c
+4
-4
snap/snapcraft.yaml
snap/snapcraft.yaml
+2
-2
src/client/CMakeLists.txt
src/client/CMakeLists.txt
+6
-3
src/client/src/tscAsync.c
src/client/src/tscAsync.c
+1
-1
src/client/src/tscGlobalmerge.c
src/client/src/tscGlobalmerge.c
+5
-6
src/client/src/tscLocal.c
src/client/src/tscLocal.c
+8
-8
src/client/src/tscParseInsert.c
src/client/src/tscParseInsert.c
+80
-80
src/client/src/tscParseLineProtocol.c
src/client/src/tscParseLineProtocol.c
+39
-39
src/client/src/tscPrepare.c
src/client/src/tscPrepare.c
+124
-124
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+277
-273
src/client/src/tscServer.c
src/client/src/tscServer.c
+12
-12
src/client/src/tscStream.c
src/client/src/tscStream.c
+20
-20
src/client/src/tscSubquery.c
src/client/src/tscSubquery.c
+21
-21
src/client/src/tscSystem.c
src/client/src/tscSystem.c
+14
-14
src/client/src/tscUtil.c
src/client/src/tscUtil.c
+38
-38
src/common/src/tdataformat.c
src/common/src/tdataformat.c
+3
-3
src/common/src/tglobal.c
src/common/src/tglobal.c
+5
-5
src/common/src/tname.c
src/common/src/tname.c
+8
-8
src/common/src/ttypes.c
src/common/src/ttypes.c
+8
-8
src/cq/src/cqMain.c
src/cq/src/cqMain.c
+1
-1
src/dnode/src/dnodeCheck.c
src/dnode/src/dnodeCheck.c
+13
-13
src/dnode/src/dnodePeer.c
src/dnode/src/dnodePeer.c
+24
-24
src/dnode/src/dnodeShell.c
src/dnode/src/dnodeShell.c
+12
-12
src/kit/shell/src/shellImport.c
src/kit/shell/src/shellImport.c
+2
-2
src/kit/taosdemo/taosdemo.c
src/kit/taosdemo/taosdemo.c
+246
-246
src/mnode/src/mnodeCluster.c
src/mnode/src/mnodeCluster.c
+2
-2
src/mnode/src/mnodeMnode.c
src/mnode/src/mnodeMnode.c
+17
-17
src/mnode/src/mnodeSdb.c
src/mnode/src/mnodeSdb.c
+12
-12
src/mnode/src/mnodeShow.c
src/mnode/src/mnodeShow.c
+1
-1
src/os/CMakeLists.txt
src/os/CMakeLists.txt
+3
-2
src/os/src/detail/osDir.c
src/os/src/detail/osDir.c
+2
-2
src/os/src/detail/osFile.c
src/os/src/detail/osFile.c
+6
-6
src/os/src/detail/osTime.c
src/os/src/detail/osTime.c
+32
-32
src/os/src/linux/osSystem.c
src/os/src/linux/osSystem.c
+2
-2
src/os/src/windows/wString.c
src/os/src/windows/wString.c
+3
-3
src/plugins/http/src/httpUtil.c
src/plugins/http/src/httpUtil.c
+2
-2
src/query/CMakeLists.txt
src/query/CMakeLists.txt
+6
-2
src/query/src/qAggMain.c
src/query/src/qAggMain.c
+25
-25
src/query/src/qExecutor.c
src/query/src/qExecutor.c
+47
-44
src/query/src/qExtbuffer.c
src/query/src/qExtbuffer.c
+13
-13
src/query/src/qFill.c
src/query/src/qFill.c
+13
-13
src/query/src/qHistogram.c
src/query/src/qHistogram.c
+16
-16
src/query/src/qPercentile.c
src/query/src/qPercentile.c
+29
-29
src/query/src/qPlan.c
src/query/src/qPlan.c
+3
-3
src/query/src/qSqlParser.c
src/query/src/qSqlParser.c
+7
-5
src/query/src/qTsbuf.c
src/query/src/qTsbuf.c
+5
-5
src/query/src/qUtil.c
src/query/src/qUtil.c
+3
-3
src/rpc/src/rpcCache.c
src/rpc/src/rpcCache.c
+12
-12
src/rpc/src/rpcTcp.c
src/rpc/src/rpcTcp.c
+8
-8
src/rpc/src/rpcUdp.c
src/rpc/src/rpcUdp.c
+5
-5
src/rpc/test/rclient.c
src/rpc/test/rclient.c
+24
-24
src/rpc/test/rsclient.c
src/rpc/test/rsclient.c
+24
-24
src/rpc/test/rserver.c
src/rpc/test/rserver.c
+17
-17
src/sync/src/syncMain.c
src/sync/src/syncMain.c
+55
-55
src/sync/src/syncRetrieve.c
src/sync/src/syncRetrieve.c
+7
-7
src/sync/test/syncClient.c
src/sync/test/syncClient.c
+24
-24
src/sync/test/syncServer.c
src/sync/test/syncServer.c
+34
-34
src/tsdb/src/tsdbFS.c
src/tsdb/src/tsdbFS.c
+6
-6
src/tsdb/src/tsdbMain.c
src/tsdb/src/tsdbMain.c
+10
-10
src/tsdb/src/tsdbMeta.c
src/tsdb/src/tsdbMeta.c
+18
-18
src/tsdb/src/tsdbRead.c
src/tsdb/src/tsdbRead.c
+123
-101
src/util/CMakeLists.txt
src/util/CMakeLists.txt
+3
-1
src/util/src/hash.c
src/util/src/hash.c
+1
-1
src/util/src/tarray.c
src/util/src/tarray.c
+18
-18
src/util/src/tcache.c
src/util/src/tcache.c
+4
-4
src/util/src/tcompare.c
src/util/src/tcompare.c
+2
-2
src/util/src/tmempool.c
src/util/src/tmempool.c
+6
-6
src/util/src/tnettest.c
src/util/src/tnettest.c
+15
-15
src/util/src/tref.c
src/util/src/tref.c
+3
-3
src/vnode/src/vnodeMain.c
src/vnode/src/vnodeMain.c
+2
-2
src/vnode/src/vnodeSync.c
src/vnode/src/vnodeSync.c
+2
-2
src/wal/test/waltest.c
src/wal/test/waltest.c
+4
-4
tests/examples/c/demo.c
tests/examples/c/demo.c
+2
-2
tests/examples/c/stream.c
tests/examples/c/stream.c
+3
-3
tests/examples/lua/lua51/lua_connector51.c
tests/examples/lua/lua51/lua_connector51.c
+3
-3
tests/examples/lua/lua_connector.c
tests/examples/lua/lua_connector.c
+3
-3
tests/pytest/fulltest.sh
tests/pytest/fulltest.sh
+2
-2
tests/pytest/functions/queryTestCases.py
tests/pytest/functions/queryTestCases.py
+467
-22
tests/pytest/query/queryGroupTbname.py
tests/pytest/query/queryGroupTbname.py
+21
-0
tests/robust/robust.c
tests/robust/robust.c
+3
-3
tests/script/api/stmt.c
tests/script/api/stmt.c
+4
-4
tests/tsim/src/simExe.c
tests/tsim/src/simExe.c
+2
-2
tests/tsim/src/simParse.c
tests/tsim/src/simParse.c
+5
-5
tests/tsim/src/simSystem.c
tests/tsim/src/simSystem.c
+2
-2
未找到文件。
Jenkinsfile
浏览文件 @
7522fb75
...
...
@@ -181,7 +181,76 @@ def pre_test_noinstall(){
'''
return
1
}
def
pre_test_ningsi
(){
sh
'hostname'
sh
'''
cd ${WKC}
git reset --hard HEAD~10 >/dev/null
'''
script
{
if
(
env
.
CHANGE_TARGET
==
'master'
)
{
sh
'''
cd ${WKC}
git checkout master
'''
}
else
if
(
env
.
CHANGE_TARGET
==
'2.0'
){
sh
'''
cd ${WKC}
git checkout 2.0
'''
}
else
{
sh
'''
cd ${WKC}
git checkout develop
'''
}
}
sh
'''
cd ${WKC}
git pull >/dev/null
git fetch origin +refs/pull/${CHANGE_ID}/merge
git checkout -qf FETCH_HEAD
git clean -dfx
git submodule update --init --recursive
cd ${WK}
git reset --hard HEAD~10
'''
script
{
if
(
env
.
CHANGE_TARGET
==
'master'
)
{
sh
'''
cd ${WK}
git checkout master
'''
}
else
if
(
env
.
CHANGE_TARGET
==
'2.0'
){
sh
'''
cd ${WK}
git checkout 2.0
'''
}
else
{
sh
'''
cd ${WK}
git checkout develop
'''
}
}
sh
'''
cd ${WK}
git pull >/dev/null
export TZ=Asia/Harbin
date
git clean -dfx
mkdir debug
cd debug
cmake .. -DOSTYPE=Ningsi60 > /dev/null
make
'''
return
1
}
def
pre_test_win
(){
bat
'''
taskkill /f /t /im python.exe
...
...
@@ -578,6 +647,13 @@ pipeline {
pre_test_noinstall
()
}
}
stage
(
'ningsi'
)
{
agent
{
label
"ningsi"
}
steps
{
pre_test_ningsi
()
}
}
stage
(
'build'
){
agent
{
label
" wintest "
}
...
...
cmake/version.inc
浏览文件 @
7522fb75
...
...
@@ -4,7 +4,7 @@ PROJECT(TDengine)
IF
(
DEFINED
VERNUMBER
)
SET
(
TD_VER_NUMBER
$
{
VERNUMBER
})
ELSE
()
SET
(
TD_VER_NUMBER
"2.2.
1.3
"
)
SET
(
TD_VER_NUMBER
"2.2.
2.0
"
)
ENDIF
()
IF
(
DEFINED
VERCOMPATIBLE
)
...
...
deps/MsvcLibX/src/filetime.c
浏览文件 @
7522fb75
...
...
@@ -29,7 +29,7 @@
A Unix time_t is the number of 1-second intervals since January 1, 1970.
time_ts are expressed in the GMT time zone. DOS times in the current local time.
*/
time_t
Filetime2Timet
(
uint16_t
date
,
uint16_t
time
)
{
time_t
Filetime2Timet
(
uint16_t
date
,
uint16_t
deps_
time
)
{
unsigned
int
year
,
month
,
day
,
hour
,
minute
,
second
;
struct
tm
stm
;
...
...
@@ -37,9 +37,9 @@ time_t Filetime2Timet(uint16_t date, uint16_t time) {
year
=
1980
+
((
date
&
0xFE00
)
>>
9
);
month
=
(
date
&
0x1E0
)
>>
5
;
day
=
date
&
0x1F
;
hour
=
(
time
&
0xF800
)
>>
11
;
minute
=
(
time
&
0x7E0
)
>>
5
;
second
=
2
*
(
time
&
0x1F
);
hour
=
(
deps_
time
&
0xF800
)
>>
11
;
minute
=
(
deps_
time
&
0x7E0
)
>>
5
;
second
=
2
*
(
deps_
time
&
0x1F
);
stm
.
tm_year
=
(
int
)
year
-
1900
;
stm
.
tm_mon
=
(
int
)
month
-
1
;
...
...
@@ -55,7 +55,7 @@ time_t Filetime2Timet(uint16_t date, uint16_t time) {
#if 0
/* Older version of the same, trying to generate the time_t manually.
Did not handle DST well */
time_t Filetime2Timet(uint16_t date, uint16_t time) {
time_t Filetime2Timet(uint16_t date, uint16_t
deps_
time) {
unsigned int year, month, day, hour, minute, second;
unsigned int olympiads; /* 4-year periods */
unsigned long t = 0;
...
...
@@ -64,9 +64,9 @@ time_t Filetime2Timet(uint16_t date, uint16_t time) {
year = 1980 + ((date & 0xFE00) >> 9);
month = (date & 0x1E0) >> 5;
day = date & 0x1F;
hour = (time & 0xF800) >> 11;
minute = (time & 0x7E0) >> 5;
second = 2 * (time & 0x1F);
hour = (
deps_
time & 0xF800) >> 11;
minute = (
deps_
time & 0x7E0) >> 5;
second = 2 * (
deps_
time & 0x1F);
/* Count days */
year -= 1970; /* Start of Unix time_t epoch */
...
...
@@ -111,16 +111,16 @@ time_t Filetime2Timet(uint16_t date, uint16_t time) {
#endif
/* Generate a string with the local file time, in the ISO 8601 date/time format */
char
*
Filetime2String
(
uint16_t
date
,
uint16_t
time
,
char
*
pBuf
,
size_t
nBufSize
)
{
char
*
Filetime2String
(
uint16_t
date
,
uint16_t
deps_
time
,
char
*
pBuf
,
size_t
nBufSize
)
{
unsigned
int
year
,
month
,
day
,
hour
,
minute
,
second
;
/* Decode fields */
year
=
1980
+
((
date
&
0xFE00
)
>>
9
);
month
=
(
date
&
0x1E0
)
>>
5
;
day
=
date
&
0x1F
;
hour
=
(
time
&
0xF800
)
>>
11
;
minute
=
(
time
&
0x7E0
)
>>
5
;
second
=
2
*
(
time
&
0x1F
);
hour
=
(
deps_
time
&
0xF800
)
>>
11
;
minute
=
(
deps_
time
&
0x7E0
)
>>
5
;
second
=
2
*
(
deps_
time
&
0x1F
);
if
(
nBufSize
>=
20
)
{
sprintf
(
pBuf
,
"%04d-%02d-%02d %02d:%02d:%02d"
,
year
,
month
,
day
,
hour
,
minute
,
second
);
...
...
deps/cJson/src/cJSON.c
浏览文件 @
7522fb75
...
...
@@ -49,8 +49,8 @@
typedef
struct
{
const
unsigned
char
*
json
;
size_t
position
;
}
error
;
static
error
global_error
=
{
NULL
,
0
};
}
deps_
error
;
static
deps_
error
global_error
=
{
NULL
,
0
};
CJSON_PUBLIC
(
const
char
*
)
cJSON_GetErrorPtr
(
void
)
{
...
...
@@ -210,8 +210,8 @@ typedef struct
#define can_read(buffer, size) ((buffer != NULL) && (((buffer)->offset + size) <= (buffer)->length))
#define cannot_read(buffer, size) (!can_read(buffer, size))
/* check if the buffer can be accessed at the given index (starting with 0) */
#define can_access_at_index(buffer,
index) ((buffer != NULL) && (((buffer)->offset +
index) < (buffer)->length))
#define cannot_access_at_index(buffer,
index) (!can_access_at_index(buffer,
index))
#define can_access_at_index(buffer,
deps_index) ((buffer != NULL) && (((buffer)->offset + deps_
index) < (buffer)->length))
#define cannot_access_at_index(buffer,
deps_index) (!can_access_at_index(buffer, deps_
index))
/* get a pointer to the buffer at the position */
#define buffer_at_offset(buffer) ((buffer)->content + (buffer)->offset)
...
...
@@ -992,7 +992,7 @@ fail:
if
(
value
!=
NULL
)
{
error
local_error
;
deps_
error
local_error
;
local_error
.
json
=
(
const
unsigned
char
*
)
value
;
local_error
.
position
=
0
;
...
...
@@ -1683,7 +1683,7 @@ CJSON_PUBLIC(int) cJSON_GetArraySize(const cJSON *array)
return
(
int
)
size
;
}
static
cJSON
*
get_array_item
(
const
cJSON
*
array
,
size_t
index
)
static
cJSON
*
get_array_item
(
const
cJSON
*
array
,
size_t
deps_
index
)
{
cJSON
*
current_child
=
NULL
;
...
...
@@ -1693,23 +1693,23 @@ static cJSON* get_array_item(const cJSON *array, size_t index)
}
current_child
=
array
->
child
;
while
((
current_child
!=
NULL
)
&&
(
index
>
0
))
while
((
current_child
!=
NULL
)
&&
(
deps_
index
>
0
))
{
index
--
;
deps_
index
--
;
current_child
=
current_child
->
next
;
}
return
current_child
;
}
CJSON_PUBLIC
(
cJSON
*
)
cJSON_GetArrayItem
(
const
cJSON
*
array
,
int
index
)
CJSON_PUBLIC
(
cJSON
*
)
cJSON_GetArrayItem
(
const
cJSON
*
array
,
int
deps_
index
)
{
if
(
index
<
0
)
if
(
deps_
index
<
0
)
{
return
NULL
;
}
return
get_array_item
(
array
,
(
size_t
)
index
);
return
get_array_item
(
array
,
(
size_t
)
deps_
index
);
}
static
cJSON
*
get_object_item
(
const
cJSON
*
const
object
,
const
char
*
const
name
,
const
cJSON_bool
case_sensitive
)
...
...
deps/iconv/gentranslit.c
浏览文件 @
7522fb75
...
...
@@ -30,7 +30,7 @@ int main (int argc, char *argv[])
{
unsigned
int
data
[
0x100000
];
int
uni2index
[
0x110000
];
int
index
;
int
deps_
index
;
if
(
argc
!=
1
)
exit
(
1
);
...
...
@@ -64,7 +64,7 @@ int main (int argc, char *argv[])
int
j
;
for
(
j
=
0
;
j
<
0x110000
;
j
++
)
uni2index
[
j
]
=
-
1
;
index
=
0
;
deps_
index
=
0
;
for
(;;)
{
c
=
getc
(
stdin
);
if
(
c
==
EOF
)
...
...
@@ -86,8 +86,8 @@ int main (int argc, char *argv[])
if
(
c
==
'\t'
)
break
;
if
(
uni2index
[
j
]
<
0
)
{
uni2index
[
j
]
=
index
;
data
[
index
++
]
=
0
;
uni2index
[
j
]
=
deps_
index
;
data
[
deps_
index
++
]
=
0
;
}
if
(
c
>=
0x80
)
{
/* Finish reading an UTF-8 character. */
...
...
@@ -104,17 +104,17 @@ int main (int argc, char *argv[])
}
}
}
data
[
index
++
]
=
(
unsigned
int
)
c
;
data
[
deps_
index
++
]
=
(
unsigned
int
)
c
;
}
if
(
uni2index
[
j
]
>=
0
)
data
[
uni2index
[
j
]]
=
index
-
uni2index
[
j
]
-
1
;
data
[
uni2index
[
j
]]
=
deps_
index
-
uni2index
[
j
]
-
1
;
do
{
c
=
getc
(
stdin
);
}
while
(
!
(
c
==
EOF
||
c
==
'\n'
));
}
}
printf
(
"static const unsigned int translit_data[%d] = {"
,
index
);
printf
(
"static const unsigned int translit_data[%d] = {"
,
deps_
index
);
{
int
i
;
for
(
i
=
0
;
i
<
index
;
i
++
)
{
for
(
i
=
0
;
i
<
deps_
index
;
i
++
)
{
if
(
data
[
i
]
<
32
)
printf
(
"
\n
%3d,"
,
data
[
i
]);
else
if
(
data
[
i
]
==
'\''
)
...
...
deps/iconv/iconv.c
浏览文件 @
7522fb75
...
...
@@ -491,7 +491,7 @@ const char * iconv_canonicalize (const char * name)
char
*
bp
;
const
struct
alias
*
ap
;
unsigned
int
count
;
unsigned
int
index
;
unsigned
int
deps_
index
;
const
char
*
pool
;
/* Before calling aliases_lookup, convert the input string to upper case,
...
...
@@ -555,23 +555,23 @@ const char * iconv_canonicalize (const char * name)
This is also the case on native Woe32 systems. */
#if __STDC_ISO_10646__ || ((defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__)
if
(
sizeof
(
wchar_t
)
==
4
)
{
index
=
ei_ucs4internal
;
deps_
index
=
ei_ucs4internal
;
break
;
}
if
(
sizeof
(
wchar_t
)
==
2
)
{
index
=
ei_ucs2internal
;
deps_
index
=
ei_ucs2internal
;
break
;
}
if
(
sizeof
(
wchar_t
)
==
1
)
{
index
=
ei_iso8859_1
;
deps_
index
=
ei_iso8859_1
;
break
;
}
#endif
}
index
=
ap
->
encoding_index
;
deps_
index
=
ap
->
encoding_index
;
break
;
}
return
all_canonical
[
index
]
+
pool
;
return
all_canonical
[
deps_
index
]
+
pool
;
invalid:
return
name
;
}
...
...
deps/jni/windows/win32/bridge/AccessBridgeCalls.c
浏览文件 @
7522fb75
...
...
@@ -569,9 +569,9 @@ extern "C" {
return
FALSE
;
}
AccessibleContext
GetAccessibleChildFromContext
(
long
vmID
,
AccessibleContext
ac
,
jint
index
)
{
AccessibleContext
GetAccessibleChildFromContext
(
long
vmID
,
AccessibleContext
ac
,
jint
deps_
index
)
{
if
(
theAccessBridgeInitializedFlag
==
TRUE
)
{
return
theAccessBridge
.
GetAccessibleChildFromContext
(
vmID
,
ac
,
index
);
return
theAccessBridge
.
GetAccessibleChildFromContext
(
vmID
,
ac
,
deps_
index
);
}
return
(
AccessibleContext
)
0
;
}
...
...
@@ -711,9 +711,9 @@ extern "C" {
* return the row number for a cell at a given index
*/
jint
getAccessibleTableRow
(
long
vmID
,
AccessibleTable
table
,
jint
index
)
{
getAccessibleTableRow
(
long
vmID
,
AccessibleTable
table
,
jint
deps_
index
)
{
if
(
theAccessBridgeInitializedFlag
==
TRUE
)
{
return
theAccessBridge
.
getAccessibleTableRow
(
vmID
,
table
,
index
);
return
theAccessBridge
.
getAccessibleTableRow
(
vmID
,
table
,
deps_
index
);
}
return
-
1
;
}
...
...
@@ -722,9 +722,9 @@ extern "C" {
* return the column number for a cell at a given index
*/
jint
getAccessibleTableColumn
(
long
vmID
,
AccessibleTable
table
,
jint
index
)
{
getAccessibleTableColumn
(
long
vmID
,
AccessibleTable
table
,
jint
deps_
index
)
{
if
(
theAccessBridgeInitializedFlag
==
TRUE
)
{
return
theAccessBridge
.
getAccessibleTableColumn
(
vmID
,
table
,
index
);
return
theAccessBridge
.
getAccessibleTableColumn
(
vmID
,
table
,
deps_
index
);
}
return
-
1
;
}
...
...
@@ -753,9 +753,9 @@ extern "C" {
return
FALSE
;
}
BOOL
GetAccessibleTextItems
(
long
vmID
,
AccessibleText
at
,
AccessibleTextItemsInfo
*
textItems
,
jint
index
)
{
BOOL
GetAccessibleTextItems
(
long
vmID
,
AccessibleText
at
,
AccessibleTextItemsInfo
*
textItems
,
jint
deps_
index
)
{
if
(
theAccessBridgeInitializedFlag
==
TRUE
)
{
return
theAccessBridge
.
GetAccessibleTextItems
(
vmID
,
at
,
textItems
,
index
);
return
theAccessBridge
.
GetAccessibleTextItems
(
vmID
,
at
,
textItems
,
deps_
index
);
}
return
FALSE
;
}
...
...
@@ -767,23 +767,23 @@ extern "C" {
return
FALSE
;
}
BOOL
GetAccessibleTextAttributes
(
long
vmID
,
AccessibleText
at
,
jint
index
,
AccessibleTextAttributesInfo
*
attributes
)
{
BOOL
GetAccessibleTextAttributes
(
long
vmID
,
AccessibleText
at
,
jint
deps_
index
,
AccessibleTextAttributesInfo
*
attributes
)
{
if
(
theAccessBridgeInitializedFlag
==
TRUE
)
{
return
theAccessBridge
.
GetAccessibleTextAttributes
(
vmID
,
at
,
index
,
attributes
);
return
theAccessBridge
.
GetAccessibleTextAttributes
(
vmID
,
at
,
deps_
index
,
attributes
);
}
return
FALSE
;
}
BOOL
GetAccessibleTextRect
(
long
vmID
,
AccessibleText
at
,
AccessibleTextRectInfo
*
rectInfo
,
jint
index
)
{
BOOL
GetAccessibleTextRect
(
long
vmID
,
AccessibleText
at
,
AccessibleTextRectInfo
*
rectInfo
,
jint
deps_
index
)
{
if
(
theAccessBridgeInitializedFlag
==
TRUE
)
{
return
theAccessBridge
.
GetAccessibleTextRect
(
vmID
,
at
,
rectInfo
,
index
);
return
theAccessBridge
.
GetAccessibleTextRect
(
vmID
,
at
,
rectInfo
,
deps_
index
);
}
return
FALSE
;
}
BOOL
GetAccessibleTextLineBounds
(
long
vmID
,
AccessibleText
at
,
jint
index
,
jint
*
startIndex
,
jint
*
endIndex
)
{
BOOL
GetAccessibleTextLineBounds
(
long
vmID
,
AccessibleText
at
,
jint
deps_
index
,
jint
*
startIndex
,
jint
*
endIndex
)
{
if
(
theAccessBridgeInitializedFlag
==
TRUE
)
{
return
theAccessBridge
.
GetAccessibleTextLineBounds
(
vmID
,
at
,
index
,
startIndex
,
endIndex
);
return
theAccessBridge
.
GetAccessibleTextLineBounds
(
vmID
,
at
,
deps_
index
,
startIndex
,
endIndex
);
}
return
FALSE
;
}
...
...
@@ -844,7 +844,7 @@ extern "C" {
/*
* This method is used to iterate through the hyperlinks in a component. It
* returns hypertext information for a component starting at hyperlink index
* returns hypertext information for a component starting at hyperlink
deps_
index
* nStartIndex. No more than MAX_HYPERLINKS AccessibleHypertextInfo objects will
* be returned for each call to this method.
* returns FALSE on error.
...
...
@@ -1109,9 +1109,9 @@ extern "C" {
/**
* Gets the text caret location
*/
BOOL
getCaretLocation
(
long
vmID
,
AccessibleContext
ac
,
AccessibleTextRectInfo
*
rectInfo
,
jint
index
)
{
BOOL
getCaretLocation
(
long
vmID
,
AccessibleContext
ac
,
AccessibleTextRectInfo
*
rectInfo
,
jint
deps_
index
)
{
if
(
theAccessBridgeInitializedFlag
==
TRUE
)
{
return
theAccessBridge
.
getCaretLocation
(
vmID
,
ac
,
rectInfo
,
index
);
return
theAccessBridge
.
getCaretLocation
(
vmID
,
ac
,
rectInfo
,
deps_
index
);
}
return
FALSE
;
}
...
...
deps/lua/src/loadlib.c
浏览文件 @
7522fb75
...
...
@@ -114,13 +114,13 @@ static void setprogdir (lua_State *L) {
static
void
pusherror
(
lua_State
*
L
)
{
int
error
=
GetLastError
();
int
lua_
error
=
GetLastError
();
char
buffer
[
128
];
if
(
FormatMessage
(
FORMAT_MESSAGE_IGNORE_INSERTS
|
FORMAT_MESSAGE_FROM_SYSTEM
,
NULL
,
error
,
0
,
buffer
,
sizeof
(
buffer
),
NULL
))
NULL
,
lua_
error
,
0
,
buffer
,
sizeof
(
buffer
),
NULL
))
lua_pushstring
(
L
,
buffer
);
else
lua_pushfstring
(
L
,
"system error %d
\n
"
,
error
);
lua_pushfstring
(
L
,
"system error %d
\n
"
,
lua_
error
);
}
static
void
ll_unloadlib
(
void
*
lib
)
{
...
...
deps/regex/regcomp.c
浏览文件 @
7522fb75
...
...
@@ -120,7 +120,7 @@ static reg_errcode_t build_charclass (re_bitset_ptr_t sbcset,
static
bin_tree_t
*
build_word_op
(
re_dfa_t
*
dfa
,
int
not
,
reg_errcode_t
*
err
);
static
void
free_bin_tree
(
bin_tree_t
*
tree
);
static
bin_tree_t
*
create_tree
(
bin_tree_t
*
left
,
bin_tree_t
*
right
,
re_token_type_t
type
,
int
index
);
re_token_type_t
type
,
int
deps_
index
);
static
bin_tree_t
*
duplicate_tree
(
const
bin_tree_t
*
src
,
re_dfa_t
*
dfa
);
/* This table gives an error message for each of the error codes listed
...
...
@@ -3447,11 +3447,11 @@ free_charset (re_charset_t *cset)
Note: This function automatically free left and right if malloc fails. */
static
bin_tree_t
*
create_tree
(
left
,
right
,
type
,
index
)
create_tree
(
left
,
right
,
type
,
deps_
index
)
bin_tree_t
*
left
;
bin_tree_t
*
right
;
re_token_type_t
type
;
int
index
;
int
deps_
index
;
{
bin_tree_t
*
tree
;
tree
=
re_malloc
(
bin_tree_t
,
1
);
...
...
@@ -3465,7 +3465,7 @@ create_tree (left, right, type, index)
tree
->
left
=
left
;
tree
->
right
=
right
;
tree
->
type
=
type
;
tree
->
node_idx
=
index
;
tree
->
node_idx
=
deps_
index
;
tree
->
first
=
-
1
;
tree
->
next
=
-
1
;
re_node_set_init_empty
(
&
tree
->
eclosure
);
...
...
snap/snapcraft.yaml
浏览文件 @
7522fb75
name
:
tdengine
base
:
core18
version
:
'
2.2.
1.3
'
version
:
'
2.2.
2.0
'
icon
:
snap/gui/t-dengine.svg
summary
:
an open-source big data platform designed and optimized for IoT.
description
:
|
...
...
@@ -72,7 +72,7 @@ parts:
-
usr/bin/taosd
-
usr/bin/taos
-
usr/bin/taosdemo
-
usr/lib/libtaos.so.2.2.
1.3
-
usr/lib/libtaos.so.2.2.
2.0
-
usr/lib/libtaos.so.1
-
usr/lib/libtaos.so
...
...
src/client/CMakeLists.txt
浏览文件 @
7522fb75
...
...
@@ -32,7 +32,9 @@ IF (TD_LINUX)
#MESSAGE(STATUS "build version ${TD_VER_NUMBER}")
SET_TARGET_PROPERTIES
(
taos PROPERTIES VERSION
${
TD_VER_NUMBER
}
SOVERSION 1
)
ADD_SUBDIRECTORY
(
tests
)
IF
(
NOT TD_NINGSI_60
)
ADD_SUBDIRECTORY
(
tests
)
ENDIF
()
ELSEIF
(
TD_DARWIN
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/deps/jni/linux
)
...
...
@@ -53,8 +55,9 @@ ELSEIF (TD_DARWIN)
#SOVERSION dylib version
#MESSAGE(STATUS "build version ${TD_VER_NUMBER}")
SET_TARGET_PROPERTIES
(
taos PROPERTIES VERSION
${
TD_VER_NUMBER
}
SOVERSION 1
)
ADD_SUBDIRECTORY
(
tests
)
IF
(
NOT TD_NINGSI_60
)
ADD_SUBDIRECTORY
(
tests
)
ENDIF
()
ELSEIF
(
TD_WINDOWS
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/deps/jni/windows
)
...
...
src/client/src/tscAsync.c
浏览文件 @
7522fb75
...
...
@@ -236,7 +236,7 @@ void taos_fetch_rows_a(TAOS_RES *tres, __async_cb_func_t fp, void *param) {
return
;
}
if
(
pRes
->
qId
==
0
)
{
if
(
pRes
->
qId
==
0
&&
pSql
->
cmd
.
command
!=
TSDB_SQL_RETRIEVE_EMPTY_RESULT
)
{
tscError
(
"qhandle is invalid"
);
pRes
->
code
=
TSDB_CODE_TSC_INVALID_QHANDLE
;
tscAsyncResultOnError
(
pSql
);
...
...
src/client/src/tscGlobalmerge.c
浏览文件 @
7522fb75
...
...
@@ -33,12 +33,12 @@ typedef struct SCompareParam {
int32_t
groupOrderType
;
}
SCompareParam
;
static
bool
needToMerge
(
SSDataBlock
*
pBlock
,
SArray
*
columnIndexList
,
int32_t
index
,
char
**
buf
)
{
static
bool
needToMerge
(
SSDataBlock
*
pBlock
,
SArray
*
columnIndexList
,
int32_t
tsc_
index
,
char
**
buf
)
{
int32_t
ret
=
0
;
size_t
size
=
taosArrayGetSize
(
columnIndexList
);
if
(
size
>
0
)
{
ret
=
compare_aRv
(
pBlock
,
columnIndexList
,
(
int32_t
)
size
,
index
,
buf
,
TSDB_ORDER_ASC
);
ret
=
compare_aRv
(
pBlock
,
columnIndexList
,
(
int32_t
)
size
,
tsc_
index
,
buf
,
TSDB_ORDER_ASC
);
}
// if ret == 0, means the result belongs to the same group
...
...
@@ -555,9 +555,9 @@ static void savePrevOrderColumns(char** prevRow, SArray* pColumnList, SSDataBloc
int32_t
size
=
(
int32_t
)
taosArrayGetSize
(
pColumnList
);
for
(
int32_t
i
=
0
;
i
<
size
;
++
i
)
{
SColIndex
*
index
=
taosArrayGet
(
pColumnList
,
i
);
SColumnInfoData
*
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
index
->
colIndex
);
assert
(
index
->
colId
==
pColInfo
->
info
.
colId
);
SColIndex
*
tsc_
index
=
taosArrayGet
(
pColumnList
,
i
);
SColumnInfoData
*
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
tsc_
index
->
colIndex
);
assert
(
tsc_
index
->
colId
==
pColInfo
->
info
.
colId
);
memcpy
(
prevRow
[
i
],
pColInfo
->
pData
+
pColInfo
->
info
.
bytes
*
rowIndex
,
pColInfo
->
info
.
bytes
);
}
...
...
@@ -967,7 +967,6 @@ SSDataBlock* doGlobalAggregate(void* param, bool* newgroup) {
if
(
pOperator
->
pRuntimeEnv
->
pQueryAttr
->
order
.
order
==
TSDB_ORDER_DESC
)
{
SWAP
(
w
->
skey
,
w
->
ekey
,
TSKEY
);
assert
(
w
->
skey
<=
w
->
ekey
);
}
}
}
...
...
src/client/src/tscLocal.c
浏览文件 @
7522fb75
...
...
@@ -152,7 +152,7 @@ static int32_t tscSetValueToResObj(SSqlObj *pSql, int32_t rowLen) {
static
int32_t
tscBuildTableSchemaResultFields
(
SSqlObj
*
pSql
,
int32_t
numOfCols
,
int32_t
typeColLength
,
int32_t
noteColLength
)
{
int32_t
rowLen
=
0
;
SColumnIndex
index
=
{
0
};
SColumnIndex
tsc_
index
=
{
0
};
pSql
->
cmd
.
numOfCols
=
numOfCols
;
...
...
@@ -163,7 +163,7 @@ static int32_t tscBuildTableSchemaResultFields(SSqlObj *pSql, int32_t numOfCols,
tstrncpy
(
f
.
name
,
"Field"
,
sizeof
(
f
.
name
));
SInternalField
*
pInfo
=
tscFieldInfoAppend
(
&
pQueryInfo
->
fieldsInfo
,
&
f
);
pInfo
->
pExpr
=
tscExprAppend
(
pQueryInfo
,
TSDB_FUNC_TS_DUMMY
,
&
index
,
TSDB_DATA_TYPE_BINARY
,
pInfo
->
pExpr
=
tscExprAppend
(
pQueryInfo
,
TSDB_FUNC_TS_DUMMY
,
&
tsc_
index
,
TSDB_DATA_TYPE_BINARY
,
(
TSDB_COL_NAME_LEN
-
1
)
+
VARSTR_HEADER_SIZE
,
-
1000
,
(
TSDB_COL_NAME_LEN
-
1
),
false
);
rowLen
+=
((
TSDB_COL_NAME_LEN
-
1
)
+
VARSTR_HEADER_SIZE
);
...
...
@@ -173,7 +173,7 @@ static int32_t tscBuildTableSchemaResultFields(SSqlObj *pSql, int32_t numOfCols,
tstrncpy
(
f
.
name
,
"Type"
,
sizeof
(
f
.
name
));
pInfo
=
tscFieldInfoAppend
(
&
pQueryInfo
->
fieldsInfo
,
&
f
);
pInfo
->
pExpr
=
tscExprAppend
(
pQueryInfo
,
TSDB_FUNC_TS_DUMMY
,
&
index
,
TSDB_DATA_TYPE_BINARY
,
(
int16_t
)(
typeColLength
+
VARSTR_HEADER_SIZE
),
pInfo
->
pExpr
=
tscExprAppend
(
pQueryInfo
,
TSDB_FUNC_TS_DUMMY
,
&
tsc_
index
,
TSDB_DATA_TYPE_BINARY
,
(
int16_t
)(
typeColLength
+
VARSTR_HEADER_SIZE
),
-
1000
,
typeColLength
,
false
);
rowLen
+=
typeColLength
+
VARSTR_HEADER_SIZE
;
...
...
@@ -183,7 +183,7 @@ static int32_t tscBuildTableSchemaResultFields(SSqlObj *pSql, int32_t numOfCols,
tstrncpy
(
f
.
name
,
"Length"
,
sizeof
(
f
.
name
));
pInfo
=
tscFieldInfoAppend
(
&
pQueryInfo
->
fieldsInfo
,
&
f
);
pInfo
->
pExpr
=
tscExprAppend
(
pQueryInfo
,
TSDB_FUNC_TS_DUMMY
,
&
index
,
TSDB_DATA_TYPE_INT
,
sizeof
(
int32_t
),
pInfo
->
pExpr
=
tscExprAppend
(
pQueryInfo
,
TSDB_FUNC_TS_DUMMY
,
&
tsc_
index
,
TSDB_DATA_TYPE_INT
,
sizeof
(
int32_t
),
-
1000
,
sizeof
(
int32_t
),
false
);
rowLen
+=
sizeof
(
int32_t
);
...
...
@@ -193,7 +193,7 @@ static int32_t tscBuildTableSchemaResultFields(SSqlObj *pSql, int32_t numOfCols,
tstrncpy
(
f
.
name
,
"Note"
,
sizeof
(
f
.
name
));
pInfo
=
tscFieldInfoAppend
(
&
pQueryInfo
->
fieldsInfo
,
&
f
);
pInfo
->
pExpr
=
tscExprAppend
(
pQueryInfo
,
TSDB_FUNC_TS_DUMMY
,
&
index
,
TSDB_DATA_TYPE_BINARY
,
(
int16_t
)(
noteColLength
+
VARSTR_HEADER_SIZE
),
pInfo
->
pExpr
=
tscExprAppend
(
pQueryInfo
,
TSDB_FUNC_TS_DUMMY
,
&
tsc_
index
,
TSDB_DATA_TYPE_BINARY
,
(
int16_t
)(
noteColLength
+
VARSTR_HEADER_SIZE
),
-
1000
,
noteColLength
,
false
);
rowLen
+=
noteColLength
+
VARSTR_HEADER_SIZE
;
...
...
@@ -396,7 +396,7 @@ static int32_t tscGetTableTagValue(SCreateBuilder *builder, char *result) {
static
int32_t
tscSCreateBuildResultFields
(
SSqlObj
*
pSql
,
BuildType
type
,
const
char
*
ddl
)
{
int32_t
rowLen
=
0
;
int16_t
ddlLen
=
(
int16_t
)
strlen
(
ddl
);
SColumnIndex
index
=
{
0
};
SColumnIndex
tsc_
index
=
{
0
};
pSql
->
cmd
.
numOfCols
=
2
;
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfo
(
&
pSql
->
cmd
);
...
...
@@ -414,7 +414,7 @@ static int32_t tscSCreateBuildResultFields(SSqlObj *pSql, BuildType type, const
}
SInternalField
*
pInfo
=
tscFieldInfoAppend
(
&
pQueryInfo
->
fieldsInfo
,
&
f
);
pInfo
->
pExpr
=
tscExprAppend
(
pQueryInfo
,
TSDB_FUNC_TS_DUMMY
,
&
index
,
TSDB_DATA_TYPE_BINARY
,
f
.
bytes
,
-
1000
,
f
.
bytes
-
VARSTR_HEADER_SIZE
,
false
);
pInfo
->
pExpr
=
tscExprAppend
(
pQueryInfo
,
TSDB_FUNC_TS_DUMMY
,
&
tsc_
index
,
TSDB_DATA_TYPE_BINARY
,
f
.
bytes
,
-
1000
,
f
.
bytes
-
VARSTR_HEADER_SIZE
,
false
);
rowLen
+=
f
.
bytes
;
...
...
@@ -427,7 +427,7 @@ static int32_t tscSCreateBuildResultFields(SSqlObj *pSql, BuildType type, const
}
pInfo
=
tscFieldInfoAppend
(
&
pQueryInfo
->
fieldsInfo
,
&
f
);
pInfo
->
pExpr
=
tscExprAppend
(
pQueryInfo
,
TSDB_FUNC_TS_DUMMY
,
&
index
,
TSDB_DATA_TYPE_BINARY
,
pInfo
->
pExpr
=
tscExprAppend
(
pQueryInfo
,
TSDB_FUNC_TS_DUMMY
,
&
tsc_
index
,
TSDB_DATA_TYPE_BINARY
,
(
int16_t
)(
ddlLen
+
VARSTR_HEADER_SIZE
),
-
1000
,
ddlLen
,
false
);
rowLen
+=
ddlLen
+
VARSTR_HEADER_SIZE
;
...
...
src/client/src/tscParseInsert.c
浏览文件 @
7522fb75
...
...
@@ -91,8 +91,8 @@ int initMemRowBuilder(SMemRowBuilder *pBuilder, uint32_t nRows, uint3
return
TSDB_CODE_SUCCESS
;
}
int
tsParseTime
(
SStrToken
*
pToken
,
int64_t
*
t
ime
,
char
**
next
,
char
*
error
,
int16_t
timePrec
)
{
int32_t
index
=
0
;
int
tsParseTime
(
SStrToken
*
pToken
,
int64_t
*
t
sc_time
,
char
**
next
,
char
*
tsc_
error
,
int16_t
timePrec
)
{
int32_t
tsc_
index
=
0
;
SStrToken
sToken
;
int64_t
interval
;
int64_t
useconds
=
0
;
...
...
@@ -106,8 +106,8 @@ int tsParseTime(SStrToken *pToken, int64_t *time, char **next, char *error, int1
useconds
=
taosStr2int64
(
pToken
->
z
);
}
else
{
// strptime("2001-11-12 18:31:01", "%Y-%m-%d %H:%M:%S", &tm);
if
(
taosParseTime
(
pToken
->
z
,
time
,
pToken
->
n
,
timePrec
,
tsDaylight
)
!=
TSDB_CODE_SUCCESS
)
{
return
tscInvalidOperationMsg
(
error
,
"invalid timestamp format"
,
pToken
->
z
);
if
(
taosParseTime
(
pToken
->
z
,
t
sc_t
ime
,
pToken
->
n
,
timePrec
,
tsDaylight
)
!=
TSDB_CODE_SUCCESS
)
{
return
tscInvalidOperationMsg
(
tsc_
error
,
"invalid timestamp format"
,
pToken
->
z
);
}
return
TSDB_CODE_SUCCESS
;
...
...
@@ -117,7 +117,7 @@ int tsParseTime(SStrToken *pToken, int64_t *time, char **next, char *error, int1
if
(
isspace
(
pToken
->
z
[
k
]))
continue
;
if
(
pToken
->
z
[
k
]
==
','
)
{
*
next
=
pTokenEnd
;
*
time
=
useconds
;
*
t
sc_t
ime
=
useconds
;
return
0
;
}
...
...
@@ -125,21 +125,21 @@ int tsParseTime(SStrToken *pToken, int64_t *time, char **next, char *error, int1
}
/*
* time expression:
* t
sc_t
ime expression:
* e.g., now+12a, now-5h
*/
SStrToken
valueToken
;
index
=
0
;
sToken
=
tStrGetToken
(
pTokenEnd
,
&
index
,
false
);
pTokenEnd
+=
index
;
tsc_
index
=
0
;
sToken
=
tStrGetToken
(
pTokenEnd
,
&
tsc_
index
,
false
);
pTokenEnd
+=
tsc_
index
;
if
(
sToken
.
type
==
TK_MINUS
||
sToken
.
type
==
TK_PLUS
)
{
index
=
0
;
valueToken
=
tStrGetToken
(
pTokenEnd
,
&
index
,
false
);
pTokenEnd
+=
index
;
tsc_
index
=
0
;
valueToken
=
tStrGetToken
(
pTokenEnd
,
&
tsc_
index
,
false
);
pTokenEnd
+=
tsc_
index
;
if
(
valueToken
.
n
<
2
)
{
return
tscInvalidOperationMsg
(
error
,
"value expected in timestamp"
,
sToken
.
z
);
return
tscInvalidOperationMsg
(
tsc_
error
,
"value expected in timestamp"
,
sToken
.
z
);
}
char
unit
=
0
;
...
...
@@ -156,7 +156,7 @@ int tsParseTime(SStrToken *pToken, int64_t *time, char **next, char *error, int1
*
next
=
pTokenEnd
;
}
*
time
=
useconds
;
*
t
sc_t
ime
=
useconds
;
return
TSDB_CODE_SUCCESS
;
}
...
...
@@ -448,7 +448,7 @@ int32_t tsCheckTimestamp(STableDataBlocks *pDataBlocks, const char *start) {
int
tsParseOneRow
(
char
**
str
,
STableDataBlocks
*
pDataBlocks
,
int16_t
timePrec
,
int32_t
*
len
,
char
*
tmpTokenBuf
,
SInsertStatementParam
*
pInsertParam
)
{
int32_t
index
=
0
;
int32_t
tsc_
index
=
0
;
SStrToken
sToken
=
{
0
};
char
*
row
=
pDataBlocks
->
pData
+
pDataBlocks
->
size
;
// skip the SSubmitBlk header
...
...
@@ -472,9 +472,9 @@ int tsParseOneRow(char **str, STableDataBlocks *pDataBlocks, int16_t timePrec, i
SSchema
*
pSchema
=
&
schema
[
colIndex
];
// get colId here
index
=
0
;
sToken
=
tStrGetToken
(
*
str
,
&
index
,
true
);
*
str
+=
index
;
tsc_
index
=
0
;
sToken
=
tStrGetToken
(
*
str
,
&
tsc_
index
,
true
);
*
str
+=
tsc_
index
;
if
(
sToken
.
type
==
TK_QUESTION
)
{
if
(
!
isParseBindParam
)
{
...
...
@@ -606,7 +606,7 @@ int32_t boundIdxCompar(const void *lhs, const void *rhs) {
int32_t
tsParseValues
(
char
**
str
,
STableDataBlocks
*
pDataBlock
,
int
maxRows
,
SInsertStatementParam
*
pInsertParam
,
int32_t
*
numOfRows
,
char
*
tmpTokenBuf
)
{
int32_t
index
=
0
;
int32_t
tsc_
index
=
0
;
int32_t
code
=
0
;
(
*
numOfRows
)
=
0
;
...
...
@@ -626,11 +626,11 @@ int32_t tsParseValues(char **str, STableDataBlocks *pDataBlock, int maxRows, SIn
return
code
;
}
while
(
1
)
{
index
=
0
;
sToken
=
tStrGetToken
(
*
str
,
&
index
,
false
);
tsc_
index
=
0
;
sToken
=
tStrGetToken
(
*
str
,
&
tsc_
index
,
false
);
if
(
sToken
.
n
==
0
||
sToken
.
type
!=
TK_LP
)
break
;
*
str
+=
index
;
*
str
+=
tsc_
index
;
if
((
*
numOfRows
)
>=
maxRows
||
pDataBlock
->
size
+
extendedRowSize
>=
pDataBlock
->
nAllocSize
)
{
int32_t
tSize
;
code
=
tscAllocateMemIfNeed
(
pDataBlock
,
extendedRowSize
,
&
tSize
);
...
...
@@ -651,13 +651,13 @@ int32_t tsParseValues(char **str, STableDataBlocks *pDataBlock, int maxRows, SIn
pDataBlock
->
size
+=
len
;
index
=
0
;
sToken
=
tStrGetToken
(
*
str
,
&
index
,
false
);
tsc_
index
=
0
;
sToken
=
tStrGetToken
(
*
str
,
&
tsc_
index
,
false
);
if
(
sToken
.
n
==
0
||
sToken
.
type
!=
TK_RP
)
{
return
tscSQLSyntaxErrMsg
(
pInsertParam
->
msg
,
") expected"
,
*
str
);
}
*
str
+=
index
;
*
str
+=
tsc_
index
;
(
*
numOfRows
)
++
;
}
...
...
@@ -905,7 +905,7 @@ static int32_t doParseInsertStatement(SInsertStatementParam *pInsertParam, char
}
static
int32_t
tscCheckIfCreateTable
(
char
**
sqlstr
,
SSqlObj
*
pSql
,
char
**
boundColumn
)
{
int32_t
index
=
0
;
int32_t
tsc_
index
=
0
;
SStrToken
sToken
=
{
0
};
SStrToken
tableToken
=
{
0
};
int32_t
code
=
TSDB_CODE_SUCCESS
;
...
...
@@ -920,14 +920,14 @@ static int32_t tscCheckIfCreateTable(char **sqlstr, SSqlObj *pSql, char** boundC
char
*
sql
=
*
sqlstr
;
// get the token of specified table
index
=
0
;
tableToken
=
tStrGetToken
(
sql
,
&
index
,
false
);
sql
+=
index
;
tsc_
index
=
0
;
tableToken
=
tStrGetToken
(
sql
,
&
tsc_
index
,
false
);
sql
+=
tsc_
index
;
// skip possibly exists column list
index
=
0
;
sToken
=
tStrGetToken
(
sql
,
&
index
,
false
);
sql
+=
index
;
tsc_
index
=
0
;
sToken
=
tStrGetToken
(
sql
,
&
tsc_
index
,
false
);
sql
+=
tsc_
index
;
int32_t
numOfColList
=
0
;
...
...
@@ -936,8 +936,8 @@ static int32_t tscCheckIfCreateTable(char **sqlstr, SSqlObj *pSql, char** boundC
*
boundColumn
=
&
sToken
.
z
[
0
];
while
(
1
)
{
index
=
0
;
sToken
=
tStrGetToken
(
sql
,
&
index
,
false
);
tsc_
index
=
0
;
sToken
=
tStrGetToken
(
sql
,
&
tsc_
index
,
false
);
if
(
sToken
.
type
==
TK_ILLEGAL
)
{
return
tscSQLSyntaxErrMsg
(
pCmd
->
payload
,
"unrecognized token"
,
sToken
.
z
);
...
...
@@ -947,12 +947,12 @@ static int32_t tscCheckIfCreateTable(char **sqlstr, SSqlObj *pSql, char** boundC
break
;
}
sql
+=
index
;
sql
+=
tsc_
index
;
++
numOfColList
;
}
sToken
=
tStrGetToken
(
sql
,
&
index
,
false
);
sql
+=
index
;
sToken
=
tStrGetToken
(
sql
,
&
tsc_
index
,
false
);
sql
+=
tsc_
index
;
}
if
(
numOfColList
==
0
&&
(
*
boundColumn
)
!=
NULL
)
{
...
...
@@ -962,9 +962,9 @@ static int32_t tscCheckIfCreateTable(char **sqlstr, SSqlObj *pSql, char** boundC
STableMetaInfo
*
pTableMetaInfo
=
tscGetMetaInfo
(
pQueryInfo
,
TABLE_INDEX
);
if
(
sToken
.
type
==
TK_USING
)
{
// create table if not exists according to the super table
index
=
0
;
sToken
=
tStrGetToken
(
sql
,
&
index
,
false
);
sql
+=
index
;
tsc_
index
=
0
;
sToken
=
tStrGetToken
(
sql
,
&
tsc_
index
,
false
);
sql
+=
tsc_
index
;
//the source super table is moved to the secondary position of the pTableMetaInfo list
if
(
pQueryInfo
->
numOfTables
<
2
)
{
...
...
@@ -995,8 +995,8 @@ static int32_t tscCheckIfCreateTable(char **sqlstr, SSqlObj *pSql, char** boundC
SParsedDataColInfo
spd
=
{
0
};
tscSetBoundColumnInfo
(
&
spd
,
pTagSchema
,
tscGetNumOfTags
(
pSTableMetaInfo
->
pTableMeta
));
index
=
0
;
sToken
=
tStrGetToken
(
sql
,
&
index
,
false
);
tsc_
index
=
0
;
sToken
=
tStrGetToken
(
sql
,
&
tsc_
index
,
false
);
if
(
sToken
.
type
!=
TK_TAGS
&&
sToken
.
type
!=
TK_LP
)
{
tscDestroyBoundColumnInfo
(
&
spd
);
return
tscSQLSyntaxErrMsg
(
pInsertParam
->
msg
,
"keyword TAGS expected"
,
sToken
.
z
);
...
...
@@ -1017,16 +1017,16 @@ static int32_t tscCheckIfCreateTable(char **sqlstr, SSqlObj *pSql, char** boundC
sql
=
end
;
index
=
0
;
// keywords of "TAGS"
sToken
=
tStrGetToken
(
sql
,
&
index
,
false
);
sql
+=
index
;
tsc_
index
=
0
;
// keywords of "TAGS"
sToken
=
tStrGetToken
(
sql
,
&
tsc_
index
,
false
);
sql
+=
tsc_
index
;
}
else
{
sql
+=
index
;
sql
+=
tsc_
index
;
}
index
=
0
;
sToken
=
tStrGetToken
(
sql
,
&
index
,
false
);
sql
+=
index
;
tsc_
index
=
0
;
sToken
=
tStrGetToken
(
sql
,
&
tsc_
index
,
false
);
sql
+=
tsc_
index
;
if
(
sToken
.
type
!=
TK_LP
)
{
tscDestroyBoundColumnInfo
(
&
spd
);
...
...
@@ -1042,9 +1042,9 @@ static int32_t tscCheckIfCreateTable(char **sqlstr, SSqlObj *pSql, char** boundC
for
(
int
i
=
0
;
i
<
spd
.
numOfBound
;
++
i
)
{
SSchema
*
pSchema
=
&
pTagSchema
[
spd
.
boundedColumns
[
i
]];
index
=
0
;
sToken
=
tStrGetToken
(
sql
,
&
index
,
true
);
sql
+=
index
;
tsc_
index
=
0
;
sToken
=
tStrGetToken
(
sql
,
&
tsc_
index
,
true
);
sql
+=
tsc_
index
;
if
(
TK_ILLEGAL
==
sToken
.
type
)
{
tdDestroyKVRowBuilder
(
&
kvRowBuilder
);
...
...
@@ -1096,9 +1096,9 @@ static int32_t tscCheckIfCreateTable(char **sqlstr, SSqlObj *pSql, char** boundC
free
(
row
);
pInsertParam
->
tagData
.
data
=
pTag
;
index
=
0
;
sToken
=
tStrGetToken
(
sql
,
&
index
,
false
);
sql
+=
index
;
tsc_
index
=
0
;
sToken
=
tStrGetToken
(
sql
,
&
tsc_
index
,
false
);
sql
+=
tsc_
index
;
if
(
sToken
.
n
==
0
||
sToken
.
type
!=
TK_RP
)
{
return
tscSQLSyntaxErrMsg
(
pInsertParam
->
msg
,
") expected"
,
sToken
.
z
);
}
...
...
@@ -1107,9 +1107,9 @@ static int32_t tscCheckIfCreateTable(char **sqlstr, SSqlObj *pSql, char** boundC
* insert into table_name using super_table(tag_name1, tag_name2) tags(tag_val1, tag_val2)
* (normal_col1, normal_col2) values(normal_col1_val, normal_col2_val);
* */
index
=
0
;
sToken
=
tStrGetToken
(
sql
,
&
index
,
false
);
sql
+=
index
;
tsc_
index
=
0
;
sToken
=
tStrGetToken
(
sql
,
&
tsc_
index
,
false
);
sql
+=
tsc_
index
;
int
numOfColsAfterTags
=
0
;
if
(
sToken
.
type
==
TK_LP
)
{
if
(
*
boundColumn
!=
NULL
)
{
...
...
@@ -1119,18 +1119,18 @@ static int32_t tscCheckIfCreateTable(char **sqlstr, SSqlObj *pSql, char** boundC
}
while
(
1
)
{
index
=
0
;
sToken
=
tStrGetToken
(
sql
,
&
index
,
false
);
tsc_
index
=
0
;
sToken
=
tStrGetToken
(
sql
,
&
tsc_
index
,
false
);
if
(
sToken
.
type
==
TK_RP
)
{
break
;
}
if
(
sToken
.
n
==
0
||
sToken
.
type
==
TK_SEMI
||
index
==
0
)
{
if
(
sToken
.
n
==
0
||
sToken
.
type
==
TK_SEMI
||
tsc_
index
==
0
)
{
return
tscSQLSyntaxErrMsg
(
pCmd
->
payload
,
"unexpected token"
,
sql
);
}
sql
+=
index
;
sql
+=
tsc_
index
;
++
numOfColsAfterTags
;
}
...
...
@@ -1138,7 +1138,7 @@ static int32_t tscCheckIfCreateTable(char **sqlstr, SSqlObj *pSql, char** boundC
return
TSDB_CODE_TSC_SQL_SYNTAX_ERROR
;
}
sToken
=
tStrGetToken
(
sql
,
&
index
,
false
);
sToken
=
tStrGetToken
(
sql
,
&
tsc_
index
,
false
);
}
sql
=
sToken
.
z
;
...
...
@@ -1213,9 +1213,9 @@ static int32_t parseBoundColumns(SInsertStatementParam *pInsertParam, SParsedDat
int32_t
code
=
TSDB_CODE_SUCCESS
;
int32_t
index
=
0
;
SStrToken
sToken
=
tStrGetToken
(
str
,
&
index
,
false
);
str
+=
index
;
int32_t
tsc_
index
=
0
;
SStrToken
sToken
=
tStrGetToken
(
str
,
&
tsc_
index
,
false
);
str
+=
tsc_
index
;
if
(
sToken
.
type
!=
TK_LP
)
{
code
=
tscSQLSyntaxErrMsg
(
pInsertParam
->
msg
,
"( is expected"
,
sToken
.
z
);
...
...
@@ -1225,9 +1225,9 @@ static int32_t parseBoundColumns(SInsertStatementParam *pInsertParam, SParsedDat
bool
isOrdered
=
true
;
int32_t
lastColIdx
=
-
1
;
// last column found
while
(
1
)
{
index
=
0
;
sToken
=
tStrGetToken
(
str
,
&
index
,
false
);
str
+=
index
;
tsc_
index
=
0
;
sToken
=
tStrGetToken
(
str
,
&
tsc_
index
,
false
);
str
+=
tsc_
index
;
if
(
TK_STRING
==
sToken
.
type
)
{
tscDequoteAndTrimToken
(
&
sToken
);
...
...
@@ -1378,8 +1378,8 @@ int tsParseInsertSql(SSqlObj *pSql) {
tscDebug
(
"0x%"
PRIx64
" create data block list hashList:%p"
,
pSql
->
self
,
pInsertParam
->
pTableBlockHashList
);
while
(
1
)
{
int32_t
index
=
0
;
SStrToken
sToken
=
tStrGetToken
(
str
,
&
index
,
false
);
int32_t
tsc_
index
=
0
;
SStrToken
sToken
=
tStrGetToken
(
str
,
&
tsc_
index
,
false
);
// no data in the sql string anymore.
if
(
sToken
.
n
==
0
)
{
...
...
@@ -1437,9 +1437,9 @@ int tsParseInsertSql(SSqlObj *pSql) {
goto
_clean
;
}
index
=
0
;
sToken
=
tStrGetToken
(
str
,
&
index
,
false
);
str
+=
index
;
tsc_
index
=
0
;
sToken
=
tStrGetToken
(
str
,
&
tsc_
index
,
false
);
str
+=
tsc_
index
;
if
(
sToken
.
n
==
0
||
(
sToken
.
type
!=
TK_FILE
&&
sToken
.
type
!=
TK_VALUES
))
{
code
=
tscSQLSyntaxErrMsg
(
pInsertParam
->
msg
,
"keyword VALUES or FILE required"
,
sToken
.
z
);
...
...
@@ -1452,13 +1452,13 @@ int tsParseInsertSql(SSqlObj *pSql) {
goto
_clean
;
}
index
=
0
;
sToken
=
tStrGetToken
(
str
,
&
index
,
false
);
tsc_
index
=
0
;
sToken
=
tStrGetToken
(
str
,
&
tsc_
index
,
false
);
if
(
sToken
.
type
!=
TK_STRING
&&
sToken
.
type
!=
TK_ID
)
{
code
=
tscSQLSyntaxErrMsg
(
pInsertParam
->
msg
,
"file path is required following keyword FILE"
,
sToken
.
z
);
goto
_clean
;
}
str
+=
index
;
str
+=
tsc_
index
;
if
(
sToken
.
n
==
0
)
{
code
=
tscSQLSyntaxErrMsg
(
pInsertParam
->
msg
,
"file path is required following keyword FILE"
,
sToken
.
z
);
goto
_clean
;
...
...
@@ -1553,10 +1553,10 @@ int tsInsertInitialCheck(SSqlObj *pSql) {
return
TSDB_CODE_TSC_NO_WRITE_AUTH
;
}
int32_t
index
=
0
;
int32_t
tsc_
index
=
0
;
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
SStrToken
sToken
=
tStrGetToken
(
pSql
->
sqlstr
,
&
index
,
false
);
SStrToken
sToken
=
tStrGetToken
(
pSql
->
sqlstr
,
&
tsc_
index
,
false
);
assert
(
sToken
.
type
==
TK_INSERT
||
sToken
.
type
==
TK_IMPORT
);
pCmd
->
count
=
0
;
...
...
@@ -1566,7 +1566,7 @@ int tsInsertInitialCheck(SSqlObj *pSql) {
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoS
(
pCmd
);
TSDB_QUERY_SET_TYPE
(
pQueryInfo
->
type
,
TSDB_QUERY_TYPE_INSERT
);
sToken
=
tStrGetToken
(
pSql
->
sqlstr
,
&
index
,
false
);
sToken
=
tStrGetToken
(
pSql
->
sqlstr
,
&
tsc_
index
,
false
);
if
(
sToken
.
type
!=
TK_INTO
)
{
return
tscSQLSyntaxErrMsg
(
pInsertParam
->
msg
,
"keyword INTO is expected"
,
sToken
.
z
);
}
...
...
src/client/src/tscParseLineProtocol.c
浏览文件 @
7522fb75
...
...
@@ -970,25 +970,25 @@ static int32_t applyChildTableTags(TAOS* taos, char* cTableName, char* sTableNam
taosArraySetSize
(
tagBinds
,
numTags
);
int
isNullColBind
=
TSDB_TRUE
;
for
(
int
j
=
0
;
j
<
numTags
;
++
j
)
{
TAOS_BIND
*
bind
=
taosArrayGet
(
tagBinds
,
j
);
bind
->
is_null
=
&
isNullColBind
;
TAOS_BIND
*
tsc_
bind
=
taosArrayGet
(
tagBinds
,
j
);
tsc_
bind
->
is_null
=
&
isNullColBind
;
}
for
(
int
j
=
0
;
j
<
numTags
;
++
j
)
{
if
(
tagKVs
[
j
]
==
NULL
)
continue
;
TAOS_SML_KV
*
kv
=
tagKVs
[
j
];
TAOS_BIND
*
bind
=
taosArrayGet
(
tagBinds
,
kv
->
fieldSchemaIdx
);
bind
->
buffer_type
=
kv
->
type
;
bind
->
length
=
malloc
(
sizeof
(
uintptr_t
*
));
*
bind
->
length
=
kv
->
length
;
bind
->
buffer
=
kv
->
value
;
bind
->
is_null
=
NULL
;
TAOS_BIND
*
tsc_
bind
=
taosArrayGet
(
tagBinds
,
kv
->
fieldSchemaIdx
);
tsc_
bind
->
buffer_type
=
kv
->
type
;
tsc_
bind
->
length
=
malloc
(
sizeof
(
uintptr_t
*
));
*
tsc_
bind
->
length
=
kv
->
length
;
tsc_
bind
->
buffer
=
kv
->
value
;
tsc_
bind
->
is_null
=
NULL
;
}
int32_t
code
=
creatChildTableIfNotExists
(
taos
,
cTableName
,
sTableName
,
sTableSchema
->
tags
,
tagBinds
,
info
);
for
(
int
i
=
0
;
i
<
taosArrayGetSize
(
tagBinds
);
++
i
)
{
TAOS_BIND
*
bind
=
taosArrayGet
(
tagBinds
,
i
);
free
(
bind
->
length
);
TAOS_BIND
*
tsc_
bind
=
taosArrayGet
(
tagBinds
,
i
);
free
(
tsc_
bind
->
length
);
}
taosArrayDestroy
(
tagBinds
);
return
code
;
...
...
@@ -1014,17 +1014,17 @@ static int32_t applyChildTableFields(TAOS* taos, SSmlSTableSchema* sTableSchema,
}
for
(
int
j
=
0
;
j
<
numCols
;
++
j
)
{
TAOS_BIND
*
bind
=
colBinds
+
j
;
bind
->
is_null
=
&
isNullColBind
;
TAOS_BIND
*
tsc_
bind
=
colBinds
+
j
;
tsc_
bind
->
is_null
=
&
isNullColBind
;
}
for
(
int
j
=
0
;
j
<
point
->
fieldNum
;
++
j
)
{
TAOS_SML_KV
*
kv
=
point
->
fields
+
j
;
TAOS_BIND
*
bind
=
colBinds
+
kv
->
fieldSchemaIdx
;
bind
->
buffer_type
=
kv
->
type
;
bind
->
length
=
malloc
(
sizeof
(
uintptr_t
*
));
*
bind
->
length
=
kv
->
length
;
bind
->
buffer
=
kv
->
value
;
bind
->
is_null
=
NULL
;
TAOS_BIND
*
tsc_
bind
=
colBinds
+
kv
->
fieldSchemaIdx
;
tsc_
bind
->
buffer_type
=
kv
->
type
;
tsc_
bind
->
length
=
malloc
(
sizeof
(
uintptr_t
*
));
*
tsc_
bind
->
length
=
kv
->
length
;
tsc_
bind
->
buffer
=
kv
->
value
;
tsc_
bind
->
is_null
=
NULL
;
}
taosArrayPush
(
rowsBind
,
&
colBinds
);
}
...
...
@@ -1037,8 +1037,8 @@ static int32_t applyChildTableFields(TAOS* taos, SSmlSTableSchema* sTableSchema,
for
(
int
i
=
0
;
i
<
rows
;
++
i
)
{
TAOS_BIND
*
colBinds
=
taosArrayGetP
(
rowsBind
,
i
);
for
(
int
j
=
0
;
j
<
numCols
;
++
j
)
{
TAOS_BIND
*
bind
=
colBinds
+
j
;
free
(
bind
->
length
);
TAOS_BIND
*
tsc_
bind
=
colBinds
+
j
;
free
(
tsc_
bind
->
length
);
}
free
(
colBinds
);
}
...
...
@@ -1794,14 +1794,14 @@ static int32_t convertSmlTimeStamp(TAOS_SML_KV *pVal, char *value,
return
TSDB_CODE_SUCCESS
;
}
static
int32_t
parseSmlTimeStamp
(
TAOS_SML_KV
**
pTS
,
const
char
**
index
,
SSmlLinesInfo
*
info
)
{
static
int32_t
parseSmlTimeStamp
(
TAOS_SML_KV
**
pTS
,
const
char
**
tsc_
index
,
SSmlLinesInfo
*
info
)
{
const
char
*
start
,
*
cur
;
int32_t
ret
=
TSDB_CODE_SUCCESS
;
int
len
=
0
;
char
key
[]
=
"_ts"
;
char
*
value
=
NULL
;
start
=
cur
=
*
index
;
start
=
cur
=
*
tsc_
index
;
*
pTS
=
calloc
(
1
,
sizeof
(
TAOS_SML_KV
));
while
(
*
cur
!=
'\0'
)
{
...
...
@@ -1851,8 +1851,8 @@ static bool checkDuplicateKey(char *key, SHashObj *pHash, SSmlLinesInfo* info) {
return
false
;
}
static
int32_t
parseSmlKey
(
TAOS_SML_KV
*
pKV
,
const
char
**
index
,
SHashObj
*
pHash
,
SSmlLinesInfo
*
info
)
{
const
char
*
cur
=
*
index
;
static
int32_t
parseSmlKey
(
TAOS_SML_KV
*
pKV
,
const
char
**
tsc_
index
,
SHashObj
*
pHash
,
SSmlLinesInfo
*
info
)
{
const
char
*
cur
=
*
tsc_
index
;
char
key
[
TSDB_COL_NAME_LEN
+
1
];
// +1 to avoid key[len] over write
uint16_t
len
=
0
;
...
...
@@ -1887,17 +1887,17 @@ static int32_t parseSmlKey(TAOS_SML_KV *pKV, const char **index, SHashObj *pHash
pKV
->
key
=
calloc
(
len
+
1
,
1
);
memcpy
(
pKV
->
key
,
key
,
len
+
1
);
//tscDebug("SML:0x%"PRIx64" Key:%s|len:%d", info->id, pKV->key, len);
*
index
=
cur
+
1
;
*
tsc_
index
=
cur
+
1
;
return
TSDB_CODE_SUCCESS
;
}
static
bool
parseSmlValue
(
TAOS_SML_KV
*
pKV
,
const
char
**
index
,
static
bool
parseSmlValue
(
TAOS_SML_KV
*
pKV
,
const
char
**
tsc_
index
,
bool
*
is_last_kv
,
SSmlLinesInfo
*
info
)
{
const
char
*
start
,
*
cur
;
char
*
value
=
NULL
;
uint16_t
len
=
0
;
start
=
cur
=
*
index
;
start
=
cur
=
*
tsc_
index
;
while
(
1
)
{
// unescaped ',' or ' ' or '\0' identifies a value
...
...
@@ -1928,13 +1928,13 @@ static bool parseSmlValue(TAOS_SML_KV *pKV, const char **index,
}
free
(
value
);
*
index
=
(
*
cur
==
'\0'
)
?
cur
:
cur
+
1
;
*
tsc_
index
=
(
*
cur
==
'\0'
)
?
cur
:
cur
+
1
;
return
TSDB_CODE_SUCCESS
;
}
static
int32_t
parseSmlMeasurement
(
TAOS_SML_DATA_POINT
*
pSml
,
const
char
**
index
,
static
int32_t
parseSmlMeasurement
(
TAOS_SML_DATA_POINT
*
pSml
,
const
char
**
tsc_
index
,
uint8_t
*
has_tags
,
SSmlLinesInfo
*
info
)
{
const
char
*
cur
=
*
index
;
const
char
*
cur
=
*
tsc_
index
;
uint16_t
len
=
0
;
pSml
->
stableName
=
calloc
(
TSDB_TABLE_NAME_LEN
+
1
,
1
);
// +1 to avoid 1772 line over write
...
...
@@ -1973,7 +1973,7 @@ static int32_t parseSmlMeasurement(TAOS_SML_DATA_POINT *pSml, const char **index
len
++
;
}
pSml
->
stableName
[
len
]
=
'\0'
;
*
index
=
cur
+
1
;
*
tsc_
index
=
cur
+
1
;
tscDebug
(
"SML:0x%"
PRIx64
" Stable name in measurement:%s|len:%d"
,
info
->
id
,
pSml
->
stableName
,
len
);
return
TSDB_CODE_SUCCESS
;
...
...
@@ -1992,10 +1992,10 @@ static int32_t isValidChildTableName(const char *pTbName, int16_t len) {
static
int32_t
parseSmlKvPairs
(
TAOS_SML_KV
**
pKVs
,
int
*
num_kvs
,
const
char
**
index
,
bool
isField
,
const
char
**
tsc_
index
,
bool
isField
,
TAOS_SML_DATA_POINT
*
smlData
,
SHashObj
*
pHash
,
SSmlLinesInfo
*
info
)
{
const
char
*
cur
=
*
index
;
const
char
*
cur
=
*
tsc_
index
;
int32_t
ret
=
TSDB_CODE_SUCCESS
;
TAOS_SML_KV
*
pkv
;
bool
is_last_kv
=
false
;
...
...
@@ -2077,7 +2077,7 @@ static int32_t parseSmlKvPairs(TAOS_SML_KV **pKVs, int *num_kvs,
error:
return
ret
;
done:
*
index
=
cur
;
*
tsc_
index
=
cur
;
return
ret
;
}
...
...
@@ -2097,13 +2097,13 @@ static void moveTimeStampToFirstKv(TAOS_SML_DATA_POINT** smlData, TAOS_SML_KV *t
}
int32_t
tscParseLine
(
const
char
*
sql
,
TAOS_SML_DATA_POINT
*
smlData
,
SSmlLinesInfo
*
info
)
{
const
char
*
index
=
sql
;
const
char
*
tsc_
index
=
sql
;
int32_t
ret
=
TSDB_CODE_SUCCESS
;
uint8_t
has_tags
=
0
;
TAOS_SML_KV
*
timestamp
=
NULL
;
SHashObj
*
keyHashTable
=
taosHashInit
(
128
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_BINARY
),
true
,
false
);
ret
=
parseSmlMeasurement
(
smlData
,
&
index
,
&
has_tags
,
info
);
ret
=
parseSmlMeasurement
(
smlData
,
&
tsc_
index
,
&
has_tags
,
info
);
if
(
ret
)
{
tscError
(
"SML:0x%"
PRIx64
" Unable to parse measurement"
,
info
->
id
);
taosHashCleanup
(
keyHashTable
);
...
...
@@ -2113,7 +2113,7 @@ int32_t tscParseLine(const char* sql, TAOS_SML_DATA_POINT* smlData, SSmlLinesInf
//Parse Tags
if
(
has_tags
)
{
ret
=
parseSmlKvPairs
(
&
smlData
->
tags
,
&
smlData
->
tagNum
,
&
index
,
false
,
smlData
,
keyHashTable
,
info
);
ret
=
parseSmlKvPairs
(
&
smlData
->
tags
,
&
smlData
->
tagNum
,
&
tsc_
index
,
false
,
smlData
,
keyHashTable
,
info
);
if
(
ret
)
{
tscError
(
"SML:0x%"
PRIx64
" Unable to parse tag"
,
info
->
id
);
taosHashCleanup
(
keyHashTable
);
...
...
@@ -2123,7 +2123,7 @@ int32_t tscParseLine(const char* sql, TAOS_SML_DATA_POINT* smlData, SSmlLinesInf
tscDebug
(
"SML:0x%"
PRIx64
" Parse tags finished, num of tags:%d"
,
info
->
id
,
smlData
->
tagNum
);
//Parse fields
ret
=
parseSmlKvPairs
(
&
smlData
->
fields
,
&
smlData
->
fieldNum
,
&
index
,
true
,
smlData
,
keyHashTable
,
info
);
ret
=
parseSmlKvPairs
(
&
smlData
->
fields
,
&
smlData
->
fieldNum
,
&
tsc_
index
,
true
,
smlData
,
keyHashTable
,
info
);
if
(
ret
)
{
tscError
(
"SML:0x%"
PRIx64
" Unable to parse field"
,
info
->
id
);
taosHashCleanup
(
keyHashTable
);
...
...
@@ -2133,7 +2133,7 @@ int32_t tscParseLine(const char* sql, TAOS_SML_DATA_POINT* smlData, SSmlLinesInf
taosHashCleanup
(
keyHashTable
);
//Parse timestamp
ret
=
parseSmlTimeStamp
(
&
timestamp
,
&
index
,
info
);
ret
=
parseSmlTimeStamp
(
&
timestamp
,
&
tsc_
index
,
info
);
if
(
ret
)
{
tscError
(
"SML:0x%"
PRIx64
" Unable to parse timestamp"
,
info
->
id
);
return
ret
;
...
...
src/client/src/tscPrepare.c
浏览文件 @
7522fb75
此差异已折叠。
点击以展开。
src/client/src/tscSQLParser.c
浏览文件 @
7522fb75
此差异已折叠。
点击以展开。
src/client/src/tscServer.c
浏览文件 @
7522fb75
...
...
@@ -860,13 +860,13 @@ static char *doSerializeTableInfo(SQueryTableMsg *pQueryMsg, SSqlObj *pSql, STab
int32_t
vgId
=
-
1
;
if
(
UTIL_TABLE_IS_SUPER_TABLE
(
pTableMetaInfo
))
{
int32_t
index
=
pTableMetaInfo
->
vgroupIndex
;
assert
(
index
>=
0
);
int32_t
tsc_
index
=
pTableMetaInfo
->
vgroupIndex
;
assert
(
tsc_
index
>=
0
);
SVgroupInfo
*
pVgroupInfo
=
NULL
;
if
(
pTableMetaInfo
->
vgroupList
&&
pTableMetaInfo
->
vgroupList
->
numOfVgroups
>
0
)
{
assert
(
index
<
pTableMetaInfo
->
vgroupList
->
numOfVgroups
);
pVgroupInfo
=
&
pTableMetaInfo
->
vgroupList
->
vgroups
[
index
];
assert
(
tsc_
index
<
pTableMetaInfo
->
vgroupList
->
numOfVgroups
);
pVgroupInfo
=
&
pTableMetaInfo
->
vgroupList
->
vgroups
[
tsc_
index
];
}
else
{
tscError
(
"0x%"
PRIx64
" No vgroup info found"
,
pSql
->
self
);
...
...
@@ -876,7 +876,7 @@ static char *doSerializeTableInfo(SQueryTableMsg *pQueryMsg, SSqlObj *pSql, STab
vgId
=
pVgroupInfo
->
vgId
;
tscSetDnodeEpSet
(
&
pSql
->
epSet
,
pVgroupInfo
);
tscDebug
(
"0x%"
PRIx64
" query on stable, vgIndex:%d, numOfVgroups:%d"
,
pSql
->
self
,
index
,
pTableMetaInfo
->
vgroupList
->
numOfVgroups
);
tscDebug
(
"0x%"
PRIx64
" query on stable, vgIndex:%d, numOfVgroups:%d"
,
pSql
->
self
,
tsc_
index
,
pTableMetaInfo
->
vgroupList
->
numOfVgroups
);
}
else
{
vgId
=
pTableMeta
->
vgId
;
...
...
@@ -898,11 +898,11 @@ static char *doSerializeTableInfo(SQueryTableMsg *pQueryMsg, SSqlObj *pSql, STab
pQueryMsg
->
numOfTables
=
htonl
(
1
);
// set the number of tables
pMsg
+=
sizeof
(
STableIdInfo
);
}
else
{
// it is a subquery of the super table query, this EP info is acquired from vgroupInfo
int32_t
index
=
pTableMetaInfo
->
vgroupIndex
;
int32_t
tsc_
index
=
pTableMetaInfo
->
vgroupIndex
;
int32_t
numOfVgroups
=
(
int32_t
)
taosArrayGetSize
(
pTableMetaInfo
->
pVgroupTables
);
assert
(
index
>=
0
&&
index
<
numOfVgroups
);
assert
(
tsc_index
>=
0
&&
tsc_
index
<
numOfVgroups
);
SVgroupTableInfo
*
pTableIdList
=
taosArrayGet
(
pTableMetaInfo
->
pVgroupTables
,
index
);
SVgroupTableInfo
*
pTableIdList
=
taosArrayGet
(
pTableMetaInfo
->
pVgroupTables
,
tsc_
index
);
// set the vgroup info
tscSetDnodeEpSet
(
&
pSql
->
epSet
,
&
pTableIdList
->
vgInfo
);
...
...
@@ -912,7 +912,7 @@ static char *doSerializeTableInfo(SQueryTableMsg *pQueryMsg, SSqlObj *pSql, STab
pQueryMsg
->
numOfTables
=
htonl
(
numOfTables
);
// set the number of tables
tscDebug
(
"0x%"
PRIx64
" query on stable, vgId:%d, numOfTables:%d, vgIndex:%d, numOfVgroups:%d"
,
pSql
->
self
,
pTableIdList
->
vgInfo
.
vgId
,
numOfTables
,
index
,
numOfVgroups
);
pTableIdList
->
vgInfo
.
vgId
,
numOfTables
,
tsc_
index
,
numOfVgroups
);
// serialize each table id info
for
(
int32_t
i
=
0
;
i
<
numOfTables
;
++
i
)
{
...
...
@@ -2621,18 +2621,18 @@ int tscProcessShowRsp(SSqlObj *pSql) {
SFieldInfo
*
pFieldInfo
=
&
pQueryInfo
->
fieldsInfo
;
SColumnIndex
index
=
{
0
};
SColumnIndex
tsc_
index
=
{
0
};
pSchema
=
pMetaMsg
->
schema
;
uint64_t
uid
=
pTableMetaInfo
->
pTableMeta
->
id
.
uid
;
for
(
int16_t
i
=
0
;
i
<
pMetaMsg
->
numOfColumns
;
++
i
,
++
pSchema
)
{
index
.
columnIndex
=
i
;
tsc_
index
.
columnIndex
=
i
;
tscColumnListInsert
(
pQueryInfo
->
colList
,
i
,
uid
,
pSchema
);
TAOS_FIELD
f
=
tscCreateField
(
pSchema
->
type
,
pSchema
->
name
,
pSchema
->
bytes
);
SInternalField
*
pInfo
=
tscFieldInfoAppend
(
pFieldInfo
,
&
f
);
pInfo
->
pExpr
=
tscExprAppend
(
pQueryInfo
,
TSDB_FUNC_TS_DUMMY
,
&
index
,
pInfo
->
pExpr
=
tscExprAppend
(
pQueryInfo
,
TSDB_FUNC_TS_DUMMY
,
&
tsc_
index
,
pTableSchema
[
i
].
type
,
pTableSchema
[
i
].
bytes
,
getNewResColId
(
pCmd
),
pTableSchema
[
i
].
bytes
,
false
);
}
...
...
src/client/src/tscStream.c
浏览文件 @
7522fb75
...
...
@@ -417,8 +417,8 @@ static void tscSetNextLaunchTimer(SSqlStream *pStream, SSqlObj *pSql) {
return
;
}
}
else
{
int64_t
stime
=
taosTimeTruncate
(
pStream
->
stime
-
1
,
&
pStream
->
interval
,
pStream
->
precision
);
if
(
stime
>=
pStream
->
etime
)
{
int64_t
tsc_
stime
=
taosTimeTruncate
(
pStream
->
stime
-
1
,
&
pStream
->
interval
,
pStream
->
precision
);
if
(
tsc_
stime
>=
pStream
->
etime
)
{
tscDebug
(
"0x%"
PRIx64
" stream:%p, stime:%"
PRId64
" is larger than end time: %"
PRId64
", stop the stream"
,
pStream
->
pSql
->
self
,
pStream
,
pStream
->
stime
,
pStream
->
etime
);
// TODO : How to terminate stream here
...
...
@@ -498,7 +498,7 @@ static int32_t tscSetSlidingWindowInfo(SSqlObj *pSql, SSqlStream *pStream) {
return
TSDB_CODE_SUCCESS
;
}
static
int64_t
tscGetStreamStartTimestamp
(
SSqlObj
*
pSql
,
SSqlStream
*
pStream
,
int64_t
stime
)
{
static
int64_t
tscGetStreamStartTimestamp
(
SSqlObj
*
pSql
,
SSqlStream
*
pStream
,
int64_t
tsc_
stime
)
{
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfo
(
&
pSql
->
cmd
);
if
(
pStream
->
isProject
)
{
...
...
@@ -506,31 +506,31 @@ static int64_t tscGetStreamStartTimestamp(SSqlObj *pSql, SSqlStream *pStream, in
pStream
->
interval
.
interval
=
tsProjectExecInterval
;
pStream
->
interval
.
sliding
=
tsProjectExecInterval
;
if
(
stime
!=
INT64_MIN
)
{
// first projection start from the latest event timestamp
assert
(
stime
>=
pQueryInfo
->
window
.
skey
);
stime
+=
1
;
// exclude the last records from table
if
(
tsc_
stime
!=
INT64_MIN
)
{
// first projection start from the latest event timestamp
assert
(
tsc_
stime
>=
pQueryInfo
->
window
.
skey
);
tsc_
stime
+=
1
;
// exclude the last records from table
}
else
{
stime
=
pQueryInfo
->
window
.
skey
;
tsc_
stime
=
pQueryInfo
->
window
.
skey
;
}
}
else
{
// timewindow based aggregation stream
if
(
stime
==
INT64_MIN
)
{
// no data in meter till now
if
(
tsc_
stime
==
INT64_MIN
)
{
// no data in meter till now
if
(
pQueryInfo
->
window
.
skey
!=
INT64_MIN
)
{
stime
=
pQueryInfo
->
window
.
skey
;
tsc_
stime
=
pQueryInfo
->
window
.
skey
;
}
else
{
return
stime
;
return
tsc_
stime
;
}
stime
=
taosTimeTruncate
(
stime
,
&
pStream
->
interval
,
pStream
->
precision
);
tsc_stime
=
taosTimeTruncate
(
tsc_
stime
,
&
pStream
->
interval
,
pStream
->
precision
);
}
else
{
int64_t
newStime
=
taosTimeTruncate
(
stime
,
&
pStream
->
interval
,
pStream
->
precision
);
if
(
newStime
!=
stime
)
{
tscWarn
(
"0x%"
PRIx64
" stream:%p, last timestamp:%"
PRId64
", reset to:%"
PRId64
,
pSql
->
self
,
pStream
,
stime
,
newStime
);
stime
=
newStime
;
int64_t
newStime
=
taosTimeTruncate
(
tsc_
stime
,
&
pStream
->
interval
,
pStream
->
precision
);
if
(
newStime
!=
tsc_
stime
)
{
tscWarn
(
"0x%"
PRIx64
" stream:%p, last timestamp:%"
PRId64
", reset to:%"
PRId64
,
pSql
->
self
,
pStream
,
tsc_
stime
,
newStime
);
tsc_
stime
=
newStime
;
}
}
}
return
stime
;
return
tsc_
stime
;
}
static
int64_t
tscGetLaunchTimestamp
(
const
SSqlStream
*
pStream
)
{
...
...
@@ -663,7 +663,7 @@ void cbParseSql(void* param, TAOS_RES* res, int code) {
}
TAOS_STREAM
*
taos_open_stream_withname
(
TAOS
*
taos
,
const
char
*
dstTable
,
const
char
*
sqlstr
,
void
(
*
fp
)(
void
*
param
,
TAOS_RES
*
,
TAOS_ROW
row
),
int64_t
stime
,
void
*
param
,
void
(
*
callback
)(
void
*
),
void
*
cqhandle
)
{
int64_t
tsc_
stime
,
void
*
param
,
void
(
*
callback
)(
void
*
),
void
*
cqhandle
)
{
STscObj
*
pObj
=
(
STscObj
*
)
taos
;
if
(
pObj
==
NULL
||
pObj
->
signature
!=
pObj
)
return
NULL
;
...
...
@@ -692,7 +692,7 @@ TAOS_STREAM *taos_open_stream_withname(TAOS *taos, const char* dstTable, const c
}
pStream
->
ltime
=
INT64_MIN
;
pStream
->
stime
=
stime
;
pStream
->
stime
=
tsc_
stime
;
pStream
->
fp
=
fp
;
pStream
->
callback
=
callback
;
pStream
->
param
=
param
;
...
...
@@ -745,8 +745,8 @@ TAOS_STREAM *taos_open_stream_withname(TAOS *taos, const char* dstTable, const c
}
TAOS_STREAM
*
taos_open_stream
(
TAOS
*
taos
,
const
char
*
sqlstr
,
void
(
*
fp
)(
void
*
param
,
TAOS_RES
*
,
TAOS_ROW
row
),
int64_t
stime
,
void
*
param
,
void
(
*
callback
)(
void
*
))
{
return
taos_open_stream_withname
(
taos
,
""
,
sqlstr
,
fp
,
stime
,
param
,
callback
,
NULL
);
int64_t
tsc_
stime
,
void
*
param
,
void
(
*
callback
)(
void
*
))
{
return
taos_open_stream_withname
(
taos
,
""
,
sqlstr
,
fp
,
tsc_
stime
,
param
,
callback
,
NULL
);
}
void
taos_close_stream
(
TAOS_STREAM
*
handle
)
{
...
...
src/client/src/tscSubquery.c
浏览文件 @
7522fb75
...
...
@@ -380,7 +380,7 @@ static int64_t doTSBlockIntersect(SSqlObj* pSql, STimeWindow * win) {
// todo handle failed to create sub query
SJoinSupporter
*
tscCreateJoinSupporter
(
SSqlObj
*
pSql
,
int32_t
index
)
{
SJoinSupporter
*
tscCreateJoinSupporter
(
SSqlObj
*
pSql
,
int32_t
tsc_
index
)
{
SJoinSupporter
*
pSupporter
=
calloc
(
1
,
sizeof
(
SJoinSupporter
));
if
(
pSupporter
==
NULL
)
{
return
NULL
;
...
...
@@ -388,13 +388,13 @@ SJoinSupporter* tscCreateJoinSupporter(SSqlObj* pSql, int32_t index) {
pSupporter
->
pObj
=
pSql
->
self
;
pSupporter
->
subqueryIndex
=
index
;
pSupporter
->
subqueryIndex
=
tsc_
index
;
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfo
(
&
pSql
->
cmd
);
memcpy
(
&
pSupporter
->
interval
,
&
pQueryInfo
->
interval
,
sizeof
(
pSupporter
->
interval
));
pSupporter
->
limit
=
pQueryInfo
->
limit
;
STableMetaInfo
*
pTableMetaInfo
=
tscGetTableMetaInfoFromCmd
(
&
pSql
->
cmd
,
index
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetTableMetaInfoFromCmd
(
&
pSql
->
cmd
,
tsc_
index
);
pSupporter
->
uid
=
pTableMetaInfo
->
pTableMeta
->
id
.
uid
;
assert
(
pSupporter
->
uid
!=
0
);
...
...
@@ -598,7 +598,7 @@ static int32_t tscLaunchRealSubqueries(SSqlObj* pSql) {
* during the timestamp intersection.
*/
pSupporter
->
limit
=
pQueryInfo
->
limit
;
SColumnIndex
index
=
{.
tableIndex
=
0
,
.
columnIndex
=
PRIMARYKEY_TIMESTAMP_COL_INDEX
};
SColumnIndex
tsc_
index
=
{.
tableIndex
=
0
,
.
columnIndex
=
PRIMARYKEY_TIMESTAMP_COL_INDEX
};
SSchema
*
s
=
tscGetTableColumnSchema
(
pTableMetaInfo
->
pTableMeta
,
0
);
SExprInfo
*
pExpr
=
tscExprGet
(
pQueryInfo
,
0
);
...
...
@@ -610,7 +610,7 @@ static int32_t tscLaunchRealSubqueries(SSqlObj* pSql) {
int16_t
functionId
=
tscIsProjectionQuery
(
pQueryInfo
)
?
TSDB_FUNC_PRJ
:
TSDB_FUNC_TS
;
tscAddFuncInSelectClause
(
pQueryInfo
,
0
,
functionId
,
&
index
,
s
,
TSDB_COL_NORMAL
,
getNewResColId
(
&
pNew
->
cmd
));
tscAddFuncInSelectClause
(
pQueryInfo
,
0
,
functionId
,
&
tsc_
index
,
s
,
TSDB_COL_NORMAL
,
getNewResColId
(
&
pNew
->
cmd
));
tscPrintSelNodeList
(
pNew
,
0
);
tscFieldInfoUpdateOffset
(
pQueryInfo
);
...
...
@@ -806,8 +806,8 @@ static void issueTsCompQuery(SSqlObj* pSql, SJoinSupporter* pSupporter, SSqlObj*
SSchema
colSchema
=
{.
type
=
TSDB_DATA_TYPE_BINARY
,
.
bytes
=
1
};
SColumnIndex
index
=
{
0
,
PRIMARYKEY_TIMESTAMP_COL_INDEX
};
tscAddFuncInSelectClause
(
pQueryInfo
,
0
,
TSDB_FUNC_TS_COMP
,
&
index
,
&
colSchema
,
TSDB_COL_NORMAL
,
getNewResColId
(
pCmd
));
SColumnIndex
tsc_
index
=
{
0
,
PRIMARYKEY_TIMESTAMP_COL_INDEX
};
tscAddFuncInSelectClause
(
pQueryInfo
,
0
,
TSDB_FUNC_TS_COMP
,
&
tsc_
index
,
&
colSchema
,
TSDB_COL_NORMAL
,
getNewResColId
(
pCmd
));
// set the tags value for ts_comp function
if
(
UTIL_TABLE_IS_SUPER_TABLE
(
pTableMetaInfo
))
{
...
...
@@ -2424,7 +2424,7 @@ int32_t tscHandleFirstRoundStableQuery(SSqlObj *pSql) {
int32_t
numOfExprs
=
(
int32_t
)
tscNumOfExprs
(
pQueryInfo
);
int32_t
index
=
0
;
int32_t
tsc_
index
=
0
;
for
(
int32_t
i
=
0
;
i
<
numOfExprs
;
++
i
)
{
SExprInfo
*
pExpr
=
tscExprGet
(
pQueryInfo
,
i
);
if
(
pExpr
->
base
.
functionId
==
TSDB_FUNC_TS
&&
pQueryInfo
->
interval
.
interval
>
0
)
{
...
...
@@ -2433,7 +2433,7 @@ int32_t tscHandleFirstRoundStableQuery(SSqlObj *pSql) {
SColumnIndex
colIndex
=
{.
tableIndex
=
0
,
.
columnIndex
=
PRIMARYKEY_TIMESTAMP_COL_INDEX
};
SSchema
*
schema
=
tscGetColumnSchemaById
(
pTableMetaInfo1
->
pTableMeta
,
pExpr
->
base
.
colInfo
.
colId
);
SExprInfo
*
p
=
tscAddFuncInSelectClause
(
pNewQueryInfo
,
index
++
,
TSDB_FUNC_TS
,
&
colIndex
,
schema
,
TSDB_COL_NORMAL
,
getNewResColId
(
pCmd
));
SExprInfo
*
p
=
tscAddFuncInSelectClause
(
pNewQueryInfo
,
tsc_
index
++
,
TSDB_FUNC_TS
,
&
colIndex
,
schema
,
TSDB_COL_NORMAL
,
getNewResColId
(
pCmd
));
p
->
base
.
resColId
=
pExpr
->
base
.
resColId
;
// update the result column id
}
else
if
(
pExpr
->
base
.
functionId
==
TSDB_FUNC_STDDEV_DST
)
{
taosArrayPush
(
pSup
->
pColsInfo
,
&
pExpr
->
base
.
resColId
);
...
...
@@ -2442,7 +2442,7 @@ int32_t tscHandleFirstRoundStableQuery(SSqlObj *pSql) {
SSchema
schema
=
{.
type
=
TSDB_DATA_TYPE_DOUBLE
,
.
bytes
=
sizeof
(
double
)};
tstrncpy
(
schema
.
name
,
pExpr
->
base
.
aliasName
,
tListLen
(
schema
.
name
));
SExprInfo
*
p
=
tscAddFuncInSelectClause
(
pNewQueryInfo
,
index
++
,
TSDB_FUNC_AVG
,
&
colIndex
,
&
schema
,
TSDB_COL_NORMAL
,
getNewResColId
(
pCmd
));
SExprInfo
*
p
=
tscAddFuncInSelectClause
(
pNewQueryInfo
,
tsc_
index
++
,
TSDB_FUNC_AVG
,
&
colIndex
,
&
schema
,
TSDB_COL_NORMAL
,
getNewResColId
(
pCmd
));
p
->
base
.
resColId
=
pExpr
->
base
.
resColId
;
// update the result column id
}
else
if
(
pExpr
->
base
.
functionId
==
TSDB_FUNC_TAG
)
{
pSup
->
tagLen
+=
pExpr
->
base
.
resBytes
;
...
...
@@ -2455,7 +2455,7 @@ int32_t tscHandleFirstRoundStableQuery(SSqlObj *pSql) {
schema
=
tGetTbnameColumnSchema
();
}
SExprInfo
*
p
=
tscAddFuncInSelectClause
(
pNewQueryInfo
,
index
++
,
TSDB_FUNC_TAG
,
&
colIndex
,
schema
,
TSDB_COL_TAG
,
getNewResColId
(
pCmd
));
SExprInfo
*
p
=
tscAddFuncInSelectClause
(
pNewQueryInfo
,
tsc_
index
++
,
TSDB_FUNC_TAG
,
&
colIndex
,
schema
,
TSDB_COL_TAG
,
getNewResColId
(
pCmd
));
p
->
base
.
resColId
=
pExpr
->
base
.
resColId
;
}
else
if
(
pExpr
->
base
.
functionId
==
TSDB_FUNC_PRJ
)
{
int32_t
num
=
(
int32_t
)
taosArrayGetSize
(
pNewQueryInfo
->
groupbyExpr
.
columnInfo
);
...
...
@@ -2469,7 +2469,7 @@ int32_t tscHandleFirstRoundStableQuery(SSqlObj *pSql) {
SSchema
*
schema
=
tscGetColumnSchemaById
(
pTableMetaInfo1
->
pTableMeta
,
pExpr
->
base
.
colInfo
.
colId
);
//doLimitOutputNormalColOfGroupby
SExprInfo
*
p
=
tscAddFuncInSelectClause
(
pNewQueryInfo
,
index
++
,
TSDB_FUNC_PRJ
,
&
colIndex
,
schema
,
TSDB_COL_NORMAL
,
getNewResColId
(
pCmd
));
SExprInfo
*
p
=
tscAddFuncInSelectClause
(
pNewQueryInfo
,
tsc_
index
++
,
TSDB_FUNC_PRJ
,
&
colIndex
,
schema
,
TSDB_COL_NORMAL
,
getNewResColId
(
pCmd
));
p
->
base
.
numOfParams
=
1
;
p
->
base
.
param
[
0
].
i64
=
1
;
p
->
base
.
param
[
0
].
nType
=
TSDB_DATA_TYPE_INT
;
...
...
@@ -2511,7 +2511,7 @@ int32_t tscHandleFirstRoundStableQuery(SSqlObj *pSql) {
"0x%"
PRIx64
" first round subquery:0x%"
PRIx64
" tableIndex:%d, vgroupIndex:%d, numOfVgroups:%d, type:%d, query to retrieve timestamps, "
"numOfExpr:%"
PRIzu
", colList:%d, numOfOutputFields:%d, name:%s"
,
pSql
->
self
,
pNew
->
self
,
0
,
pTableMetaInfo
->
vgroupIndex
,
pTableMetaInfo
->
vgroupList
->
numOfVgroups
,
pNewQueryInfo
->
type
,
tscNumOfExprs
(
pNewQueryInfo
),
index
+
1
,
pNewQueryInfo
->
fieldsInfo
.
numOfOutput
,
tNameGetTableName
(
&
pTableMetaInfo
->
name
));
tscNumOfExprs
(
pNewQueryInfo
),
tsc_
index
+
1
,
pNewQueryInfo
->
fieldsInfo
.
numOfOutput
,
tNameGetTableName
(
&
pTableMetaInfo
->
name
));
pSql
->
pSubs
=
calloc
(
1
,
POINTER_BYTES
);
if
(
pSql
->
pSubs
==
NULL
)
{
...
...
@@ -3145,7 +3145,7 @@ static SSqlObj *tscCreateSTableSubquery(SSqlObj *pSql, SRetrieveSupport *trsuppo
assert
(
trsupport
->
subqueryIndex
<
pSql
->
subState
.
numOfSub
);
// launch subquery for each vnode, so the subquery index equals to the vgroupIndex.
// launch subquery for each vnode, so the subquery
tsc_
index equals to the vgroupIndex.
STableMetaInfo
*
pTableMetaInfo
=
tscGetMetaInfo
(
pQueryInfo
,
table_index
);
pTableMetaInfo
->
vgroupIndex
=
trsupport
->
subqueryIndex
;
...
...
@@ -3628,19 +3628,19 @@ void tscBuildResFromSubqueries(SSqlObj *pSql) {
char
*
getArithmeticInputSrc
(
void
*
param
,
const
char
*
name
,
int32_t
colId
)
{
SArithmeticSupport
*
pSupport
=
(
SArithmeticSupport
*
)
param
;
int32_t
index
=
-
1
;
int32_t
tsc_
index
=
-
1
;
SExprInfo
*
pExpr
=
NULL
;
for
(
int32_t
i
=
0
;
i
<
pSupport
->
numOfCols
;
++
i
)
{
pExpr
=
taosArrayGetP
(
pSupport
->
exprList
,
i
);
if
(
strncmp
(
name
,
pExpr
->
base
.
aliasName
,
sizeof
(
pExpr
->
base
.
aliasName
)
-
1
)
==
0
)
{
index
=
i
;
tsc_
index
=
i
;
break
;
}
}
assert
(
index
>=
0
&&
index
<
pSupport
->
numOfCols
);
return
pSupport
->
data
[
index
]
+
pSupport
->
offset
*
pExpr
->
base
.
resBytes
;
assert
(
tsc_index
>=
0
&&
tsc_
index
<
pSupport
->
numOfCols
);
return
pSupport
->
data
[
tsc_
index
]
+
pSupport
->
offset
*
pExpr
->
base
.
resBytes
;
}
TAOS_ROW
doSetResultRowData
(
SSqlObj
*
pSql
)
{
...
...
@@ -3819,7 +3819,7 @@ void* createQInfoFromQueryNode(SQueryInfo* pQueryInfo, STableGroupInfo* pTableGr
pthread_mutex_init
(
&
pQInfo
->
lock
,
NULL
);
tsem_init
(
&
pQInfo
->
ready
,
0
,
0
);
int32_t
index
=
0
;
int32_t
tsc_
index
=
0
;
for
(
int32_t
i
=
0
;
i
<
numOfGroups
;
++
i
)
{
SArray
*
pa
=
taosArrayGetP
(
pQueryAttr
->
tableGroupInfo
.
pGroupList
,
i
);
...
...
@@ -3836,7 +3836,7 @@ void* createQInfoFromQueryNode(SQueryInfo* pQueryInfo, STableGroupInfo* pTableGr
STableKeyInfo
*
info
=
taosArrayGet
(
pa
,
j
);
window
.
skey
=
info
->
lastKey
;
void
*
buf
=
(
char
*
)
pQInfo
->
pBuf
+
index
*
sizeof
(
STableQueryInfo
);
void
*
buf
=
(
char
*
)
pQInfo
->
pBuf
+
tsc_
index
*
sizeof
(
STableQueryInfo
);
STableQueryInfo
*
item
=
createTableQueryInfo
(
pQueryAttr
,
info
->
pTable
,
pQueryAttr
->
groupbyColumn
,
window
,
buf
);
if
(
item
==
NULL
)
{
goto
_cleanup
;
...
...
@@ -3847,7 +3847,7 @@ void* createQInfoFromQueryNode(SQueryInfo* pQueryInfo, STableGroupInfo* pTableGr
STableId
id
=
{.
tid
=
0
,
.
uid
=
0
};
taosHashPut
(
pRuntimeEnv
->
tableqinfoGroupInfo
.
map
,
&
id
.
tid
,
sizeof
(
id
.
tid
),
&
item
,
POINTER_BYTES
);
index
+=
1
;
tsc_
index
+=
1
;
}
}
...
...
src/client/src/tscSystem.c
浏览文件 @
7522fb75
...
...
@@ -84,24 +84,24 @@ int32_t tscAcquireRpc(const char *key, const char *user, const char *secretEncry
return
0
;
}
SRpcInit
rpcInit
;
memset
(
&
rpcInit
,
0
,
sizeof
(
rpcInit
));
rpcInit
.
localPort
=
0
;
rpcInit
.
label
=
"TSC"
;
rpcInit
.
numOfThreads
=
tscNumOfThreads
;
rpcInit
.
cfp
=
tscProcessMsgFromServer
;
rpcInit
.
sessions
=
tsMaxConnections
;
rpcInit
.
connType
=
TAOS_CONN_CLIENT
;
rpcInit
.
user
=
(
char
*
)
user
;
rpcInit
.
idleTime
=
tsShellActivityTimer
*
1000
;
rpcInit
.
ckey
=
"key"
;
rpcInit
.
spi
=
1
;
rpcInit
.
secret
=
(
char
*
)
secretEncrypt
;
SRpcInit
tsc_
rpcInit
;
memset
(
&
tsc_rpcInit
,
0
,
sizeof
(
tsc_
rpcInit
));
tsc_
rpcInit
.
localPort
=
0
;
tsc_
rpcInit
.
label
=
"TSC"
;
tsc_
rpcInit
.
numOfThreads
=
tscNumOfThreads
;
tsc_
rpcInit
.
cfp
=
tscProcessMsgFromServer
;
tsc_
rpcInit
.
sessions
=
tsMaxConnections
;
tsc_
rpcInit
.
connType
=
TAOS_CONN_CLIENT
;
tsc_
rpcInit
.
user
=
(
char
*
)
user
;
tsc_
rpcInit
.
idleTime
=
tsShellActivityTimer
*
1000
;
tsc_
rpcInit
.
ckey
=
"key"
;
tsc_
rpcInit
.
spi
=
1
;
tsc_
rpcInit
.
secret
=
(
char
*
)
secretEncrypt
;
SRpcObj
rpcObj
;
memset
(
&
rpcObj
,
0
,
sizeof
(
rpcObj
));
strncpy
(
rpcObj
.
key
,
key
,
strlen
(
key
));
rpcObj
.
pDnodeConn
=
rpcOpen
(
&
rpcInit
);
rpcObj
.
pDnodeConn
=
rpcOpen
(
&
tsc_
rpcInit
);
if
(
rpcObj
.
pDnodeConn
==
NULL
)
{
pthread_mutex_unlock
(
&
rpcObjMutex
);
tscError
(
"failed to init connection to TDengine"
);
...
...
src/client/src/tscUtil.c
浏览文件 @
7522fb75
...
...
@@ -2132,10 +2132,10 @@ void tscCloseTscObj(void *param) {
}
bool
tscIsInsertData
(
char
*
sqlstr
)
{
int32_t
index
=
0
;
int32_t
tsc_
index
=
0
;
do
{
SStrToken
t0
=
tStrGetToken
(
sqlstr
,
&
index
,
false
);
SStrToken
t0
=
tStrGetToken
(
sqlstr
,
&
tsc_
index
,
false
);
if
(
t0
.
type
!=
TK_LP
)
{
return
t0
.
type
==
TK_INSERT
||
t0
.
type
==
TK_IMPORT
;
}
...
...
@@ -2202,12 +2202,12 @@ SInternalField* tscFieldInfoAppend(SFieldInfo* pFieldInfo, TAOS_FIELD* pField) {
return
taosArrayPush
(
pFieldInfo
->
internalField
,
&
info
);
}
SInternalField
*
tscFieldInfoInsert
(
SFieldInfo
*
pFieldInfo
,
int32_t
index
,
TAOS_FIELD
*
field
)
{
SInternalField
*
tscFieldInfoInsert
(
SFieldInfo
*
pFieldInfo
,
int32_t
tsc_
index
,
TAOS_FIELD
*
field
)
{
pFieldInfo
->
numOfOutput
++
;
struct
SInternalField
info
=
{
.
pExpr
=
NULL
,
.
visible
=
true
};
info
.
field
=
*
field
;
return
taosArrayInsert
(
pFieldInfo
->
internalField
,
index
,
&
info
);
return
taosArrayInsert
(
pFieldInfo
->
internalField
,
tsc_
index
,
&
info
);
}
void
tscFieldInfoUpdateOffset
(
SQueryInfo
*
pQueryInfo
)
{
...
...
@@ -2222,18 +2222,18 @@ void tscFieldInfoUpdateOffset(SQueryInfo* pQueryInfo) {
}
}
SInternalField
*
tscFieldInfoGetInternalField
(
SFieldInfo
*
pFieldInfo
,
int32_t
index
)
{
assert
(
index
<
pFieldInfo
->
numOfOutput
);
return
TARRAY_GET_ELEM
(
pFieldInfo
->
internalField
,
index
);
SInternalField
*
tscFieldInfoGetInternalField
(
SFieldInfo
*
pFieldInfo
,
int32_t
tsc_
index
)
{
assert
(
tsc_
index
<
pFieldInfo
->
numOfOutput
);
return
TARRAY_GET_ELEM
(
pFieldInfo
->
internalField
,
tsc_
index
);
}
TAOS_FIELD
*
tscFieldInfoGetField
(
SFieldInfo
*
pFieldInfo
,
int32_t
index
)
{
assert
(
index
<
pFieldInfo
->
numOfOutput
);
return
&
((
SInternalField
*
)
TARRAY_GET_ELEM
(
pFieldInfo
->
internalField
,
index
))
->
field
;
TAOS_FIELD
*
tscFieldInfoGetField
(
SFieldInfo
*
pFieldInfo
,
int32_t
tsc_
index
)
{
assert
(
tsc_
index
<
pFieldInfo
->
numOfOutput
);
return
&
((
SInternalField
*
)
TARRAY_GET_ELEM
(
pFieldInfo
->
internalField
,
tsc_
index
))
->
field
;
}
int16_t
tscFieldInfoGetOffset
(
SQueryInfo
*
pQueryInfo
,
int32_t
index
)
{
SInternalField
*
pInfo
=
tscFieldInfoGetInternalField
(
&
pQueryInfo
->
fieldsInfo
,
index
);
int16_t
tscFieldInfoGetOffset
(
SQueryInfo
*
pQueryInfo
,
int32_t
tsc_
index
)
{
SInternalField
*
pInfo
=
tscFieldInfoGetInternalField
(
&
pQueryInfo
->
fieldsInfo
,
tsc_
index
);
assert
(
pInfo
!=
NULL
&&
pInfo
->
pExpr
->
pExpr
==
NULL
);
return
pInfo
->
pExpr
->
base
.
offset
;
...
...
@@ -2402,7 +2402,7 @@ SExprInfo* tscExprCreate(STableMetaInfo* pTableMetaInfo, int16_t functionId, SCo
SSqlExpr
*
p
=
&
pExpr
->
base
;
p
->
functionId
=
functionId
;
// set the correct columnIndex index
// set the correct columnIndex
tsc_
index
if
(
pColIndex
->
columnIndex
==
TSDB_TBNAME_COLUMN_INDEX
)
{
SSchema
*
s
=
tGetTbnameColumnSchema
();
p
->
colInfo
.
colId
=
TSDB_TBNAME_COLUMN_INDEX
;
...
...
@@ -2449,16 +2449,16 @@ SExprInfo* tscExprCreate(STableMetaInfo* pTableMetaInfo, int16_t functionId, SCo
return
pExpr
;
}
SExprInfo
*
tscExprInsert
(
SQueryInfo
*
pQueryInfo
,
int32_t
index
,
int16_t
functionId
,
SColumnIndex
*
pColIndex
,
int16_t
type
,
SExprInfo
*
tscExprInsert
(
SQueryInfo
*
pQueryInfo
,
int32_t
tsc_
index
,
int16_t
functionId
,
SColumnIndex
*
pColIndex
,
int16_t
type
,
int16_t
size
,
int16_t
resColId
,
int16_t
interSize
,
bool
isTagCol
)
{
int32_t
num
=
(
int32_t
)
taosArrayGetSize
(
pQueryInfo
->
exprList
);
if
(
index
==
num
)
{
if
(
tsc_
index
==
num
)
{
return
tscExprAppend
(
pQueryInfo
,
functionId
,
pColIndex
,
type
,
size
,
resColId
,
interSize
,
isTagCol
);
}
STableMetaInfo
*
pTableMetaInfo
=
tscGetMetaInfo
(
pQueryInfo
,
pColIndex
->
tableIndex
);
SExprInfo
*
pExpr
=
tscExprCreate
(
pTableMetaInfo
,
functionId
,
pColIndex
,
type
,
size
,
resColId
,
interSize
,
isTagCol
);
taosArrayInsert
(
pQueryInfo
->
exprList
,
index
,
&
pExpr
);
taosArrayInsert
(
pQueryInfo
->
exprList
,
tsc_
index
,
&
pExpr
);
return
pExpr
;
}
...
...
@@ -2470,10 +2470,10 @@ SExprInfo* tscExprAppend(SQueryInfo* pQueryInfo, int16_t functionId, SColumnInde
return
pExpr
;
}
SExprInfo
*
tscExprUpdate
(
SQueryInfo
*
pQueryInfo
,
int32_t
index
,
int16_t
functionId
,
int16_t
srcColumnIndex
,
SExprInfo
*
tscExprUpdate
(
SQueryInfo
*
pQueryInfo
,
int32_t
tsc_
index
,
int16_t
functionId
,
int16_t
srcColumnIndex
,
int16_t
type
,
int16_t
size
)
{
STableMetaInfo
*
pTableMetaInfo
=
tscGetMetaInfo
(
pQueryInfo
,
0
);
SExprInfo
*
pExpr
=
tscExprGet
(
pQueryInfo
,
index
);
SExprInfo
*
pExpr
=
tscExprGet
(
pQueryInfo
,
tsc_
index
);
if
(
pExpr
==
NULL
)
{
return
NULL
;
}
...
...
@@ -2490,8 +2490,8 @@ SExprInfo* tscExprUpdate(SQueryInfo* pQueryInfo, int32_t index, int16_t function
return
pExpr
;
}
bool
tscMultiRoundQuery
(
SQueryInfo
*
pQueryInfo
,
int32_t
index
)
{
if
(
!
UTIL_TABLE_IS_SUPER_TABLE
(
pQueryInfo
->
pTableMetaInfo
[
index
]))
{
bool
tscMultiRoundQuery
(
SQueryInfo
*
pQueryInfo
,
int32_t
tsc_
index
)
{
if
(
!
UTIL_TABLE_IS_SUPER_TABLE
(
pQueryInfo
->
pTableMetaInfo
[
tsc_
index
]))
{
return
false
;
}
...
...
@@ -2522,8 +2522,8 @@ void tscExprAddParams(SSqlExpr* pExpr, char* argument, int32_t type, int32_t byt
assert
(
pExpr
->
numOfParams
<=
3
);
}
SExprInfo
*
tscExprGet
(
SQueryInfo
*
pQueryInfo
,
int32_t
index
)
{
return
taosArrayGetP
(
pQueryInfo
->
exprList
,
index
);
SExprInfo
*
tscExprGet
(
SQueryInfo
*
pQueryInfo
,
int32_t
tsc_
index
)
{
return
taosArrayGetP
(
pQueryInfo
->
exprList
,
tsc_
index
);
}
/*
...
...
@@ -3045,8 +3045,8 @@ void tscGetSrcColumnInfo(SSrcColumnInfo* pColInfo, SQueryInfo* pQueryInfo) {
if
(
TSDB_COL_IS_TAG
(
pExpr
->
base
.
colInfo
.
flag
))
{
SSchema
*
pTagSchema
=
tscGetTableTagSchema
(
pTableMetaInfo
->
pTableMeta
);
int16_t
index
=
pExpr
->
base
.
colInfo
.
colIndex
;
pColInfo
[
i
].
type
=
(
index
!=
-
1
)
?
pTagSchema
[
index
].
type
:
TSDB_DATA_TYPE_BINARY
;
int16_t
tsc_
index
=
pExpr
->
base
.
colInfo
.
colIndex
;
pColInfo
[
i
].
type
=
(
tsc_index
!=
-
1
)
?
pTagSchema
[
tsc_
index
].
type
:
TSDB_DATA_TYPE_BINARY
;
}
else
{
pColInfo
[
i
].
type
=
pSchema
[
pExpr
->
base
.
colInfo
.
colIndex
].
type
;
}
...
...
@@ -3126,7 +3126,7 @@ SQueryInfo* tscGetQueryInfoS(SSqlCmd* pCmd) {
return
pQueryInfo
;
}
STableMetaInfo
*
tscGetTableMetaInfoByUid
(
SQueryInfo
*
pQueryInfo
,
uint64_t
uid
,
int32_t
*
index
)
{
STableMetaInfo
*
tscGetTableMetaInfoByUid
(
SQueryInfo
*
pQueryInfo
,
uint64_t
uid
,
int32_t
*
tsc_
index
)
{
int32_t
k
=
-
1
;
for
(
int32_t
i
=
0
;
i
<
pQueryInfo
->
numOfTables
;
++
i
)
{
...
...
@@ -3136,8 +3136,8 @@ STableMetaInfo* tscGetTableMetaInfoByUid(SQueryInfo* pQueryInfo, uint64_t uid, i
}
}
if
(
index
!=
NULL
)
{
*
index
=
k
;
if
(
tsc_
index
!=
NULL
)
{
*
tsc_
index
=
k
;
}
assert
(
k
!=
-
1
);
...
...
@@ -3347,15 +3347,15 @@ void tscFreeVgroupTableInfo(SArray* pVgroupTables) {
taosArrayDestroy
(
pVgroupTables
);
}
void
tscRemoveVgroupTableGroup
(
SArray
*
pVgroupTable
,
int32_t
index
)
{
assert
(
pVgroupTable
!=
NULL
&&
index
>=
0
);
void
tscRemoveVgroupTableGroup
(
SArray
*
pVgroupTable
,
int32_t
tsc_
index
)
{
assert
(
pVgroupTable
!=
NULL
&&
tsc_
index
>=
0
);
size_t
size
=
taosArrayGetSize
(
pVgroupTable
);
assert
(
size
>
index
);
assert
(
size
>
tsc_
index
);
SVgroupTableInfo
*
pInfo
=
taosArrayGet
(
pVgroupTable
,
index
);
SVgroupTableInfo
*
pInfo
=
taosArrayGet
(
pVgroupTable
,
tsc_
index
);
taosArrayDestroy
(
pInfo
->
itemList
);
taosArrayRemove
(
pVgroupTable
,
index
);
taosArrayRemove
(
pVgroupTable
,
tsc_
index
);
}
void
tscVgroupTableCopy
(
SVgroupTableInfo
*
info
,
SVgroupTableInfo
*
pInfo
)
{
...
...
@@ -3825,15 +3825,15 @@ static void tscSubqueryRetrieveCallback(void* param, TAOS_RES* tres, int code) {
SSqlObj
*
pParentSql
=
ps
->
pParentSql
;
SSqlObj
*
pSql
=
tres
;
int32_t
index
=
ps
->
subqueryIndex
;
bool
ret
=
subAndCheckDone
(
pSql
,
pParentSql
,
index
);
int32_t
tsc_
index
=
ps
->
subqueryIndex
;
bool
ret
=
subAndCheckDone
(
pSql
,
pParentSql
,
tsc_
index
);
// TODO refactor
tfree
(
ps
);
pSql
->
param
=
NULL
;
if
(
!
ret
)
{
tscDebug
(
"0x%"
PRIx64
" sub:0x%"
PRIx64
" orderOfSub:%d completed, not all subquery finished"
,
pParentSql
->
self
,
pSql
->
self
,
index
);
tscDebug
(
"0x%"
PRIx64
" sub:0x%"
PRIx64
" orderOfSub:%d completed, not all subquery finished"
,
pParentSql
->
self
,
pSql
->
self
,
tsc_
index
);
return
;
}
...
...
@@ -3854,13 +3854,13 @@ static void tscSubqueryCompleteCallback(void* param, TAOS_RES* tres, int code) {
if
(
pSql
->
res
.
code
!=
TSDB_CODE_SUCCESS
)
{
SSqlObj
*
pParentSql
=
ps
->
pParentSql
;
int32_t
index
=
ps
->
subqueryIndex
;
bool
ret
=
subAndCheckDone
(
pSql
,
pParentSql
,
index
);
int32_t
tsc_
index
=
ps
->
subqueryIndex
;
bool
ret
=
subAndCheckDone
(
pSql
,
pParentSql
,
tsc_
index
);
tscFreeRetrieveSup
(
&
pSql
->
param
);
if
(
!
ret
)
{
tscDebug
(
"0x%"
PRIx64
" sub:0x%"
PRIx64
" orderOfSub:%d completed, not all subquery finished"
,
pParentSql
->
self
,
pSql
->
self
,
index
);
tscDebug
(
"0x%"
PRIx64
" sub:0x%"
PRIx64
" orderOfSub:%d completed, not all subquery finished"
,
pParentSql
->
self
,
pSql
->
self
,
tsc_
index
);
return
;
}
...
...
src/common/src/tdataformat.c
浏览文件 @
7522fb75
...
...
@@ -304,14 +304,14 @@ bool isNEleNull(SDataCol *pCol, int nEle) {
return
true
;
}
static
FORCE_INLINE
void
dataColSetNullAt
(
SDataCol
*
pCol
,
int
index
)
{
static
FORCE_INLINE
void
dataColSetNullAt
(
SDataCol
*
pCol
,
int
utl_
index
)
{
if
(
IS_VAR_DATA_TYPE
(
pCol
->
type
))
{
pCol
->
dataOff
[
index
]
=
pCol
->
len
;
pCol
->
dataOff
[
utl_
index
]
=
pCol
->
len
;
char
*
ptr
=
POINTER_SHIFT
(
pCol
->
pData
,
pCol
->
len
);
setVardataNull
(
ptr
,
pCol
->
type
);
pCol
->
len
+=
varDataTLen
(
ptr
);
}
else
{
setNull
(
POINTER_SHIFT
(
pCol
->
pData
,
TYPE_BYTES
[
pCol
->
type
]
*
index
),
pCol
->
type
,
pCol
->
bytes
);
setNull
(
POINTER_SHIFT
(
pCol
->
pData
,
TYPE_BYTES
[
pCol
->
type
]
*
utl_
index
),
pCol
->
type
,
pCol
->
bytes
);
pCol
->
len
+=
TYPE_BYTES
[
pCol
->
type
];
}
}
...
...
src/common/src/tglobal.c
浏览文件 @
7522fb75
...
...
@@ -75,7 +75,7 @@ int32_t tsMaxBinaryDisplayWidth = 30;
* -1: all data are not compressed
* other values: if the message payload size is greater than the tsCompressMsgSize, the message will be compressed.
*/
int32_t
tsCompressMsgSize
=
-
1
;
int32_t
tsCompressMsgSize
=
512
*
1024
;
// client
int32_t
tsMaxSQLStringLen
=
TSDB_MAX_ALLOWED_SQL_LEN
;
...
...
@@ -376,10 +376,10 @@ bool taosCfgDynamicOptions(char *msg) {
return
false
;
}
void
taosAddDataDir
(
int
index
,
char
*
v1
,
int
level
,
int
primary
)
{
tstrncpy
(
tsDiskCfg
[
index
].
dir
,
v1
,
TSDB_FILENAME_LEN
);
tsDiskCfg
[
index
].
level
=
level
;
tsDiskCfg
[
index
].
primary
=
primary
;
void
taosAddDataDir
(
int
utl_
index
,
char
*
v1
,
int
level
,
int
primary
)
{
tstrncpy
(
tsDiskCfg
[
utl_
index
].
dir
,
v1
,
TSDB_FILENAME_LEN
);
tsDiskCfg
[
utl_
index
].
level
=
level
;
tsDiskCfg
[
utl_
index
].
primary
=
primary
;
uTrace
(
"dataDir:%s, level:%d primary:%d is configured"
,
v1
,
level
,
primary
);
}
...
...
src/common/src/tname.c
浏览文件 @
7522fb75
...
...
@@ -338,29 +338,29 @@ void tNameAssign(SName* dst, const SName* src) {
memcpy
(
dst
,
src
,
sizeof
(
SName
));
}
int32_t
tNameSetDbName
(
SName
*
dst
,
const
char
*
acct
,
SStrToken
*
dbToken
)
{
assert
(
dst
!=
NULL
&&
dbToken
!=
NULL
&&
acct
!=
NULL
);
int32_t
tNameSetDbName
(
SName
*
dst
,
const
char
*
utl_
acct
,
SStrToken
*
dbToken
)
{
assert
(
dst
!=
NULL
&&
dbToken
!=
NULL
&&
utl_
acct
!=
NULL
);
// too long account id or too long db name
if
(
strlen
(
acct
)
>=
tListLen
(
dst
->
acctId
)
||
dbToken
->
n
>=
tListLen
(
dst
->
dbname
))
{
if
(
strlen
(
utl_
acct
)
>=
tListLen
(
dst
->
acctId
)
||
dbToken
->
n
>=
tListLen
(
dst
->
dbname
))
{
return
-
1
;
}
dst
->
type
=
TSDB_DB_NAME_T
;
tstrncpy
(
dst
->
acctId
,
acct
,
tListLen
(
dst
->
acctId
));
tstrncpy
(
dst
->
acctId
,
utl_
acct
,
tListLen
(
dst
->
acctId
));
tstrncpy
(
dst
->
dbname
,
dbToken
->
z
,
dbToken
->
n
+
1
);
return
0
;
}
int32_t
tNameSetAcctId
(
SName
*
dst
,
const
char
*
acct
)
{
assert
(
dst
!=
NULL
&&
acct
!=
NULL
);
int32_t
tNameSetAcctId
(
SName
*
dst
,
const
char
*
utl_
acct
)
{
assert
(
dst
!=
NULL
&&
utl_
acct
!=
NULL
);
// too long account id or too long db name
if
(
strlen
(
acct
)
>=
tListLen
(
dst
->
acctId
))
{
if
(
strlen
(
utl_
acct
)
>=
tListLen
(
dst
->
acctId
))
{
return
-
1
;
}
tstrncpy
(
dst
->
acctId
,
acct
,
tListLen
(
dst
->
acctId
));
tstrncpy
(
dst
->
acctId
,
utl_
acct
,
tListLen
(
dst
->
acctId
));
assert
(
strlen
(
dst
->
acctId
)
>
0
);
...
...
src/common/src/ttypes.c
浏览文件 @
7522fb75
...
...
@@ -258,8 +258,8 @@ static void getStatics_u64(const void *pData, int32_t numOfRow, int64_t *min, in
static
void
getStatics_f
(
const
void
*
pData
,
int32_t
numOfRow
,
int64_t
*
min
,
int64_t
*
max
,
int64_t
*
sum
,
int16_t
*
minIndex
,
int16_t
*
maxIndex
,
int16_t
*
numOfNull
)
{
float
*
data
=
(
float
*
)
pData
;
float
fmin
=
FLT_MAX
;
float
fmax
=
-
FLT_MAX
;
float
utl_
fmin
=
FLT_MAX
;
float
utl_
fmax
=
-
FLT_MAX
;
double
dsum
=
0
;
*
minIndex
=
0
;
*
maxIndex
=
0
;
...
...
@@ -275,20 +275,20 @@ static void getStatics_f(const void *pData, int32_t numOfRow, int64_t *min, int6
float
fv
=
GET_FLOAT_VAL
((
const
char
*
)
&
(
data
[
i
]));
dsum
+=
fv
;
if
(
fmin
>
fv
)
{
fmin
=
fv
;
if
(
utl_
fmin
>
fv
)
{
utl_
fmin
=
fv
;
*
minIndex
=
i
;
}
if
(
fmax
<
fv
)
{
fmax
=
fv
;
if
(
utl_
fmax
<
fv
)
{
utl_
fmax
=
fv
;
*
maxIndex
=
i
;
}
}
SET_DOUBLE_VAL
(
sum
,
dsum
);
SET_DOUBLE_VAL
(
max
,
fmax
);
SET_DOUBLE_VAL
(
min
,
fmin
);
SET_DOUBLE_VAL
(
max
,
utl_
fmax
);
SET_DOUBLE_VAL
(
min
,
utl_
fmin
);
}
static
void
getStatics_d
(
const
void
*
pData
,
int32_t
numOfRow
,
int64_t
*
min
,
int64_t
*
max
,
...
...
src/cq/src/cqMain.c
浏览文件 @
7522fb75
...
...
@@ -424,7 +424,7 @@ static void cqProcessCreateTimer(void *param, void *tmrId) {
// inner implement in tscStream.c
TAOS_STREAM
*
taos_open_stream_withname
(
TAOS
*
taos
,
const
char
*
desName
,
const
char
*
sqlstr
,
void
(
*
fp
)(
void
*
param
,
TAOS_RES
*
,
TAOS_ROW
row
),
int64_t
stime
,
void
*
param
,
void
(
*
callback
)(
void
*
),
void
*
cqhandle
);
int64_t
tsc_
stime
,
void
*
param
,
void
(
*
callback
)(
void
*
),
void
*
cqhandle
);
static
void
cqCreateStream
(
SCqContext
*
pContext
,
SCqObj
*
pObj
)
{
pObj
->
pContext
=
pContext
;
...
...
src/dnode/src/dnodeCheck.c
浏览文件 @
7522fb75
...
...
@@ -229,12 +229,12 @@ static void dnodeAllocCheckItem() {
}
void
dnodeCleanupCheck
()
{
for
(
ECheckItemType
index
=
0
;
index
<
TSDB_CHECK_ITEM_MAX
;
++
index
)
{
if
(
tsCheckItem
[
index
].
enable
&&
tsCheckItem
[
index
].
stopFp
)
{
(
*
tsCheckItem
[
index
].
stopFp
)();
for
(
ECheckItemType
dnd_index
=
0
;
dnd_index
<
TSDB_CHECK_ITEM_MAX
;
++
dnd_
index
)
{
if
(
tsCheckItem
[
dnd_index
].
enable
&&
tsCheckItem
[
dnd_
index
].
stopFp
)
{
(
*
tsCheckItem
[
dnd_
index
].
stopFp
)();
}
if
(
tsCheckItem
[
index
].
cleanUpFp
)
{
(
*
tsCheckItem
[
index
].
cleanUpFp
)();
if
(
tsCheckItem
[
dnd_
index
].
cleanUpFp
)
{
(
*
tsCheckItem
[
dnd_
index
].
cleanUpFp
)();
}
}
}
...
...
@@ -242,19 +242,19 @@ void dnodeCleanupCheck() {
int32_t
dnodeInitCheck
()
{
dnodeAllocCheckItem
();
for
(
ECheckItemType
index
=
0
;
index
<
TSDB_CHECK_ITEM_MAX
;
++
index
)
{
if
(
tsCheckItem
[
index
].
initFp
)
{
if
((
*
tsCheckItem
[
index
].
initFp
)()
!=
0
)
{
dError
(
"failed to init check item:%s"
,
tsCheckItem
[
index
].
name
);
for
(
ECheckItemType
dnd_index
=
0
;
dnd_index
<
TSDB_CHECK_ITEM_MAX
;
++
dnd_
index
)
{
if
(
tsCheckItem
[
dnd_
index
].
initFp
)
{
if
((
*
tsCheckItem
[
dnd_
index
].
initFp
)()
!=
0
)
{
dError
(
"failed to init check item:%s"
,
tsCheckItem
[
dnd_
index
].
name
);
return
-
1
;
}
}
}
for
(
ECheckItemType
index
=
0
;
index
<
TSDB_CHECK_ITEM_MAX
;
++
index
)
{
if
(
tsCheckItem
[
index
].
enable
&&
tsCheckItem
[
index
].
startFp
)
{
if
((
*
tsCheckItem
[
index
].
startFp
)()
!=
0
)
{
dError
(
"failed to check item:%s"
,
tsCheckItem
[
index
].
name
);
for
(
ECheckItemType
dnd_index
=
0
;
dnd_index
<
TSDB_CHECK_ITEM_MAX
;
++
dnd_
index
)
{
if
(
tsCheckItem
[
dnd_index
].
enable
&&
tsCheckItem
[
dnd_
index
].
startFp
)
{
if
((
*
tsCheckItem
[
dnd_
index
].
startFp
)()
!=
0
)
{
dError
(
"failed to check item:%s"
,
tsCheckItem
[
dnd_
index
].
name
);
exit
(
-
1
);
}
}
...
...
src/dnode/src/dnodePeer.c
浏览文件 @
7522fb75
...
...
@@ -56,17 +56,17 @@ int32_t dnodeInitServer() {
dnodeProcessReqMsgFp
[
TSDB_MSG_TYPE_DM_GRANT
]
=
dnodeDispatchToMPeerQueue
;
dnodeProcessReqMsgFp
[
TSDB_MSG_TYPE_DM_STATUS
]
=
dnodeDispatchToMPeerQueue
;
SRpcInit
rpcInit
;
memset
(
&
rpcInit
,
0
,
sizeof
(
rpcInit
));
rpcInit
.
localPort
=
tsDnodeDnodePort
;
rpcInit
.
label
=
"DND-S"
;
rpcInit
.
numOfThreads
=
1
;
rpcInit
.
cfp
=
dnodeProcessReqMsgFromDnode
;
rpcInit
.
sessions
=
TSDB_MAX_VNODES
<<
4
;
rpcInit
.
connType
=
TAOS_CONN_SERVER
;
rpcInit
.
idleTime
=
tsShellActivityTimer
*
1000
;
tsServerRpc
=
rpcOpen
(
&
rpcInit
);
SRpcInit
dnd_
rpcInit
;
memset
(
&
dnd_rpcInit
,
0
,
sizeof
(
dnd_
rpcInit
));
dnd_
rpcInit
.
localPort
=
tsDnodeDnodePort
;
dnd_
rpcInit
.
label
=
"DND-S"
;
dnd_
rpcInit
.
numOfThreads
=
1
;
dnd_
rpcInit
.
cfp
=
dnodeProcessReqMsgFromDnode
;
dnd_
rpcInit
.
sessions
=
TSDB_MAX_VNODES
<<
4
;
dnd_
rpcInit
.
connType
=
TAOS_CONN_SERVER
;
dnd_
rpcInit
.
idleTime
=
tsShellActivityTimer
*
1000
;
tsServerRpc
=
rpcOpen
(
&
dnd_
rpcInit
);
if
(
tsServerRpc
==
NULL
)
{
dError
(
"failed to init inter-dnodes RPC server"
);
return
-
1
;
...
...
@@ -123,19 +123,19 @@ static void dnodeProcessReqMsgFromDnode(SRpcMsg *pMsg, SRpcEpSet *pEpSet) {
int32_t
dnodeInitClient
()
{
char
secret
[
TSDB_KEY_LEN
]
=
"secret"
;
SRpcInit
rpcInit
;
memset
(
&
rpcInit
,
0
,
sizeof
(
rpcInit
));
rpcInit
.
label
=
"DND-C"
;
rpcInit
.
numOfThreads
=
1
;
rpcInit
.
cfp
=
dnodeProcessRspFromDnode
;
rpcInit
.
sessions
=
TSDB_MAX_VNODES
<<
4
;
rpcInit
.
connType
=
TAOS_CONN_CLIENT
;
rpcInit
.
idleTime
=
tsShellActivityTimer
*
1000
;
rpcInit
.
user
=
"t"
;
rpcInit
.
ckey
=
"key"
;
rpcInit
.
secret
=
secret
;
tsClientRpc
=
rpcOpen
(
&
rpcInit
);
SRpcInit
dnd_
rpcInit
;
memset
(
&
dnd_rpcInit
,
0
,
sizeof
(
dnd_
rpcInit
));
dnd_
rpcInit
.
label
=
"DND-C"
;
dnd_
rpcInit
.
numOfThreads
=
1
;
dnd_
rpcInit
.
cfp
=
dnodeProcessRspFromDnode
;
dnd_
rpcInit
.
sessions
=
TSDB_MAX_VNODES
<<
4
;
dnd_
rpcInit
.
connType
=
TAOS_CONN_CLIENT
;
dnd_
rpcInit
.
idleTime
=
tsShellActivityTimer
*
1000
;
dnd_
rpcInit
.
user
=
"t"
;
dnd_
rpcInit
.
ckey
=
"key"
;
dnd_
rpcInit
.
secret
=
secret
;
tsClientRpc
=
rpcOpen
(
&
dnd_
rpcInit
);
if
(
tsClientRpc
==
NULL
)
{
dError
(
"failed to init mnode rpc client"
);
return
-
1
;
...
...
src/dnode/src/dnodeShell.c
浏览文件 @
7522fb75
...
...
@@ -83,18 +83,18 @@ int32_t dnodeInitShell() {
numOfThreads
=
1
;
}
SRpcInit
rpcInit
;
memset
(
&
rpcInit
,
0
,
sizeof
(
rpcInit
));
rpcInit
.
localPort
=
tsDnodeShellPort
;
rpcInit
.
label
=
"SHELL"
;
rpcInit
.
numOfThreads
=
numOfThreads
;
rpcInit
.
cfp
=
dnodeProcessMsgFromShell
;
rpcInit
.
sessions
=
tsMaxShellConns
;
rpcInit
.
connType
=
TAOS_CONN_SERVER
;
rpcInit
.
idleTime
=
tsShellActivityTimer
*
1000
;
rpcInit
.
afp
=
dnodeRetrieveUserAuthInfo
;
tsShellRpc
=
rpcOpen
(
&
rpcInit
);
SRpcInit
dnd_
rpcInit
;
memset
(
&
dnd_rpcInit
,
0
,
sizeof
(
dnd_
rpcInit
));
dnd_
rpcInit
.
localPort
=
tsDnodeShellPort
;
dnd_
rpcInit
.
label
=
"SHELL"
;
dnd_
rpcInit
.
numOfThreads
=
numOfThreads
;
dnd_
rpcInit
.
cfp
=
dnodeProcessMsgFromShell
;
dnd_
rpcInit
.
sessions
=
tsMaxShellConns
;
dnd_
rpcInit
.
connType
=
TAOS_CONN_SERVER
;
dnd_
rpcInit
.
idleTime
=
tsShellActivityTimer
*
1000
;
dnd_
rpcInit
.
afp
=
dnodeRetrieveUserAuthInfo
;
tsShellRpc
=
rpcOpen
(
&
dnd_
rpcInit
);
if
(
tsShellRpc
==
NULL
)
{
dError
(
"failed to init shell rpc server"
);
return
-
1
;
...
...
src/kit/shell/src/shellImport.c
浏览文件 @
7522fb75
...
...
@@ -93,8 +93,8 @@ static void shellCheckTablesSQLFile(const char *directoryName)
{
sprintf
(
shellTablesSQLFile
,
"%s/tables.sql"
,
directoryName
);
struct
stat
fstat
;
if
(
stat
(
shellTablesSQLFile
,
&
fstat
)
<
0
)
{
struct
stat
kit_
fstat
;
if
(
stat
(
shellTablesSQLFile
,
&
kit_
fstat
)
<
0
)
{
shellTablesSQLFile
[
0
]
=
0
;
}
}
...
...
src/kit/taosdemo/taosdemo.c
浏览文件 @
7522fb75
此差异已折叠。
点击以展开。
src/mnode/src/mnodeCluster.c
浏览文件 @
7522fb75
...
...
@@ -145,8 +145,8 @@ static int32_t mnodeCreateCluster() {
SClusterObj
*
pCluster
=
malloc
(
sizeof
(
SClusterObj
));
memset
(
pCluster
,
0
,
sizeof
(
SClusterObj
));
pCluster
->
createdTime
=
taosGetTimestampMs
();
bool
getuid
=
taosGetSystemUid
(
pCluster
->
uid
);
if
(
!
getuid
)
{
bool
mnd_
getuid
=
taosGetSystemUid
(
pCluster
->
uid
);
if
(
!
mnd_
getuid
)
{
strcpy
(
pCluster
->
uid
,
"tdengine2.0"
);
mError
(
"failed to get uid from system, set to default val %s"
,
pCluster
->
uid
);
}
else
{
...
...
src/mnode/src/mnodeMnode.c
浏览文件 @
7522fb75
...
...
@@ -209,7 +209,7 @@ void mnodeUpdateMnodeEpSet(SMInfos *pMinfos) {
mInfos
=
*
pMinfos
;
}
else
{
mInfo
(
"vgId:1, update mnodes epSet, numOfMnodes:%d"
,
mnodeGetMnodesNum
());
int32_t
index
=
0
;
int32_t
mnd_
index
=
0
;
void
*
pIter
=
NULL
;
while
(
1
)
{
SMnodeObj
*
pMnode
=
NULL
;
...
...
@@ -219,10 +219,10 @@ void mnodeUpdateMnodeEpSet(SMInfos *pMinfos) {
SDnodeObj
*
pDnode
=
mnodeGetDnode
(
pMnode
->
mnodeId
);
if
(
pDnode
!=
NULL
)
{
set
=
true
;
mInfos
.
mnodeInfos
[
index
].
mnodeId
=
pMnode
->
mnodeId
;
strcpy
(
mInfos
.
mnodeInfos
[
index
].
mnodeEp
,
pDnode
->
dnodeEp
);
if
(
pMnode
->
role
==
TAOS_SYNC_ROLE_MASTER
)
mInfos
.
inUse
=
index
;
index
++
;
mInfos
.
mnodeInfos
[
mnd_
index
].
mnodeId
=
pMnode
->
mnodeId
;
strcpy
(
mInfos
.
mnodeInfos
[
mnd_
index
].
mnodeEp
,
pDnode
->
dnodeEp
);
if
(
pMnode
->
role
==
TAOS_SYNC_ROLE_MASTER
)
mInfos
.
inUse
=
mnd_
index
;
mnd_
index
++
;
}
else
{
set
=
false
;
}
...
...
@@ -231,7 +231,7 @@ void mnodeUpdateMnodeEpSet(SMInfos *pMinfos) {
mnodeDecMnodeRef
(
pMnode
);
}
mInfos
.
mnodeNum
=
index
;
mInfos
.
mnodeNum
=
mnd_
index
;
if
(
mInfos
.
mnodeNum
<
sdbGetReplicaNum
())
{
set
=
false
;
mDebug
(
"vgId:1, mnodes info not synced, current:%d syncCfgNum:%d"
,
mInfos
.
mnodeNum
,
sdbGetReplicaNum
());
...
...
@@ -250,23 +250,23 @@ void mnodeUpdateMnodeEpSet(SMInfos *pMinfos) {
tsMEpForPeer
.
numOfEps
=
tsMInfos
.
mnodeNum
;
mInfo
(
"vgId:1, mnodes epSet is set, num:%d inUse:%d"
,
tsMInfos
.
mnodeNum
,
tsMInfos
.
inUse
);
for
(
int
index
=
0
;
index
<
mInfos
.
mnodeNum
;
++
index
)
{
SMInfo
*
pInfo
=
&
tsMInfos
.
mnodeInfos
[
index
];
taosGetFqdnPortFromEp
(
pInfo
->
mnodeEp
,
tsMEpForShell
.
fqdn
[
index
],
&
tsMEpForShell
.
port
[
index
]);
taosGetFqdnPortFromEp
(
pInfo
->
mnodeEp
,
tsMEpForPeer
.
fqdn
[
index
],
&
tsMEpForPeer
.
port
[
index
]);
tsMEpForPeer
.
port
[
index
]
=
tsMEpForPeer
.
port
[
index
]
+
TSDB_PORT_DNODEDNODE
;
for
(
int
mnd_index
=
0
;
mnd_index
<
mInfos
.
mnodeNum
;
++
mnd_
index
)
{
SMInfo
*
pInfo
=
&
tsMInfos
.
mnodeInfos
[
mnd_
index
];
taosGetFqdnPortFromEp
(
pInfo
->
mnodeEp
,
tsMEpForShell
.
fqdn
[
mnd_index
],
&
tsMEpForShell
.
port
[
mnd_
index
]);
taosGetFqdnPortFromEp
(
pInfo
->
mnodeEp
,
tsMEpForPeer
.
fqdn
[
mnd_index
],
&
tsMEpForPeer
.
port
[
mnd_
index
]);
tsMEpForPeer
.
port
[
mnd_index
]
=
tsMEpForPeer
.
port
[
mnd_
index
]
+
TSDB_PORT_DNODEDNODE
;
mInfo
(
"vgId:1, mnode:%d, fqdn:%s shell:%u peer:%u"
,
pInfo
->
mnodeId
,
tsMEpForShell
.
fqdn
[
index
],
tsMEpForShell
.
port
[
index
],
tsMEpForPeer
.
port
[
index
]);
mInfo
(
"vgId:1, mnode:%d, fqdn:%s shell:%u peer:%u"
,
pInfo
->
mnodeId
,
tsMEpForShell
.
fqdn
[
mnd_
index
],
tsMEpForShell
.
port
[
mnd_index
],
tsMEpForPeer
.
port
[
mnd_
index
]);
tsMEpForShell
.
port
[
index
]
=
htons
(
tsMEpForShell
.
port
[
index
]);
tsMEpForPeer
.
port
[
index
]
=
htons
(
tsMEpForPeer
.
port
[
index
]);
tsMEpForShell
.
port
[
mnd_index
]
=
htons
(
tsMEpForShell
.
port
[
mnd_
index
]);
tsMEpForPeer
.
port
[
mnd_index
]
=
htons
(
tsMEpForPeer
.
port
[
mnd_
index
]);
pInfo
->
mnodeId
=
htonl
(
pInfo
->
mnodeId
);
}
}
else
{
mInfo
(
"vgId:1, mnodes epSet not set, num:%d inUse:%d"
,
tsMInfos
.
mnodeNum
,
tsMInfos
.
inUse
);
for
(
int
index
=
0
;
index
<
tsMInfos
.
mnodeNum
;
++
index
)
{
mInfo
(
"vgId:1, index:%d, ep:%s:%u"
,
index
,
tsMEpForShell
.
fqdn
[
index
],
htons
(
tsMEpForShell
.
port
[
index
]));
for
(
int
mnd_index
=
0
;
mnd_index
<
tsMInfos
.
mnodeNum
;
++
mnd_
index
)
{
mInfo
(
"vgId:1, index:%d, ep:%s:%u"
,
mnd_index
,
tsMEpForShell
.
fqdn
[
mnd_index
],
htons
(
tsMEpForShell
.
port
[
mnd_
index
]));
}
}
...
...
src/mnode/src/mnodeSdb.c
浏览文件 @
7522fb75
...
...
@@ -330,7 +330,7 @@ int32_t sdbUpdateSync(void *pMnodes) {
mDebug
(
"vgId:1, update sync config, pMnodes:%p"
,
pMnodes
);
SSyncCfg
syncCfg
=
{
0
};
int32_t
index
=
0
;
int32_t
mnd_
index
=
0
;
if
(
pMinfos
==
NULL
)
{
mDebug
(
"vgId:1, mInfos not input, use mInfos in sdb, numOfMnodes:%d"
,
syncCfg
.
replica
);
...
...
@@ -341,29 +341,29 @@ int32_t sdbUpdateSync(void *pMnodes) {
pIter
=
mnodeGetNextMnode
(
pIter
,
&
pMnode
);
if
(
pMnode
==
NULL
)
break
;
syncCfg
.
nodeInfo
[
index
].
nodeId
=
pMnode
->
mnodeId
;
syncCfg
.
nodeInfo
[
mnd_
index
].
nodeId
=
pMnode
->
mnodeId
;
SDnodeObj
*
pDnode
=
mnodeGetDnode
(
pMnode
->
mnodeId
);
if
(
pDnode
!=
NULL
)
{
syncCfg
.
nodeInfo
[
index
].
nodePort
=
pDnode
->
dnodePort
+
TSDB_PORT_SYNC
;
tstrncpy
(
syncCfg
.
nodeInfo
[
index
].
nodeFqdn
,
pDnode
->
dnodeFqdn
,
TSDB_FQDN_LEN
);
index
++
;
syncCfg
.
nodeInfo
[
mnd_
index
].
nodePort
=
pDnode
->
dnodePort
+
TSDB_PORT_SYNC
;
tstrncpy
(
syncCfg
.
nodeInfo
[
mnd_
index
].
nodeFqdn
,
pDnode
->
dnodeFqdn
,
TSDB_FQDN_LEN
);
mnd_
index
++
;
}
mnodeDecDnodeRef
(
pDnode
);
mnodeDecMnodeRef
(
pMnode
);
}
syncCfg
.
replica
=
index
;
syncCfg
.
replica
=
mnd_
index
;
}
else
{
mDebug
(
"vgId:1, mInfos input, numOfMnodes:%d"
,
pMinfos
->
mnodeNum
);
for
(
index
=
0
;
index
<
pMinfos
->
mnodeNum
;
++
index
)
{
SMInfo
*
node
=
&
pMinfos
->
mnodeInfos
[
index
];
syncCfg
.
nodeInfo
[
index
].
nodeId
=
node
->
mnodeId
;
taosGetFqdnPortFromEp
(
node
->
mnodeEp
,
syncCfg
.
nodeInfo
[
index
].
nodeFqdn
,
&
syncCfg
.
nodeInfo
[
index
].
nodePort
);
syncCfg
.
nodeInfo
[
index
].
nodePort
+=
TSDB_PORT_SYNC
;
for
(
mnd_index
=
0
;
mnd_index
<
pMinfos
->
mnodeNum
;
++
mnd_
index
)
{
SMInfo
*
node
=
&
pMinfos
->
mnodeInfos
[
mnd_
index
];
syncCfg
.
nodeInfo
[
mnd_
index
].
nodeId
=
node
->
mnodeId
;
taosGetFqdnPortFromEp
(
node
->
mnodeEp
,
syncCfg
.
nodeInfo
[
mnd_index
].
nodeFqdn
,
&
syncCfg
.
nodeInfo
[
mnd_
index
].
nodePort
);
syncCfg
.
nodeInfo
[
mnd_
index
].
nodePort
+=
TSDB_PORT_SYNC
;
}
syncCfg
.
replica
=
index
;
syncCfg
.
replica
=
mnd_
index
;
mnodeUpdateMnodeEpSet
(
pMnodes
);
}
...
...
src/mnode/src/mnodeShow.c
浏览文件 @
7522fb75
...
...
@@ -121,7 +121,7 @@ static int32_t mnodeProcessShowMsg(SMnodeMsg *pMsg) {
}
if
(
!
tsMnodeShowMetaFp
[
pShowMsg
->
type
]
||
!
tsMnodeShowRetrieveFp
[
pShowMsg
->
type
])
{
m
Error
(
"show type:%s is not support"
,
mnodeGetShowType
(
pShowMsg
->
type
));
m
Warn
(
"show type:%s is not support"
,
mnodeGetShowType
(
pShowMsg
->
type
));
return
TSDB_CODE_COM_OPS_NOT_SUPPORT
;
}
...
...
src/os/CMakeLists.txt
浏览文件 @
7522fb75
...
...
@@ -10,5 +10,6 @@ ELSEIF (TD_WINDOWS)
ENDIF
()
ADD_SUBDIRECTORY
(
src/detail
)
ADD_SUBDIRECTORY
(
tests
)
IF
(
NOT TD_NINGSI_60
)
ADD_SUBDIRECTORY
(
tests
)
ENDIF
()
src/os/src/detail/osDir.c
浏览文件 @
7522fb75
...
...
@@ -45,8 +45,8 @@ void taosRemoveDir(char *rootDir) {
uInfo
(
"dir:%s is removed"
,
rootDir
);
}
bool
taosDirExist
(
const
char
*
dirname
)
{
return
access
(
dirname
,
F_OK
)
==
0
;
bool
taosDirExist
(
const
char
*
os_
dirname
)
{
return
access
(
os_
dirname
,
F_OK
)
==
0
;
}
int
taosMkDir
(
const
char
*
path
,
mode_t
mode
)
{
...
...
src/os/src/detail/osFile.c
浏览文件 @
7522fb75
...
...
@@ -43,9 +43,9 @@ void taosGetTmpfilePath(const char *fileNamePrefix, char *dstPath) {
strcat
(
tmpPath
,
"-%d-%s"
);
}
char
rand
[
8
]
=
{
0
};
taosRandStr
(
rand
,
tListLen
(
rand
)
-
1
);
snprintf
(
dstPath
,
PATH_MAX
,
tmpPath
,
getpid
(),
rand
);
char
os_
rand
[
8
]
=
{
0
};
taosRandStr
(
os_rand
,
tListLen
(
os_
rand
)
-
1
);
snprintf
(
dstPath
,
PATH_MAX
,
tmpPath
,
getpid
(),
os_
rand
);
}
#else
...
...
@@ -68,11 +68,11 @@ void taosGetTmpfilePath(const char *fileNamePrefix, char *dstPath) {
strcat
(
tmpPath
,
"-%d-%s"
);
}
char
rand
[
32
]
=
{
0
};
char
os_
rand
[
32
]
=
{
0
};
sprintf
(
rand
,
"%"
PRIu64
,
atomic_add_fetch_64
(
&
seqId
,
1
));
sprintf
(
os_
rand
,
"%"
PRIu64
,
atomic_add_fetch_64
(
&
seqId
,
1
));
snprintf
(
dstPath
,
PATH_MAX
,
tmpPath
,
getpid
(),
rand
);
snprintf
(
dstPath
,
PATH_MAX
,
tmpPath
,
getpid
(),
os_
rand
);
}
#endif
...
...
src/os/src/detail/osTime.c
浏览文件 @
7522fb75
...
...
@@ -82,23 +82,23 @@ void deltaToUtcInitOnce() {
}
static
int64_t
parseFraction
(
char
*
str
,
char
**
end
,
int32_t
timePrec
);
static
int32_t
parseTimeWithTz
(
char
*
timestr
,
int64_t
*
time
,
int32_t
timePrec
);
static
int32_t
parseLocaltime
(
char
*
timestr
,
int64_t
*
time
,
int32_t
timePrec
);
static
int32_t
parseLocaltimeWithDst
(
char
*
timestr
,
int64_t
*
time
,
int32_t
timePrec
);
static
int32_t
parseTimeWithTz
(
char
*
timestr
,
int64_t
*
os_
time
,
int32_t
timePrec
);
static
int32_t
parseLocaltime
(
char
*
timestr
,
int64_t
*
os_
time
,
int32_t
timePrec
);
static
int32_t
parseLocaltimeWithDst
(
char
*
timestr
,
int64_t
*
os_
time
,
int32_t
timePrec
);
static
int32_t
(
*
parseLocaltimeFp
[])
(
char
*
timestr
,
int64_t
*
time
,
int32_t
timePrec
)
=
{
static
int32_t
(
*
parseLocaltimeFp
[])
(
char
*
timestr
,
int64_t
*
os_
time
,
int32_t
timePrec
)
=
{
parseLocaltime
,
parseLocaltimeWithDst
};
int32_t
taosGetTimestampSec
()
{
return
(
int32_t
)
time
(
NULL
);
}
int32_t
taosParseTime
(
char
*
timestr
,
int64_t
*
time
,
int32_t
len
,
int32_t
timePrec
,
int8_t
day_light
)
{
int32_t
taosParseTime
(
char
*
timestr
,
int64_t
*
os_
time
,
int32_t
len
,
int32_t
timePrec
,
int8_t
day_light
)
{
/* parse datatime string in with tz */
if
(
strnchr
(
timestr
,
'T'
,
len
,
false
)
!=
NULL
)
{
return
parseTimeWithTz
(
timestr
,
time
,
timePrec
);
return
parseTimeWithTz
(
timestr
,
os_
time
,
timePrec
);
}
else
{
return
(
*
parseLocaltimeFp
[
day_light
])(
timestr
,
time
,
timePrec
);
return
(
*
parseLocaltimeFp
[
day_light
])(
timestr
,
os_
time
,
timePrec
);
}
}
...
...
@@ -213,7 +213,7 @@ int32_t parseTimezone(char* str, int64_t* tzOffset) {
* 2013-04-12T15:52:01+0800
* 2013-04-12T15:52:01.123+0800
*/
int32_t
parseTimeWithTz
(
char
*
timestr
,
int64_t
*
time
,
int32_t
timePrec
)
{
int32_t
parseTimeWithTz
(
char
*
timestr
,
int64_t
*
os_
time
,
int32_t
timePrec
)
{
int64_t
factor
=
(
timePrec
==
TSDB_TIME_PRECISION_MILLI
)
?
1000
:
(
timePrec
==
TSDB_TIME_PRECISION_MICRO
?
1000000
:
1000000000
);
...
...
@@ -238,14 +238,14 @@ int32_t parseTimeWithTz(char* timestr, int64_t* time, int32_t timePrec) {
if
(
str
[
0
]
==
'Z'
||
str
[
0
]
==
'z'
)
{
/* utc time, no millisecond, return directly*/
*
time
=
seconds
*
factor
;
*
os_
time
=
seconds
*
factor
;
}
else
if
(
str
[
0
]
==
'.'
)
{
str
+=
1
;
if
((
fraction
=
parseFraction
(
str
,
&
str
,
timePrec
))
<
0
)
{
return
-
1
;
}
*
time
=
seconds
*
factor
+
fraction
;
*
os_
time
=
seconds
*
factor
+
fraction
;
char
seg
=
str
[
0
];
if
(
seg
!=
'Z'
&&
seg
!=
'z'
&&
seg
!=
'+'
&&
seg
!=
'-'
)
{
...
...
@@ -256,18 +256,18 @@ int32_t parseTimeWithTz(char* timestr, int64_t* time, int32_t timePrec) {
return
-
1
;
}
*
time
+=
tzOffset
*
factor
;
*
os_
time
+=
tzOffset
*
factor
;
}
}
else
if
(
str
[
0
]
==
'+'
||
str
[
0
]
==
'-'
)
{
*
time
=
seconds
*
factor
+
fraction
;
*
os_
time
=
seconds
*
factor
+
fraction
;
// parse the timezone
if
(
parseTimezone
(
str
,
&
tzOffset
)
==
-
1
)
{
return
-
1
;
}
*
time
+=
tzOffset
*
factor
;
*
os_
time
+=
tzOffset
*
factor
;
}
else
{
return
-
1
;
}
...
...
@@ -275,8 +275,8 @@ int32_t parseTimeWithTz(char* timestr, int64_t* time, int32_t timePrec) {
return
0
;
}
int32_t
parseLocaltime
(
char
*
timestr
,
int64_t
*
time
,
int32_t
timePrec
)
{
*
time
=
0
;
int32_t
parseLocaltime
(
char
*
timestr
,
int64_t
*
os_
time
,
int32_t
timePrec
)
{
*
os_
time
=
0
;
struct
tm
tm
=
{
0
};
char
*
str
=
strptime
(
timestr
,
"%Y-%m-%d %H:%M:%S"
,
&
tm
);
...
...
@@ -303,13 +303,13 @@ int32_t parseLocaltime(char* timestr, int64_t* time, int32_t timePrec) {
int64_t
factor
=
(
timePrec
==
TSDB_TIME_PRECISION_MILLI
)
?
1000
:
(
timePrec
==
TSDB_TIME_PRECISION_MICRO
?
1000000
:
1000000000
);
*
time
=
factor
*
seconds
+
fraction
;
*
os_
time
=
factor
*
seconds
+
fraction
;
return
0
;
}
int32_t
parseLocaltimeWithDst
(
char
*
timestr
,
int64_t
*
time
,
int32_t
timePrec
)
{
*
time
=
0
;
int32_t
parseLocaltimeWithDst
(
char
*
timestr
,
int64_t
*
os_
time
,
int32_t
timePrec
)
{
*
os_
time
=
0
;
struct
tm
tm
=
{
0
};
tm
.
tm_isdst
=
-
1
;
...
...
@@ -332,64 +332,64 @@ int32_t parseLocaltimeWithDst(char* timestr, int64_t* time, int32_t timePrec) {
int64_t
factor
=
(
timePrec
==
TSDB_TIME_PRECISION_MILLI
)
?
1000
:
(
timePrec
==
TSDB_TIME_PRECISION_MICRO
?
1000000
:
1000000000
);
*
time
=
factor
*
seconds
+
fraction
;
*
os_
time
=
factor
*
seconds
+
fraction
;
return
0
;
}
int64_t
convertTimePrecision
(
int64_t
time
,
int32_t
fromPrecision
,
int32_t
toPrecision
)
{
int64_t
convertTimePrecision
(
int64_t
os_
time
,
int32_t
fromPrecision
,
int32_t
toPrecision
)
{
assert
(
fromPrecision
==
TSDB_TIME_PRECISION_MILLI
||
fromPrecision
==
TSDB_TIME_PRECISION_MICRO
||
fromPrecision
==
TSDB_TIME_PRECISION_NANO
);
assert
(
toPrecision
==
TSDB_TIME_PRECISION_MILLI
||
toPrecision
==
TSDB_TIME_PRECISION_MICRO
||
toPrecision
==
TSDB_TIME_PRECISION_NANO
);
double
tempResult
=
(
double
)
time
;
double
tempResult
=
(
double
)
os_
time
;
switch
(
fromPrecision
)
{
case
TSDB_TIME_PRECISION_MILLI
:
{
switch
(
toPrecision
)
{
case
TSDB_TIME_PRECISION_MILLI
:
return
time
;
return
os_
time
;
case
TSDB_TIME_PRECISION_MICRO
:
tempResult
*=
1000
;
time
*=
1000
;
os_
time
*=
1000
;
goto
end_
;
case
TSDB_TIME_PRECISION_NANO
:
tempResult
*=
1000000
;
time
*=
1000000
;
os_
time
*=
1000000
;
goto
end_
;
}
}
// end from milli
case
TSDB_TIME_PRECISION_MICRO
:
{
switch
(
toPrecision
)
{
case
TSDB_TIME_PRECISION_MILLI
:
return
time
/
1000
;
return
os_
time
/
1000
;
case
TSDB_TIME_PRECISION_MICRO
:
return
time
;
return
os_
time
;
case
TSDB_TIME_PRECISION_NANO
:
tempResult
*=
1000
;
time
*=
1000
;
os_
time
*=
1000
;
goto
end_
;
}
}
//end from micro
case
TSDB_TIME_PRECISION_NANO
:
{
switch
(
toPrecision
)
{
case
TSDB_TIME_PRECISION_MILLI
:
return
time
/
1000000
;
return
os_
time
/
1000000
;
case
TSDB_TIME_PRECISION_MICRO
:
return
time
/
1000
;
return
os_
time
/
1000
;
case
TSDB_TIME_PRECISION_NANO
:
return
time
;
return
os_
time
;
}
}
//end from nano
default:
{
assert
(
0
);
return
time
;
// only to pass windows compilation
return
os_
time
;
// only to pass windows compilation
}
}
//end switch fromPrecision
end_:
if
(
tempResult
>=
(
double
)
INT64_MAX
)
return
INT64_MAX
;
if
(
tempResult
<=
(
double
)
INT64_MIN
)
return
INT64_MIN
+
1
;
// INT64_MIN means NULL
return
time
;
return
os_
time
;
}
static
int32_t
getDuration
(
int64_t
val
,
char
unit
,
int64_t
*
result
,
int32_t
timePrecision
)
{
...
...
src/os/src/linux/osSystem.c
浏览文件 @
7522fb75
...
...
@@ -33,9 +33,9 @@ void* taosLoadDll(const char *filename) {
void
*
taosLoadSym
(
void
*
handle
,
char
*
name
)
{
void
*
sym
=
dlsym
(
handle
,
name
);
char
*
error
=
NULL
;
char
*
os_
error
=
NULL
;
if
((
error
=
dlerror
())
!=
NULL
)
{
if
((
os_
error
=
dlerror
())
!=
NULL
)
{
uWarn
(
"load sym:%s failed, error:%s"
,
name
,
dlerror
());
return
NULL
;
}
...
...
src/os/src/windows/wString.c
浏览文件 @
7522fb75
...
...
@@ -61,14 +61,14 @@ char *getpass(const char *prefix) {
memset
(
passwd
,
0
,
TSDB_KEY_LEN
);
printf
(
"%s"
,
prefix
);
int32_t
index
=
0
;
int32_t
os_
index
=
0
;
char
ch
;
while
(
index
<
TSDB_KEY_LEN
)
{
while
(
os_
index
<
TSDB_KEY_LEN
)
{
ch
=
getch
();
if
(
ch
==
'\n'
||
ch
==
'\r'
)
{
break
;
}
else
{
passwd
[
index
++
]
=
ch
;
passwd
[
os_
index
++
]
=
ch
;
}
}
...
...
src/plugins/http/src/httpUtil.c
浏览文件 @
7522fb75
...
...
@@ -31,10 +31,10 @@ bool httpCheckUsedbSql(char *sql) {
}
bool
httpCheckAlterSql
(
char
*
sql
)
{
int32_t
index
=
0
;
int32_t
htp_
index
=
0
;
do
{
SStrToken
t0
=
tStrGetToken
(
sql
,
&
index
,
false
);
SStrToken
t0
=
tStrGetToken
(
sql
,
&
htp_
index
,
false
);
if
(
t0
.
type
!=
TK_LP
)
{
return
t0
.
type
==
TK_ALTER
;
}
...
...
src/query/CMakeLists.txt
浏览文件 @
7522fb75
...
...
@@ -12,10 +12,14 @@ TARGET_LINK_LIBRARIES(query tsdb tutil lua)
IF
(
TD_LINUX
)
TARGET_LINK_LIBRARIES
(
query m rt lua
)
ADD_SUBDIRECTORY
(
tests
)
IF
(
NOT TD_NINGSI_60
)
ADD_SUBDIRECTORY
(
tests
)
ENDIF
()
ENDIF
()
IF
(
TD_DARWIN
)
TARGET_LINK_LIBRARIES
(
query m lua
)
ADD_SUBDIRECTORY
(
tests
)
IF
(
NOT TD_NINGSI_60
)
ADD_SUBDIRECTORY
(
tests
)
ENDIF
()
ENDIF
()
src/query/src/qAggMain.c
浏览文件 @
7522fb75
...
...
@@ -895,14 +895,14 @@ static void minMax_function(SQLFunctionCtx *pCtx, char *pOutput, int32_t isMin,
}
void
*
tval
=
NULL
;
int16_t
index
=
0
;
int16_t
qry_
index
=
0
;
if
(
isMin
)
{
tval
=
&
pCtx
->
preAggVals
.
statis
.
min
;
index
=
pCtx
->
preAggVals
.
statis
.
minIndex
;
qry_
index
=
pCtx
->
preAggVals
.
statis
.
minIndex
;
}
else
{
tval
=
&
pCtx
->
preAggVals
.
statis
.
max
;
index
=
pCtx
->
preAggVals
.
statis
.
maxIndex
;
qry_
index
=
pCtx
->
preAggVals
.
statis
.
maxIndex
;
}
TSKEY
key
=
TSKEY_INITIAL_VAL
;
...
...
@@ -913,12 +913,12 @@ static void minMax_function(SQLFunctionCtx *pCtx, char *pOutput, int32_t isMin,
*
* The following codes of 3 lines will be removed later.
*/
// if (
index < 0 ||
index >= pCtx->size + pCtx->startOffset) {
// index = 0;
// if (
qry_index < 0 || qry_
index >= pCtx->size + pCtx->startOffset) {
//
qry_
index = 0;
// }
// the index is the original position, not the relative position
key
=
pCtx
->
ptsList
[
index
];
key
=
pCtx
->
ptsList
[
qry_
index
];
}
if
(
IS_SIGNED_NUMERIC_TYPE
(
pCtx
->
inputType
))
{
...
...
@@ -1554,15 +1554,15 @@ static void first_function(SQLFunctionCtx *pCtx) {
SET_VAL
(
pCtx
,
notNullElems
,
1
);
}
static
void
first_data_assign_impl
(
SQLFunctionCtx
*
pCtx
,
char
*
pData
,
int32_t
index
)
{
static
void
first_data_assign_impl
(
SQLFunctionCtx
*
pCtx
,
char
*
pData
,
int32_t
qry_
index
)
{
int64_t
*
timestamp
=
GET_TS_LIST
(
pCtx
);
SFirstLastInfo
*
pInfo
=
(
SFirstLastInfo
*
)(
pCtx
->
pOutput
+
pCtx
->
inputBytes
);
if
(
pInfo
->
hasResult
!=
DATA_SET_FLAG
||
timestamp
[
index
]
<
pInfo
->
ts
)
{
if
(
pInfo
->
hasResult
!=
DATA_SET_FLAG
||
timestamp
[
qry_
index
]
<
pInfo
->
ts
)
{
memcpy
(
pCtx
->
pOutput
,
pData
,
pCtx
->
inputBytes
);
pInfo
->
hasResult
=
DATA_SET_FLAG
;
pInfo
->
ts
=
timestamp
[
index
];
pInfo
->
ts
=
timestamp
[
qry_
index
];
DO_UPDATE_TAG_COLUMNS
(
pCtx
,
pInfo
->
ts
);
}
...
...
@@ -1685,19 +1685,19 @@ static void last_function(SQLFunctionCtx *pCtx) {
SET_VAL
(
pCtx
,
notNullElems
,
1
);
}
static
void
last_data_assign_impl
(
SQLFunctionCtx
*
pCtx
,
char
*
pData
,
int32_t
index
)
{
static
void
last_data_assign_impl
(
SQLFunctionCtx
*
pCtx
,
char
*
pData
,
int32_t
qry_
index
)
{
int64_t
*
timestamp
=
GET_TS_LIST
(
pCtx
);
SFirstLastInfo
*
pInfo
=
(
SFirstLastInfo
*
)(
pCtx
->
pOutput
+
pCtx
->
inputBytes
);
if
(
pInfo
->
hasResult
!=
DATA_SET_FLAG
||
pInfo
->
ts
<
timestamp
[
index
])
{
if
(
pInfo
->
hasResult
!=
DATA_SET_FLAG
||
pInfo
->
ts
<
timestamp
[
qry_
index
])
{
#if defined(_DEBUG_VIEW)
qDebug
(
"assign index:%d, ts:%"
PRId64
", val:%d, "
,
index
,
timestamp
[
index
],
*
(
int32_t
*
)
pData
);
#endif
memcpy
(
pCtx
->
pOutput
,
pData
,
pCtx
->
inputBytes
);
pInfo
->
hasResult
=
DATA_SET_FLAG
;
pInfo
->
ts
=
timestamp
[
index
];
pInfo
->
ts
=
timestamp
[
qry_
index
];
DO_UPDATE_TAG_COLUMNS
(
pCtx
,
pInfo
->
ts
);
}
...
...
@@ -2562,12 +2562,12 @@ static bool leastsquares_function_setup(SQLFunctionCtx *pCtx, SResultRowCellInfo
return
true
;
}
#define LEASTSQR_CAL(p, x, y, index, step) \
#define LEASTSQR_CAL(p, x, y,
qry_
index, step) \
do { \
(p)[0][0] += (double)(x) * (x); \
(p)[0][1] += (double)(x); \
(p)[0][2] += (double)(x) * (y)[index]; \
(p)[1][2] += (y)[index]; \
(p)[0][2] += (double)(x) * (y)[
qry_
index]; \
(p)[1][2] += (y)[
qry_
index]; \
(x) += step; \
} while (0)
...
...
@@ -2992,7 +2992,7 @@ static void deriv_function(SQLFunctionCtx *pCtx) {
} else { \
*(type *)(ctx)->pOutput = *(type *)(d) - (*(type *)(&(ctx)->param[1].i64)); \
*(type *)(&(ctx)->param[1].i64) = *(type *)(d); \
*(int64_t *)(ctx)->ptsOutputBuf = GET_TS_DATA(ctx, index); \
*(int64_t *)(ctx)->ptsOutputBuf = GET_TS_DATA(ctx,
qry_
index); \
} \
} while (0);
...
...
@@ -3164,16 +3164,16 @@ static void diff_function(SQLFunctionCtx *pCtx) {
char
*
getArithColumnData
(
void
*
param
,
const
char
*
name
,
int32_t
colId
)
{
SArithmeticSupport
*
pSupport
=
(
SArithmeticSupport
*
)
param
;
int32_t
index
=
-
1
;
int32_t
qry_
index
=
-
1
;
for
(
int32_t
i
=
0
;
i
<
pSupport
->
numOfCols
;
++
i
)
{
if
(
colId
==
pSupport
->
colList
[
i
].
colId
)
{
index
=
i
;
qry_
index
=
i
;
break
;
}
}
assert
(
index
>=
0
);
return
pSupport
->
data
[
index
]
+
pSupport
->
offset
*
pSupport
->
colList
[
index
].
bytes
;
assert
(
qry_
index
>=
0
);
return
pSupport
->
data
[
qry_index
]
+
pSupport
->
offset
*
pSupport
->
colList
[
qry_
index
].
bytes
;
}
static
void
arithmetic_function
(
SQLFunctionCtx
*
pCtx
)
{
...
...
@@ -3381,14 +3381,14 @@ static double twa_get_area(SPoint1 s, SPoint1 e) {
return
val
;
}
static
int32_t
twa_function_impl
(
SQLFunctionCtx
*
pCtx
,
int32_t
index
,
int32_t
size
)
{
static
int32_t
twa_function_impl
(
SQLFunctionCtx
*
pCtx
,
int32_t
qry_
index
,
int32_t
size
)
{
int32_t
notNullElems
=
0
;
SResultRowCellInfo
*
pResInfo
=
GET_RES_INFO
(
pCtx
);
STwaInfo
*
pInfo
=
GET_ROWCELL_INTERBUF
(
pResInfo
);
TSKEY
*
tsList
=
GET_TS_LIST
(
pCtx
);
int32_t
i
=
index
;
int32_t
i
=
qry_
index
;
int32_t
step
=
GET_FORWARD_DIRECTION_FACTOR
(
pCtx
->
order
);
SPoint1
*
last
=
&
pInfo
->
p
;
...
...
@@ -3399,7 +3399,7 @@ static int32_t twa_function_impl(SQLFunctionCtx* pCtx, int32_t index, int32_t si
assert
(
last
->
key
==
INT64_MIN
);
last
->
key
=
tsList
[
i
];
GET_TYPED_DATA
(
last
->
val
,
double
,
pCtx
->
inputType
,
GET_INPUT_DATA
(
pCtx
,
index
));
GET_TYPED_DATA
(
last
->
val
,
double
,
pCtx
->
inputType
,
GET_INPUT_DATA
(
pCtx
,
qry_
index
));
pInfo
->
dOutput
+=
twa_get_area
(
pCtx
->
start
,
*
last
);
...
...
@@ -3409,7 +3409,7 @@ static int32_t twa_function_impl(SQLFunctionCtx* pCtx, int32_t index, int32_t si
i
+=
step
;
}
else
if
(
pInfo
->
p
.
key
==
INT64_MIN
)
{
last
->
key
=
tsList
[
i
];
GET_TYPED_DATA
(
last
->
val
,
double
,
pCtx
->
inputType
,
GET_INPUT_DATA
(
pCtx
,
index
));
GET_TYPED_DATA
(
last
->
val
,
double
,
pCtx
->
inputType
,
GET_INPUT_DATA
(
pCtx
,
qry_
index
));
pInfo
->
hasResult
=
DATA_SET_FLAG
;
pInfo
->
win
.
skey
=
last
->
key
;
...
...
@@ -4246,7 +4246,7 @@ void generateBlockDistResult(STableBlockDist *pTableBlockDist, char* result) {
"5th=[%d], 10th=[%d], 20th=[%d], 30th=[%d], 40th=[%d], 50th=[%d]
\n\t
"
"60th=[%d], 70th=[%d], 80th=[%d], 90th=[%d], 95th=[%d], 99th=[%d]
\n\t
"
"Min=[%"
PRId64
"(Rows)] Max=[%"
PRId64
"(Rows)] Avg=[%"
PRId64
"(Rows)] Stddev=[%.2f]
\n\t
"
"Rows=[%"
PRIu64
"], Blocks=[%"
PRId64
"], SmallBlocks=[%d], Size=[%.3f(Kb)] Comp=[%.
2f
]
\n\t
"
"Rows=[%"
PRIu64
"], Blocks=[%"
PRId64
"], SmallBlocks=[%d], Size=[%.3f(Kb)] Comp=[%.
5g
]
\n\t
"
"RowsInMem=[%d]
\n\t
"
,
percentiles
[
0
],
percentiles
[
1
],
percentiles
[
2
],
percentiles
[
3
],
percentiles
[
4
],
percentiles
[
5
],
percentiles
[
6
],
percentiles
[
7
],
percentiles
[
8
],
percentiles
[
9
],
percentiles
[
10
],
percentiles
[
11
],
...
...
src/query/src/qExecutor.c
浏览文件 @
7522fb75
...
...
@@ -478,8 +478,8 @@ static bool chkResultRowFromKey(SQueryRuntimeEnv *pRuntimeEnv, SResultRowInfo *p
existed
=
(
pResultRowInfo
->
pResult
[
0
]
==
(
*
p1
));
}
else
{
// check if current pResultRowInfo contains the existed pResultRow
SET_RES_EXT_WINDOW_KEY
(
pRuntimeEnv
->
keyBuf
,
pData
,
bytes
,
uid
,
pResultRowInfo
);
int64_t
*
index
=
taosHashGet
(
pRuntimeEnv
->
pResultRowListSet
,
pRuntimeEnv
->
keyBuf
,
GET_RES_EXT_WINDOW_KEY_LEN
(
bytes
));
if
(
index
!=
NULL
)
{
int64_t
*
qry_
index
=
taosHashGet
(
pRuntimeEnv
->
pResultRowListSet
,
pRuntimeEnv
->
keyBuf
,
GET_RES_EXT_WINDOW_KEY_LEN
(
bytes
));
if
(
qry_
index
!=
NULL
)
{
existed
=
true
;
}
else
{
existed
=
false
;
...
...
@@ -517,9 +517,9 @@ static SResultRow* doSetResultOutBufByKey(SQueryRuntimeEnv* pRuntimeEnv, SResult
pResultRowInfo
->
curPos
=
0
;
}
else
{
// check if current pResultRowInfo contains the existed pResultRow
SET_RES_EXT_WINDOW_KEY
(
pRuntimeEnv
->
keyBuf
,
pData
,
bytes
,
tid
,
pResultRowInfo
);
int64_t
*
index
=
taosHashGet
(
pRuntimeEnv
->
pResultRowListSet
,
pRuntimeEnv
->
keyBuf
,
GET_RES_EXT_WINDOW_KEY_LEN
(
bytes
));
if
(
index
!=
NULL
)
{
pResultRowInfo
->
curPos
=
(
int32_t
)
*
index
;
int64_t
*
qry_
index
=
taosHashGet
(
pRuntimeEnv
->
pResultRowListSet
,
pRuntimeEnv
->
keyBuf
,
GET_RES_EXT_WINDOW_KEY_LEN
(
bytes
));
if
(
qry_
index
!=
NULL
)
{
pResultRowInfo
->
curPos
=
(
int32_t
)
*
qry_
index
;
existed
=
true
;
}
else
{
existed
=
false
;
...
...
@@ -555,9 +555,9 @@ static SResultRow* doSetResultOutBufByKey(SQueryRuntimeEnv* pRuntimeEnv, SResult
pResultRowInfo
->
curPos
=
pResultRowInfo
->
size
;
pResultRowInfo
->
pResult
[
pResultRowInfo
->
size
++
]
=
pResult
;
int64_t
index
=
pResultRowInfo
->
curPos
;
int64_t
qry_
index
=
pResultRowInfo
->
curPos
;
SET_RES_EXT_WINDOW_KEY
(
pRuntimeEnv
->
keyBuf
,
pData
,
bytes
,
tid
,
pResultRowInfo
);
taosHashPut
(
pRuntimeEnv
->
pResultRowListSet
,
pRuntimeEnv
->
keyBuf
,
GET_RES_EXT_WINDOW_KEY_LEN
(
bytes
),
&
index
,
POINTER_BYTES
);
taosHashPut
(
pRuntimeEnv
->
pResultRowListSet
,
pRuntimeEnv
->
keyBuf
,
GET_RES_EXT_WINDOW_KEY_LEN
(
bytes
),
&
qry_
index
,
POINTER_BYTES
);
}
// too many time window in query
...
...
@@ -1166,8 +1166,8 @@ static TSKEY getStartTsKey(SQueryAttr* pQueryAttr, STimeWindow* win, const TSKEY
static
void
setArithParams
(
SArithmeticSupport
*
sas
,
SExprInfo
*
pExprInfo
,
SSDataBlock
*
pSDataBlock
)
{
sas
->
numOfCols
=
(
int32_t
)
pSDataBlock
->
info
.
numOfCols
;
sas
->
pExprInfo
=
pExprInfo
;
if
(
sas
->
colList
!=
NULL
)
{
return
;
if
(
sas
->
colList
)
{
free
(
sas
->
colList
);
// free pre malloc memory
}
sas
->
colList
=
calloc
(
1
,
pSDataBlock
->
info
.
numOfCols
*
sizeof
(
SColumnInfo
));
for
(
int32_t
i
=
0
;
i
<
sas
->
numOfCols
;
++
i
)
{
...
...
@@ -1175,6 +1175,9 @@ static void setArithParams(SArithmeticSupport* sas, SExprInfo *pExprInfo, SSData
sas
->
colList
[
i
]
=
pColData
->
info
;
}
if
(
sas
->
data
)
{
free
(
sas
->
data
);
// free pre malloc memory
}
sas
->
data
=
calloc
(
sas
->
numOfCols
,
POINTER_BYTES
);
// set the input column data
...
...
@@ -1320,14 +1323,14 @@ void doTimeWindowInterpolation(SOperatorInfo* pOperator, SOptrBasicInfo* pInfo,
}
SColIndex
*
pColIndex
=
&
pExpr
[
k
].
base
.
colInfo
;
int16_t
index
=
pColIndex
->
colIndex
;
SColumnInfoData
*
pColInfo
=
taosArrayGet
(
pDataBlock
,
index
);
int16_t
qry_
index
=
pColIndex
->
colIndex
;
SColumnInfoData
*
pColInfo
=
taosArrayGet
(
pDataBlock
,
qry_
index
);
assert
(
pColInfo
->
info
.
colId
==
pColIndex
->
colId
&&
curTs
!=
windowKey
);
double
v1
=
0
,
v2
=
0
,
v
=
0
;
if
(
prevRowIndex
==
-
1
)
{
GET_TYPED_DATA
(
v1
,
double
,
pColInfo
->
info
.
type
,
(
char
*
)
pRuntimeEnv
->
prevRow
[
index
]);
GET_TYPED_DATA
(
v1
,
double
,
pColInfo
->
info
.
type
,
(
char
*
)
pRuntimeEnv
->
prevRow
[
qry_
index
]);
}
else
{
GET_TYPED_DATA
(
v1
,
double
,
pColInfo
->
info
.
type
,
(
char
*
)
pColInfo
->
pData
+
prevRowIndex
*
pColInfo
->
info
.
bytes
);
}
...
...
@@ -1344,7 +1347,7 @@ void doTimeWindowInterpolation(SOperatorInfo* pOperator, SOptrBasicInfo* pInfo,
if
(
pColInfo
->
info
.
type
==
TSDB_DATA_TYPE_BINARY
||
pColInfo
->
info
.
type
==
TSDB_DATA_TYPE_NCHAR
)
{
if
(
prevRowIndex
==
-
1
)
{
pCtx
[
k
].
start
.
ptr
=
(
char
*
)
pRuntimeEnv
->
prevRow
[
index
];
pCtx
[
k
].
start
.
ptr
=
(
char
*
)
pRuntimeEnv
->
prevRow
[
qry_
index
];
}
else
{
pCtx
[
k
].
start
.
ptr
=
(
char
*
)
pColInfo
->
pData
+
prevRowIndex
*
pColInfo
->
info
.
bytes
;
}
...
...
@@ -2779,16 +2782,16 @@ static bool doFilterByBlockStatistics(SQueryRuntimeEnv* pRuntimeEnv, SDataStatis
for
(
int32_t
k
=
0
;
k
<
pQueryAttr
->
numOfFilterCols
;
++
k
)
{
SSingleColumnFilterInfo
*
pFilterInfo
=
&
pQueryAttr
->
pFilterInfo
[
k
];
int32_t
index
=
-
1
;
int32_t
qry_
index
=
-
1
;
for
(
int32_t
i
=
0
;
i
<
pQueryAttr
->
numOfCols
;
++
i
)
{
if
(
pDataStatis
[
i
].
colId
==
pFilterInfo
->
info
.
colId
)
{
index
=
i
;
qry_
index
=
i
;
break
;
}
}
// no statistics data, load the true data block
if
(
index
==
-
1
)
{
if
(
qry_
index
==
-
1
)
{
return
true
;
}
...
...
@@ -2798,7 +2801,7 @@ static bool doFilterByBlockStatistics(SQueryRuntimeEnv* pRuntimeEnv, SDataStatis
}
// all data in current column are NULL, no need to check its boundary value
if
(
pDataStatis
[
index
].
numOfNull
==
numOfRows
)
{
if
(
pDataStatis
[
qry_
index
].
numOfNull
==
numOfRows
)
{
// if isNULL query exists, load the null data column
for
(
int32_t
j
=
0
;
j
<
pFilterInfo
->
numOfFilters
;
++
j
)
{
...
...
@@ -2811,7 +2814,7 @@ static bool doFilterByBlockStatistics(SQueryRuntimeEnv* pRuntimeEnv, SDataStatis
continue
;
}
SDataStatis
*
pDataBlockst
=
&
pDataStatis
[
index
];
SDataStatis
*
pDataBlockst
=
&
pDataStatis
[
qry_
index
];
if
(
pFilterInfo
->
info
.
type
==
TSDB_DATA_TYPE_FLOAT
)
{
float
minval
=
(
float
)(
*
(
double
*
)(
&
pDataBlockst
->
min
));
...
...
@@ -4593,10 +4596,10 @@ void queryCostStatis(SQInfo *pQInfo) {
// TSKEY key = pTableQueryInfo->win.skey;
//
// pWindowResInfo->prevSKey = tw.skey;
// int32_t index = pRuntimeEnv->resultRowInfo.curIndex;
// int32_t
qry_
index = pRuntimeEnv->resultRowInfo.curIndex;
//
// int32_t numOfRes = tableApplyFunctionsOnBlock(pRuntimeEnv, pBlockInfo, NULL, binarySearchForKey, pDataBlock);
// pRuntimeEnv->resultRowInfo.curIndex = index; // restore the window index
// pRuntimeEnv->resultRowInfo.curIndex =
qry_
index; // restore the window index
//
// qDebug("QInfo:0x%"PRIx64" check data block, brange:%" PRId64 "-%" PRId64 ", numOfRows:%d, numOfRes:%d, lastKey:%" PRId64,
// GET_QID(pRuntimeEnv), pBlockInfo->window.skey, pBlockInfo->window.ekey, pBlockInfo->rows, numOfRes,
...
...
@@ -5325,15 +5328,15 @@ SArray* getOrderCheckColumns(SQueryAttr* pQuery) {
{
numOfCols
=
(
int32_t
)
taosArrayGetSize
(
pOrderColumns
);
for
(
int32_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
SColIndex
*
index
=
taosArrayGet
(
pOrderColumns
,
i
);
SColIndex
*
qry_
index
=
taosArrayGet
(
pOrderColumns
,
i
);
for
(
int32_t
j
=
0
;
j
<
pQuery
->
numOfOutput
;
++
j
)
{
SSqlExpr
*
pExpr
=
&
pQuery
->
pExpr1
[
j
].
base
;
int32_t
functionId
=
pExpr
->
functionId
;
if
(
index
->
colId
==
pExpr
->
colInfo
.
colId
&&
if
(
qry_
index
->
colId
==
pExpr
->
colInfo
.
colId
&&
(
functionId
==
TSDB_FUNC_PRJ
||
functionId
==
TSDB_FUNC_TAG
||
functionId
==
TSDB_FUNC_TS
))
{
index
->
colIndex
=
j
;
index
->
colId
=
pExpr
->
resColId
;
qry_
index
->
colIndex
=
j
;
qry_
index
->
colId
=
pExpr
->
resColId
;
}
}
}
...
...
@@ -5353,24 +5356,24 @@ SArray* getResultGroupCheckColumns(SQueryAttr* pQuery) {
}
for
(
int32_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
SColIndex
*
index
=
taosArrayGet
(
pOrderColumns
,
i
);
SColIndex
*
qry_
index
=
taosArrayGet
(
pOrderColumns
,
i
);
bool
found
=
false
;
for
(
int32_t
j
=
0
;
j
<
pQuery
->
numOfOutput
;
++
j
)
{
SSqlExpr
*
pExpr
=
&
pQuery
->
pExpr1
[
j
].
base
;
// TSDB_FUNC_TAG_DUMMY function needs to be ignored
if
(
index
->
colId
==
pExpr
->
colInfo
.
colId
&&
if
(
qry_
index
->
colId
==
pExpr
->
colInfo
.
colId
&&
((
TSDB_COL_IS_TAG
(
pExpr
->
colInfo
.
flag
)
&&
((
pExpr
->
functionId
==
TSDB_FUNC_TAG
)
||
(
pExpr
->
functionId
==
TSDB_FUNC_TAGPRJ
)))
||
(
TSDB_COL_IS_NORMAL_COL
(
pExpr
->
colInfo
.
flag
)
&&
pExpr
->
functionId
==
TSDB_FUNC_PRJ
)))
{
index
->
colIndex
=
j
;
index
->
colId
=
pExpr
->
resColId
;
qry_
index
->
colIndex
=
j
;
qry_
index
->
colId
=
pExpr
->
resColId
;
found
=
true
;
break
;
}
}
assert
(
found
&&
index
->
colIndex
>=
0
&&
index
->
colIndex
<
pQuery
->
numOfOutput
);
assert
(
found
&&
qry_index
->
colIndex
>=
0
&&
qry_
index
->
colIndex
<
pQuery
->
numOfOutput
);
}
return
pOrderColumns
;
...
...
@@ -5423,8 +5426,8 @@ SOperatorInfo* createGlobalAggregateOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv,
for
(
int32_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
pInfo
->
prevRow
[
i
]
=
(
char
*
)
pInfo
->
prevRow
+
offset
;
SColIndex
*
index
=
taosArrayGet
(
pInfo
->
orderColumnList
,
i
);
offset
+=
pExpr
[
index
->
colIndex
].
base
.
resBytes
;
SColIndex
*
qry_
index
=
taosArrayGet
(
pInfo
->
orderColumnList
,
i
);
offset
+=
pExpr
[
qry_
index
->
colIndex
].
base
.
resBytes
;
}
numOfCols
=
(
pInfo
->
groupColumnList
!=
NULL
)
?
(
int32_t
)
taosArrayGetSize
(
pInfo
->
groupColumnList
)
:
0
;
...
...
@@ -5434,8 +5437,8 @@ SOperatorInfo* createGlobalAggregateOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv,
for
(
int32_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
pInfo
->
currentGroupColData
[
i
]
=
(
char
*
)
pInfo
->
currentGroupColData
+
offset
;
SColIndex
*
index
=
taosArrayGet
(
pInfo
->
groupColumnList
,
i
);
offset
+=
pExpr
[
index
->
colIndex
].
base
.
resBytes
;
SColIndex
*
qry_
index
=
taosArrayGet
(
pInfo
->
groupColumnList
,
i
);
offset
+=
pExpr
[
qry_
index
->
colIndex
].
base
.
resBytes
;
}
initResultRowInfo
(
&
pInfo
->
binfo
.
resultRowInfo
,
8
,
TSDB_DATA_TYPE_INT
);
...
...
@@ -5482,8 +5485,8 @@ SOperatorInfo *createMultiwaySortOperatorInfo(SQueryRuntimeEnv *pRuntimeEnv, SEx
for
(
int32_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
pInfo
->
prevRow
[
i
]
=
(
char
*
)
pInfo
->
prevRow
+
offset
;
SColIndex
*
index
=
taosArrayGet
(
pInfo
->
orderColumnList
,
i
);
offset
+=
pExpr
[
index
->
colIndex
].
base
.
colBytes
;
SColIndex
*
qry_
index
=
taosArrayGet
(
pInfo
->
orderColumnList
,
i
);
offset
+=
pExpr
[
qry_
index
->
colIndex
].
base
.
colBytes
;
}
}
...
...
@@ -7025,8 +7028,8 @@ SOperatorInfo* createSLimitOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv, SOperator
for
(
int32_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
pInfo
->
prevRow
[
i
]
=
(
char
*
)
pInfo
->
prevRow
+
offset
;
SColIndex
*
index
=
taosArrayGet
(
pInfo
->
orderColumnList
,
i
);
offset
+=
pExpr
[
index
->
colIndex
].
base
.
resBytes
;
SColIndex
*
qry_
index
=
taosArrayGet
(
pInfo
->
orderColumnList
,
i
);
offset
+=
pExpr
[
qry_
index
->
colIndex
].
base
.
resBytes
;
}
pInfo
->
pRes
=
createOutputBuf
(
pExpr
,
numOfOutput
,
pRuntimeEnv
->
resultInfo
.
capacity
);
...
...
@@ -8206,11 +8209,11 @@ int32_t createIndirectQueryFuncExprFromMsg(SQueryTableMsg* pQueryMsg, int32_t nu
type
=
TSDB_DATA_TYPE_DOUBLE
;
bytes
=
tDataTypes
[
type
].
bytes
;
}
else
{
int32_t
index
=
pExprs
[
i
].
base
.
colInfo
.
colIndex
;
assert
(
prevExpr
[
index
].
base
.
resColId
==
pExprs
[
i
].
base
.
colInfo
.
colId
);
int32_t
qry_
index
=
pExprs
[
i
].
base
.
colInfo
.
colIndex
;
assert
(
prevExpr
[
qry_
index
].
base
.
resColId
==
pExprs
[
i
].
base
.
colInfo
.
colId
);
type
=
prevExpr
[
index
].
base
.
resType
;
bytes
=
prevExpr
[
index
].
base
.
resBytes
;
type
=
prevExpr
[
qry_
index
].
base
.
resType
;
bytes
=
prevExpr
[
qry_
index
].
base
.
resBytes
;
}
int32_t
param
=
(
int32_t
)
pExprs
[
i
].
base
.
param
[
0
].
i64
;
...
...
@@ -8541,7 +8544,7 @@ SQInfo* createQInfoImpl(SQueryTableMsg* pQueryMsg, SGroupbyExpr* pGroupbyExpr, S
SQueryRuntimeEnv
*
pRuntimeEnv
=
&
pQInfo
->
runtimeEnv
;
STimeWindow
window
=
pQueryAttr
->
window
;
int32_t
index
=
0
;
int32_t
qry_
index
=
0
;
for
(
int32_t
i
=
0
;
i
<
numOfGroups
;
++
i
)
{
SArray
*
pa
=
taosArrayGetP
(
pQueryAttr
->
tableGroupInfo
.
pGroupList
,
i
);
...
...
@@ -8557,7 +8560,7 @@ SQInfo* createQInfoImpl(SQueryTableMsg* pQueryMsg, SGroupbyExpr* pGroupbyExpr, S
STableKeyInfo
*
info
=
taosArrayGet
(
pa
,
j
);
window
.
skey
=
info
->
lastKey
;
void
*
buf
=
(
char
*
)
pQInfo
->
pBuf
+
index
*
sizeof
(
STableQueryInfo
);
void
*
buf
=
(
char
*
)
pQInfo
->
pBuf
+
qry_
index
*
sizeof
(
STableQueryInfo
);
STableQueryInfo
*
item
=
createTableQueryInfo
(
pQueryAttr
,
info
->
pTable
,
pQueryAttr
->
groupbyColumn
,
window
,
buf
);
if
(
item
==
NULL
)
{
goto
_cleanup
;
...
...
@@ -8568,7 +8571,7 @@ SQInfo* createQInfoImpl(SQueryTableMsg* pQueryMsg, SGroupbyExpr* pGroupbyExpr, S
STableId
*
id
=
TSDB_TABLEID
(
info
->
pTable
);
taosHashPut
(
pRuntimeEnv
->
tableqinfoGroupInfo
.
map
,
&
id
->
tid
,
sizeof
(
id
->
tid
),
&
item
,
POINTER_BYTES
);
index
+=
1
;
qry_
index
+=
1
;
}
}
...
...
src/query/src/qExtbuffer.c
浏览文件 @
7522fb75
...
...
@@ -448,9 +448,9 @@ int32_t compare_a(tOrderDescriptor *pDescriptor, int32_t numOfRows1, int32_t s1,
int32_t
compare_aRv
(
SSDataBlock
*
pBlock
,
SArray
*
colIndex
,
int32_t
numOfCols
,
int32_t
rowIndex
,
char
**
buffer
,
int32_t
order
)
{
for
(
int32_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
SColIndex
*
pColIndex
=
taosArrayGet
(
colIndex
,
i
);
int32_t
index
=
pColIndex
->
colIndex
;
int32_t
qry_
index
=
pColIndex
->
colIndex
;
SColumnInfoData
*
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
index
);
SColumnInfoData
*
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
qry_
index
);
assert
(
pColIndex
->
colId
==
pColInfo
->
info
.
colId
);
char
*
data
=
pColInfo
->
pData
+
rowIndex
*
pColInfo
->
info
.
bytes
;
...
...
@@ -1022,14 +1022,14 @@ void tColModelCompact(SColumnModel *pModel, tFilePage *inputBuffer, int32_t maxE
}
}
SSchema
*
getColumnModelSchema
(
SColumnModel
*
pColumnModel
,
int32_t
index
)
{
assert
(
pColumnModel
!=
NULL
&&
index
>=
0
&&
index
<
pColumnModel
->
numOfCols
);
return
&
pColumnModel
->
pFields
[
index
].
field
;
SSchema
*
getColumnModelSchema
(
SColumnModel
*
pColumnModel
,
int32_t
qry_
index
)
{
assert
(
pColumnModel
!=
NULL
&&
qry_index
>=
0
&&
qry_
index
<
pColumnModel
->
numOfCols
);
return
&
pColumnModel
->
pFields
[
qry_
index
].
field
;
}
int16_t
getColumnModelOffset
(
SColumnModel
*
pColumnModel
,
int32_t
index
)
{
assert
(
pColumnModel
!=
NULL
&&
index
>=
0
&&
index
<
pColumnModel
->
numOfCols
);
return
pColumnModel
->
pFields
[
index
].
offset
;
int16_t
getColumnModelOffset
(
SColumnModel
*
pColumnModel
,
int32_t
qry_
index
)
{
assert
(
pColumnModel
!=
NULL
&&
qry_index
>=
0
&&
qry_
index
<
pColumnModel
->
numOfCols
);
return
pColumnModel
->
pFields
[
qry_
index
].
offset
;
}
void
tColModelErase
(
SColumnModel
*
pModel
,
tFilePage
*
inputBuffer
,
int32_t
blockCapacity
,
int32_t
s
,
int32_t
e
)
{
...
...
@@ -1103,17 +1103,17 @@ void tOrderDescDestroy(tOrderDescriptor *pDesc) {
tfree
(
pDesc
);
}
void
taoscQSort
(
void
**
pCols
,
SSchema
*
pSchema
,
int32_t
numOfCols
,
int32_t
numOfRows
,
int32_t
index
,
__compar_fn_t
compareFn
)
{
assert
(
numOfRows
>
0
&&
numOfCols
>
0
&&
index
>=
0
&&
index
<
numOfCols
);
void
taoscQSort
(
void
**
pCols
,
SSchema
*
pSchema
,
int32_t
numOfCols
,
int32_t
numOfRows
,
int32_t
qry_
index
,
__compar_fn_t
compareFn
)
{
assert
(
numOfRows
>
0
&&
numOfCols
>
0
&&
qry_index
>=
0
&&
qry_
index
<
numOfCols
);
int32_t
bytes
=
pSchema
[
index
].
bytes
;
int32_t
bytes
=
pSchema
[
qry_
index
].
bytes
;
int32_t
size
=
bytes
+
sizeof
(
int32_t
);
char
*
buf
=
calloc
(
1
,
size
*
numOfRows
);
for
(
int32_t
i
=
0
;
i
<
numOfRows
;
++
i
)
{
char
*
dest
=
buf
+
size
*
i
;
memcpy
(
dest
,
((
char
*
)
pCols
[
index
])
+
bytes
*
i
,
bytes
);
memcpy
(
dest
,
((
char
*
)
pCols
[
qry_
index
])
+
bytes
*
i
,
bytes
);
*
(
int32_t
*
)(
dest
+
bytes
)
=
i
;
}
...
...
@@ -1125,7 +1125,7 @@ void taoscQSort(void** pCols, SSchema* pSchema, int32_t numOfCols, int32_t numOf
for
(
int32_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
int32_t
bytes1
=
pSchema
[
i
].
bytes
;
if
(
i
==
index
)
{
if
(
i
==
qry_
index
)
{
for
(
int32_t
j
=
0
;
j
<
numOfRows
;
++
j
){
char
*
src
=
buf
+
(
j
*
size
);
char
*
dest
=
((
char
*
)
pCols
[
i
])
+
(
j
*
bytes1
);
...
...
src/query/src/qFill.c
浏览文件 @
7522fb75
此差异已折叠。
点击以展开。
src/query/src/qHistogram.c
浏览文件 @
7522fb75
此差异已折叠。
点击以展开。
src/query/src/qPercentile.c
浏览文件 @
7522fb75
此差异已折叠。
点击以展开。
src/query/src/qPlan.c
浏览文件 @
7522fb75
此差异已折叠。
点击以展开。
src/query/src/qSqlParser.c
浏览文件 @
7522fb75
此差异已折叠。
点击以展开。
src/query/src/qTsbuf.c
浏览文件 @
7522fb75
此差异已折叠。
点击以展开。
src/query/src/qUtil.c
浏览文件 @
7522fb75
此差异已折叠。
点击以展开。
src/rpc/src/rpcCache.c
浏览文件 @
7522fb75
此差异已折叠。
点击以展开。
src/rpc/src/rpcTcp.c
浏览文件 @
7522fb75
此差异已折叠。
点击以展开。
src/rpc/src/rpcUdp.c
浏览文件 @
7522fb75
此差异已折叠。
点击以展开。
src/rpc/test/rclient.c
浏览文件 @
7522fb75
此差异已折叠。
点击以展开。
src/rpc/test/rsclient.c
浏览文件 @
7522fb75
此差异已折叠。
点击以展开。
src/rpc/test/rserver.c
浏览文件 @
7522fb75
此差异已折叠。
点击以展开。
src/sync/src/syncMain.c
浏览文件 @
7522fb75
此差异已折叠。
点击以展开。
src/sync/src/syncRetrieve.c
浏览文件 @
7522fb75
此差异已折叠。
点击以展开。
src/sync/test/syncClient.c
浏览文件 @
7522fb75
此差异已折叠。
点击以展开。
src/sync/test/syncServer.c
浏览文件 @
7522fb75
此差异已折叠。
点击以展开。
src/tsdb/src/tsdbFS.c
浏览文件 @
7522fb75
此差异已折叠。
点击以展开。
src/tsdb/src/tsdbMain.c
浏览文件 @
7522fb75
此差异已折叠。
点击以展开。
src/tsdb/src/tsdbMeta.c
浏览文件 @
7522fb75
此差异已折叠。
点击以展开。
src/tsdb/src/tsdbRead.c
浏览文件 @
7522fb75
此差异已折叠。
点击以展开。
src/util/CMakeLists.txt
浏览文件 @
7522fb75
此差异已折叠。
点击以展开。
src/util/src/hash.c
浏览文件 @
7522fb75
此差异已折叠。
点击以展开。
src/util/src/tarray.c
浏览文件 @
7522fb75
此差异已折叠。
点击以展开。
src/util/src/tcache.c
浏览文件 @
7522fb75
此差异已折叠。
点击以展开。
src/util/src/tcompare.c
浏览文件 @
7522fb75
此差异已折叠。
点击以展开。
src/util/src/tmempool.c
浏览文件 @
7522fb75
此差异已折叠。
点击以展开。
src/util/src/tnettest.c
浏览文件 @
7522fb75
此差异已折叠。
点击以展开。
src/util/src/tref.c
浏览文件 @
7522fb75
此差异已折叠。
点击以展开。
src/vnode/src/vnodeMain.c
浏览文件 @
7522fb75
此差异已折叠。
点击以展开。
src/vnode/src/vnodeSync.c
浏览文件 @
7522fb75
此差异已折叠。
点击以展开。
src/wal/test/waltest.c
浏览文件 @
7522fb75
此差异已折叠。
点击以展开。
tests/examples/c/demo.c
浏览文件 @
7522fb75
此差异已折叠。
点击以展开。
tests/examples/c/stream.c
浏览文件 @
7522fb75
此差异已折叠。
点击以展开。
tests/examples/lua/lua51/lua_connector51.c
浏览文件 @
7522fb75
此差异已折叠。
点击以展开。
tests/examples/lua/lua_connector.c
浏览文件 @
7522fb75
此差异已折叠。
点击以展开。
tests/pytest/fulltest.sh
浏览文件 @
7522fb75
此差异已折叠。
点击以展开。
tests/pytest/functions/queryTestCases.py
浏览文件 @
7522fb75
此差异已折叠。
点击以展开。
tests/pytest/query/queryGroupTbname.py
浏览文件 @
7522fb75
此差异已折叠。
点击以展开。
tests/robust/robust.c
浏览文件 @
7522fb75
此差异已折叠。
点击以展开。
tests/script/api/stmt.c
浏览文件 @
7522fb75
此差异已折叠。
点击以展开。
tests/tsim/src/simExe.c
浏览文件 @
7522fb75
此差异已折叠。
点击以展开。
tests/tsim/src/simParse.c
浏览文件 @
7522fb75
此差异已折叠。
点击以展开。
tests/tsim/src/simSystem.c
浏览文件 @
7522fb75
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录