Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
0969e5c5
T
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1192
Star
22018
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
0969e5c5
编写于
12月 07, 2021
作者:
C
Cary Xu
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' into hotfix/TS-784-M
上级
c2375c58
6415fd29
变更
13
隐藏空白更改
内联
并排
Showing
13 changed file
with
71 addition
and
34 deletion
+71
-34
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+2
-1
src/common/inc/tdataformat.h
src/common/inc/tdataformat.h
+3
-2
src/connector/python/taos/cinterface.py
src/connector/python/taos/cinterface.py
+2
-2
src/connector/python/taos/field.py
src/connector/python/taos/field.py
+3
-3
src/connector/python/taos/result.py
src/connector/python/taos/result.py
+7
-1
src/connector/python/tests/test_lines.py
src/connector/python/tests/test_lines.py
+0
-1
src/connector/python/tests/test_stmt.py
src/connector/python/tests/test_stmt.py
+1
-0
src/connector/python/tests/test_stream.py
src/connector/python/tests/test_stream.py
+2
-1
src/tsdb/src/tsdbMemTable.c
src/tsdb/src/tsdbMemTable.c
+1
-1
tests/examples/python/taosdemo/taosdemo.py
tests/examples/python/taosdemo/taosdemo.py
+37
-17
tests/pytest/fulltest.bat
tests/pytest/fulltest.bat
+0
-1
tests/pytest/tools/windows_input.py
tests/pytest/tools/windows_input.py
+8
-1
tests/script/general/parser/nestquery.sim
tests/script/general/parser/nestquery.sim
+5
-3
未找到文件。
src/client/src/tscSQLParser.c
浏览文件 @
0969e5c5
...
...
@@ -8783,7 +8783,8 @@ int32_t validateSqlNode(SSqlObj* pSql, SSqlNode* pSqlNode, SQueryInfo* pQueryInf
SExprInfo
*
pExpr
=
tscExprGet
(
pQueryInfo
,
i
);
int32_t
f
=
pExpr
->
base
.
functionId
;
if
(
f
==
TSDB_FUNC_DERIVATIVE
||
f
==
TSDB_FUNC_TWA
||
f
==
TSDB_FUNC_IRATE
||
f
==
TSDB_FUNC_RATE
||
f
==
TSDB_FUNC_DIFF
)
{
if
(
f
==
TSDB_FUNC_DERIVATIVE
||
f
==
TSDB_FUNC_TWA
||
f
==
TSDB_FUNC_IRATE
||
f
==
TSDB_FUNC_RATE
||
f
==
TSDB_FUNC_DIFF
)
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg7
);
}
}
...
...
src/common/inc/tdataformat.h
浏览文件 @
0969e5c5
...
...
@@ -448,13 +448,14 @@ typedef struct {
#define kvRowSetNCols(r, n) kvRowNCols(r) = (n)
#define kvRowColIdx(r) (SColIdx *)POINTER_SHIFT(r, TD_KV_ROW_HEAD_SIZE)
#define kvRowValues(r) POINTER_SHIFT(r, TD_KV_ROW_HEAD_SIZE + sizeof(SColIdx) * kvRowNCols(r))
#define kvRowKeys(r) POINTER_SHIFT(r, *(uint16_t *)POINTER_SHIFT(r, TD_KV_ROW_HEAD_SIZE + sizeof(int16_t)))
#define kvRowCpy(dst, r) memcpy((dst), (r), kvRowLen(r))
#define kvRowColVal(r, colIdx) POINTER_SHIFT(kvRowValues(r), (colIdx)->offset)
#define kvRowColIdxAt(r, i) (kvRowColIdx(r) + (i))
#define kvRowFree(r) tfree(r)
#define kvRowEnd(r) POINTER_SHIFT(r, kvRowLen(r))
#define kvRowValLen(r) (kvRowLen(r) - TD_KV_ROW_HEAD_SIZE - sizeof(SColIdx) * kvRowNCols(r))
#define kvRowTKey(r) (*(TKEY *)(kvRow
Value
s(r)))
#define kvRowTKey(r) (*(TKEY *)(kvRow
Key
s(r)))
#define kvRowKey(r) tdGetKey(kvRowTKey(r))
#define kvRowDeleted(r) TKEY_IS_DELETED(kvRowTKey(r))
...
...
@@ -652,7 +653,7 @@ static FORCE_INLINE char *memRowEnd(SMemRow row) {
#define memRowKvVersion(r) (*(int16_t *)POINTER_SHIFT(r, TD_MEM_ROW_TYPE_SIZE))
#define memRowVersion(r) (isDataRow(r) ? memRowDataVersion(r) : memRowKvVersion(r)) // schema version
#define memRowSetKvVersion(r, v) (memRowKvVersion(r) = (v))
#define memRow
Tuple(r) (isDataRow(r) ? dataRowTuple(memRowDataBody(r)) : kvRowValue
s(memRowKvBody(r)))
#define memRow
Keys(r) (isDataRow(r) ? dataRowTuple(memRowDataBody(r)) : kvRowKey
s(memRowKvBody(r)))
#define memRowTKey(r) (isDataRow(r) ? dataRowTKey(memRowDataBody(r)) : kvRowTKey(memRowKvBody(r)))
#define memRowKey(r) (isDataRow(r) ? dataRowKey(memRowDataBody(r)) : kvRowKey(memRowKvBody(r)))
...
...
src/connector/python/taos/cinterface.py
浏览文件 @
0969e5c5
...
...
@@ -103,7 +103,7 @@ _libtaos.taos_get_client_info.restype = c_char_p
def
taos_get_client_info
():
# type: () -> str
"""Get client version info."""
return
_libtaos
.
taos_get_client_info
().
decode
()
return
_libtaos
.
taos_get_client_info
().
decode
(
"utf-8"
)
_libtaos
.
taos_get_server_info
.
restype
=
c_char_p
...
...
@@ -113,7 +113,7 @@ _libtaos.taos_get_server_info.argtypes = (c_void_p,)
def
taos_get_server_info
(
connection
):
# type: (c_void_p) -> str
"""Get server version as string."""
return
_libtaos
.
taos_get_server_info
(
connection
).
decode
()
return
_libtaos
.
taos_get_server_info
(
connection
).
decode
(
"utf-8"
)
_libtaos
.
taos_close
.
restype
=
None
...
...
src/connector/python/taos/field.py
浏览文件 @
0969e5c5
...
...
@@ -144,7 +144,7 @@ def _crow_nchar_to_python(data, num_of_rows, nbytes=None, precision=FieldType.C_
try
:
if
num_of_rows
>=
0
:
tmpstr
=
ctypes
.
c_char_p
(
data
)
res
.
append
(
tmpstr
.
value
.
decode
())
res
.
append
(
tmpstr
.
value
.
decode
(
"utf-8"
))
else
:
res
.
append
(
(
...
...
@@ -172,7 +172,7 @@ def _crow_binary_to_python_block(data, num_of_rows, nbytes=None, precision=Field
if
rbyte
==
1
and
buffer
[
0
]
==
b
'
\xff
'
:
res
.
append
(
None
)
else
:
res
.
append
(
cast
(
buffer
,
c_char_p
).
value
.
decode
())
res
.
append
(
cast
(
buffer
,
c_char_p
).
value
.
decode
(
"utf-8"
))
return
res
...
...
@@ -188,7 +188,7 @@ def _crow_nchar_to_python_block(data, num_of_rows, nbytes=None, precision=FieldT
if
rbyte
==
4
and
buffer
[:
4
]
==
b
'
\xff
'
*
4
:
res
.
append
(
None
)
else
:
res
.
append
(
cast
(
buffer
,
c_char_p
).
value
.
decode
())
res
.
append
(
cast
(
buffer
,
c_char_p
).
value
.
decode
(
"utf-8"
))
return
res
...
...
src/connector/python/taos/result.py
浏览文件 @
0969e5c5
...
...
@@ -3,6 +3,8 @@ from .cinterface import *
# from .connection import TaosConnection
from
.error
import
*
from
ctypes
import
c_void_p
class
TaosResult
(
object
):
"""TDengine result interface"""
...
...
@@ -12,7 +14,11 @@ class TaosResult(object):
# to make the __del__ order right
self
.
_conn
=
conn
self
.
_close_after
=
close_after
self
.
_result
=
result
if
isinstance
(
result
,
c_void_p
):
self
.
_result
=
result
else
:
self
.
_result
=
c_void_p
(
result
)
self
.
_fields
=
None
self
.
_field_count
=
None
self
.
_precision
=
None
...
...
src/connector/python/tests/test_lines.py
浏览文件 @
0969e5c5
...
...
@@ -36,7 +36,6 @@ def test_insert_lines(conn):
conn
.
insert_lines
(
lines
)
print
(
"inserted"
)
result
=
conn
.
query
(
"select * from st"
)
print
(
*
result
.
fields
)
all
=
result
.
rows_iter
()
for
row
in
all
:
print
(
row
)
...
...
src/connector/python/tests/test_stmt.py
浏览文件 @
0969e5c5
# encoding:UTF-8
from
taos
import
*
from
ctypes
import
*
...
...
src/connector/python/tests/test_stream.py
浏览文件 @
0969e5c5
...
...
@@ -20,7 +20,8 @@ def stream_callback(p_param, p_result, p_row):
result
=
TaosResult
(
p_result
)
row
=
TaosRow
(
result
,
p_row
)
try
:
ts
,
count
=
row
()
ts
,
count
=
row
.
as_tuple
()
print
(
ts
,
count
)
p
=
cast
(
p_param
,
POINTER
(
Counter
))
p
.
contents
.
count
+=
count
print
(
"[%s] inserted %d in 5s, total count: %d"
%
(
ts
.
strftime
(
"%Y-%m-%d %H:%M:%S"
),
count
,
p
.
contents
.
count
))
...
...
src/tsdb/src/tsdbMemTable.c
浏览文件 @
0969e5c5
...
...
@@ -560,7 +560,7 @@ static void tsdbFreeTableData(STableData *pTableData) {
}
}
static
char
*
tsdbGetTsTupleKey
(
const
void
*
data
)
{
return
memRow
Tuple
((
SMemRow
)
data
);
}
static
char
*
tsdbGetTsTupleKey
(
const
void
*
data
)
{
return
memRow
Keys
((
SMemRow
)
data
);
}
static
int
tsdbAdjustMemMaxTables
(
SMemTable
*
pMemTable
,
int
maxTables
)
{
ASSERT
(
pMemTable
->
maxTables
<
maxTables
);
...
...
tests/examples/python/taosdemo/taosdemo.py
浏览文件 @
0969e5c5
...
...
@@ -21,78 +21,91 @@ import json
import
random
import
time
import
datetime
import
multiprocessing
from
multiprocessing
import
Manager
,
Pool
,
Lock
from
multipledispatch
import
dispatch
from
concurrent.futures
import
ThreadPoolExecutor
,
wait
,
ALL_COMPLETED
@
dispatch
(
str
,
str
)
def
v_print
(
msg
:
str
,
arg
:
str
):
def
v_print
(
msg
,
arg
):
# type: (str, str) -> None
if
verbose
:
print
(
msg
%
arg
)
@
dispatch
(
str
,
str
,
str
)
def
v_print
(
msg
:
str
,
arg1
:
str
,
arg2
:
str
):
def
v_print
(
msg
,
arg1
,
arg2
):
# type: (str, str, str) -> None
if
verbose
:
print
(
msg
%
(
arg1
,
arg2
))
@
dispatch
(
str
,
str
,
str
,
str
)
def
v_print
(
msg
:
str
,
arg1
:
str
,
arg2
:
str
,
arg3
:
str
):
def
v_print
(
msg
,
arg1
,
arg2
,
arg3
):
# type: (str, str, str, str) -> None
if
verbose
:
print
(
msg
%
(
arg1
,
arg2
,
arg3
))
@
dispatch
(
str
,
str
,
str
,
str
,
str
)
def
v_print
(
msg
:
str
,
arg1
:
str
,
arg2
:
str
,
arg3
:
str
,
arg4
:
str
):
def
v_print
(
msg
,
arg1
,
arg2
,
arg3
,
arg4
):
# type: (str, str, str, str, str) -> None
if
verbose
:
print
(
msg
%
(
arg1
,
arg2
,
arg3
,
arg4
))
@
dispatch
(
str
,
int
)
def
v_print
(
msg
:
str
,
arg
:
int
):
def
v_print
(
msg
,
arg
):
# type: (str, int) -> None
if
verbose
:
print
(
msg
%
int
(
arg
))
@
dispatch
(
str
,
int
,
str
)
def
v_print
(
msg
:
str
,
arg1
:
int
,
arg2
:
str
):
def
v_print
(
msg
,
arg1
,
arg2
):
# type: (str, int, str) -> None
if
verbose
:
print
(
msg
%
(
int
(
arg1
),
str
(
arg2
)))
@
dispatch
(
str
,
str
,
int
)
def
v_print
(
msg
:
str
,
arg1
:
str
,
arg2
:
int
):
def
v_print
(
msg
,
arg1
,
arg2
):
# type: (str, str, int) -> None
if
verbose
:
print
(
msg
%
(
arg1
,
int
(
arg2
)))
@
dispatch
(
str
,
int
,
int
)
def
v_print
(
msg
:
str
,
arg1
:
int
,
arg2
:
int
):
def
v_print
(
msg
,
arg1
,
arg2
):
# type: (str, int, int) -> None
if
verbose
:
print
(
msg
%
(
int
(
arg1
),
int
(
arg2
)))
@
dispatch
(
str
,
int
,
int
,
str
)
def
v_print
(
msg
:
str
,
arg1
:
int
,
arg2
:
int
,
arg3
:
str
):
def
v_print
(
msg
,
arg1
,
arg2
,
arg3
):
# type: (str, int, int, str) -> None
if
verbose
:
print
(
msg
%
(
int
(
arg1
),
int
(
arg2
),
str
(
arg3
)))
@
dispatch
(
str
,
int
,
int
,
int
)
def
v_print
(
msg
:
str
,
arg1
:
int
,
arg2
:
int
,
arg3
:
int
):
def
v_print
(
msg
,
arg1
,
arg2
,
arg3
):
# type: (str, int, int, int) -> None
if
verbose
:
print
(
msg
%
(
int
(
arg1
),
int
(
arg2
),
int
(
arg3
)))
@
dispatch
(
str
,
int
,
int
,
int
,
int
)
def
v_print
(
msg
:
str
,
arg1
:
int
,
arg2
:
int
,
arg3
:
int
,
arg4
:
int
):
def
v_print
(
msg
,
arg1
,
arg2
,
arg3
,
arg4
):
# type: (str, int, int, int, int) -> None
if
verbose
:
print
(
msg
%
(
int
(
arg1
),
int
(
arg2
),
int
(
arg3
),
int
(
arg4
)))
def
restful_execute
(
host
:
str
,
port
:
int
,
user
:
str
,
password
:
str
,
cmd
:
str
):
def
restful_execute
(
host
,
port
,
user
,
password
,
cmd
):
# type: (str, int, str, str, str) -> None
url
=
"http://%s:%d/rest/sql"
%
(
host
,
restPort
)
v_print
(
"restful_execute - cmd: %s"
,
cmd
)
...
...
@@ -112,7 +125,8 @@ def restful_execute(host: str, port: int, user: str, password: str, cmd: str):
print
(
"resp: %s"
%
json
.
dumps
(
resp
.
json
()))
def
query_func
(
process
:
int
,
thread
:
int
,
cmd
:
str
):
def
query_func
(
process
,
thread
,
cmd
):
# type: (int, int, str) -> None
v_print
(
"%d process %d thread cmd: %s"
,
process
,
thread
,
cmd
)
if
oneMoreHost
!=
"NotSupported"
and
random
.
randint
(
...
...
@@ -133,7 +147,8 @@ def query_func(process: int, thread: int, cmd: str):
host
,
port
,
user
,
password
,
cmd
)
def
query_data_process
(
cmd
:
str
):
def
query_data_process
(
cmd
):
# type: (str) -> None
# establish connection if native
if
native
:
v_print
(
"host:%s, user:%s passwd:%s configDir:%s "
,
host
,
user
,
password
,
configDir
)
...
...
@@ -256,7 +271,8 @@ def drop_databases():
(
dbName
,
i
))
def
insert_func
(
process
:
int
,
thread
:
int
):
def
insert_func
(
process
,
thread
):
# type: (int, int) -> None
v_print
(
"%d process %d thread, insert_func "
,
process
,
thread
)
# generate uuid
...
...
@@ -374,7 +390,8 @@ def create_tb():
(
tbName
,
j
))
def
insert_data_process
(
lock
,
i
:
int
,
begin
:
int
,
end
:
int
):
def
insert_data_process
(
lock
,
i
,
begin
,
end
):
# type: (multiprocessing._LockType, int, int, int) -> None
lock
.
acquire
()
tasks
=
end
-
begin
v_print
(
"insert_data_process:%d table from %d to %d, tasks %d"
,
i
,
begin
,
end
,
tasks
)
...
...
@@ -675,7 +692,10 @@ if __name__ == "__main__":
printConfig
()
if
not
skipPrompt
:
input
(
"Press any key to continue.."
)
try
:
input
(
"Press any key to continue.."
)
except
SyntaxError
:
pass
# establish connection first if native
if
native
:
...
...
tests/pytest/fulltest.bat
浏览文件 @
0969e5c5
...
...
@@ -19,4 +19,3 @@ python .\test.py -f query\filterFloatAndDouble.py
python
.\test.py
-f
query
\filterOtherTypes.py
python
.\test.py
-f
query
\querySort.py
python
.\test.py
-f
query
\queryJoin.py
python
.\test.py
-f
tools
\windows_input.py
\ No newline at end of file
tests/pytest/tools/windows_input.py
浏览文件 @
0969e5c5
...
...
@@ -15,6 +15,7 @@ import os
from
uiautomation
import
WindowControl
from
util.cases
import
*
from
util.sql
import
*
import
clipboard
class
TDTestCase
:
...
...
@@ -55,16 +56,22 @@ class TDTestCase:
sql
=
"insert into db.tb values(now,'%s');"
%
temp
window
.
SendKeys
(
sql
)
window
.
SendKeys
(
'{Enter}'
)
window
.
SendKeys
(
'{Ctrl}A'
)
window
.
SendKeys
(
'{Ctrl}C'
)
# 获取剪切板里面的复制内容
result
=
clipboard
.
paste
()
window
.
SendKeys
(
'{Ctrl}C'
)
window
.
SendKeys
(
'exit'
)
window
.
SendKeys
(
'{Enter}'
)
return
result
def
run
(
self
):
tdSql
.
prepare
()
ret
=
tdSql
.
execute
(
'create table tb (ts timestamp, i binary(300))'
)
self
.
win_input_test
()
result
=
self
.
win_input_test
()
tdLog
.
info
(
result
)
tdSql
.
query
(
"select * from tb"
)
tdSql
.
checkRows
(
1
)
...
...
tests/script/general/parser/nestquery.sim
浏览文件 @
0969e5c5
...
...
@@ -330,9 +330,9 @@ if $data12 != 71680.000000000 then
return -1
endi
sql select top(x, 20) from (select c1 x from nest_tb0);
sql select top(x, 20) from (select
ts,
c1 x from nest_tb0);
sql select bottom(x, 20) from (select c1 x from nest_tb0)
sql select bottom(x, 20) from (select
ts,
c1 x from nest_tb0)
print ===================> group by + having
...
...
@@ -407,12 +407,14 @@ if $data03 != @20-09-15 00:00:00.000@ then
return -1
endi
sql_error select diff(val) from (select c1 val from nest_tb0);
sql select diff(val) from (select ts,c1 val from nest_tb0);
if $rows != 9999 then
return -1
endi
if $data00 != @
70-01-01 08:00
:00.000@ then
if $data00 != @
20-09-15 00:01
:00.000@ then
return -1
endi
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录