Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
d6fd9e58
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
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看板
提交
d6fd9e58
编写于
3月 13, 2021
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
差异文件
[td-225] merge develop.
上级
a717a5e6
3b2827d8
变更
30
展开全部
隐藏空白更改
内联
并排
Showing
30 changed file
with
1281 addition
and
817 deletion
+1281
-817
Jenkinsfile
Jenkinsfile
+1
-2
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+20
-3
src/client/src/tscSubquery.c
src/client/src/tscSubquery.c
+7
-0
src/connector/python/linux/python2/setup.py
src/connector/python/linux/python2/setup.py
+1
-1
src/connector/python/linux/python2/taos/cinterface.py
src/connector/python/linux/python2/taos/cinterface.py
+8
-8
src/connector/python/linux/python3/setup.py
src/connector/python/linux/python3/setup.py
+1
-1
src/connector/python/linux/python3/taos/cinterface.py
src/connector/python/linux/python3/taos/cinterface.py
+8
-8
src/connector/python/linux/python3/taos/cursor.py
src/connector/python/linux/python3/taos/cursor.py
+0
-14
src/connector/python/osx/python3/setup.py
src/connector/python/osx/python3/setup.py
+1
-1
src/connector/python/osx/python3/taos/cinterface.py
src/connector/python/osx/python3/taos/cinterface.py
+8
-8
src/connector/python/osx/python3/taos/cursor.py
src/connector/python/osx/python3/taos/cursor.py
+0
-14
src/connector/python/windows/python2/setup.py
src/connector/python/windows/python2/setup.py
+1
-1
src/connector/python/windows/python2/taos/cinterface.py
src/connector/python/windows/python2/taos/cinterface.py
+8
-8
src/connector/python/windows/python2/taos/cursor.py
src/connector/python/windows/python2/taos/cursor.py
+0
-2
src/connector/python/windows/python3/setup.py
src/connector/python/windows/python3/setup.py
+1
-1
src/connector/python/windows/python3/taos/cinterface.py
src/connector/python/windows/python3/taos/cinterface.py
+8
-8
src/connector/python/windows/python3/taos/cursor.py
src/connector/python/windows/python3/taos/cursor.py
+0
-2
src/kit/taosdemo/insert.json
src/kit/taosdemo/insert.json
+4
-1
src/kit/taosdemo/taosdemo.c
src/kit/taosdemo/taosdemo.c
+856
-717
src/plugins/http/inc/httpJson.h
src/plugins/http/inc/httpJson.h
+2
-0
src/plugins/http/src/httpJson.c
src/plugins/http/src/httpJson.c
+12
-0
src/plugins/http/src/httpRestJson.c
src/plugins/http/src/httpRestJson.c
+12
-0
tests/pytest/crash_gen/crash_gen_main.py
tests/pytest/crash_gen/crash_gen_main.py
+1
-1
tests/pytest/fulltest.sh
tests/pytest/fulltest.sh
+1
-0
tests/pytest/functions/function_stddev.py
tests/pytest/functions/function_stddev.py
+29
-0
tests/pytest/query/queryBetweenAnd.py
tests/pytest/query/queryBetweenAnd.py
+206
-0
tests/pytest/tools/taosdemoTestWithoutMetric.py
tests/pytest/tools/taosdemoTestWithoutMetric.py
+72
-0
tests/script/general/db/topic1.sim
tests/script/general/db/topic1.sim
+4
-15
tests/script/general/parser/groupby.sim
tests/script/general/parser/groupby.sim
+5
-0
tests/script/general/parser/lastrow_query.sim
tests/script/general/parser/lastrow_query.sim
+4
-1
未找到文件。
Jenkinsfile
浏览文件 @
d6fd9e58
...
...
@@ -46,6 +46,7 @@ def pre_test(){
git fetch origin +refs/pull/${CHANGE_ID}/merge
git checkout -qf FETCH_HEAD
git --no-pager diff --name-only FETCH_HEAD $(git merge-base FETCH_HEAD develop)|grep -v -E '.*md|//src//connector|Jenkinsfile' || exit 0
find ${WKC}/tests/pytest -name \'*\'.sql -exec rm -rf {} \\;
cd ${WK}
git reset --hard HEAD~10
git checkout develop
...
...
@@ -115,7 +116,6 @@ pipeline {
sh
'''
date
cd ${WKC}/tests
find pytest -name '*'sql|xargs rm -rf
./test-all.sh p1
date'''
}
...
...
@@ -131,7 +131,6 @@ pipeline {
sh
'''
date
cd ${WKC}/tests
find pytest -name '*'sql|xargs rm -rf
./test-all.sh p2
date'''
}
...
...
src/client/src/tscSQLParser.c
浏览文件 @
d6fd9e58
...
...
@@ -1592,7 +1592,7 @@ bool isValidDistinctSql(SQueryInfo* pQueryInfo) {
int32_t
parseSelectClause
(
SSqlCmd
*
pCmd
,
int32_t
clauseIndex
,
tSQLExprList
*
pSelection
,
bool
isSTable
,
bool
joinQuery
,
bool
timeWindowQuery
)
{
assert
(
pSelection
!=
NULL
&&
pCmd
!=
NULL
);
const
char
*
msg2
=
"functions can not be mixed up"
;
const
char
*
msg2
=
"functions
or others
can not be mixed up"
;
const
char
*
msg3
=
"not support query expression"
;
const
char
*
msg5
=
"invalid function name"
;
const
char
*
msg6
=
"only support distinct one tag"
;
...
...
@@ -2870,6 +2870,23 @@ bool hasUnsupportFunctionsForSTableQuery(SSqlCmd* pCmd, SQueryInfo* pQueryInfo)
return
false
;
}
static
bool
groupbyTagsOrNull
(
SQueryInfo
*
pQueryInfo
)
{
if
(
pQueryInfo
->
groupbyExpr
.
columnInfo
==
NULL
||
taosArrayGetSize
(
pQueryInfo
->
groupbyExpr
.
columnInfo
)
==
0
)
{
return
true
;
}
size_t
s
=
taosArrayGetSize
(
pQueryInfo
->
groupbyExpr
.
columnInfo
);
for
(
int32_t
i
=
0
;
i
<
s
;
i
++
)
{
SColIndex
*
colIndex
=
taosArrayGet
(
pQueryInfo
->
groupbyExpr
.
columnInfo
,
i
);
if
(
colIndex
->
flag
!=
TSDB_COL_TAG
)
{
return
false
;
}
}
return
true
;
}
static
bool
functionCompatibleCheck
(
SQueryInfo
*
pQueryInfo
,
bool
joinQuery
,
bool
twQuery
)
{
int32_t
startIdx
=
0
;
...
...
@@ -2886,7 +2903,7 @@ static bool functionCompatibleCheck(SQueryInfo* pQueryInfo, bool joinQuery, bool
int32_t
factor
=
functionCompatList
[
tscSqlExprGet
(
pQueryInfo
,
startIdx
)
->
functionId
];
if
(
tscSqlExprGet
(
pQueryInfo
,
0
)
->
functionId
==
TSDB_FUNC_LAST_ROW
&&
(
joinQuery
||
twQuery
))
{
if
(
tscSqlExprGet
(
pQueryInfo
,
0
)
->
functionId
==
TSDB_FUNC_LAST_ROW
&&
(
joinQuery
||
intervalQuery
||
!
groupbyTagsOrNull
(
pQueryInfo
)
))
{
return
false
;
}
...
...
@@ -2914,7 +2931,7 @@ static bool functionCompatibleCheck(SQueryInfo* pQueryInfo, bool joinQuery, bool
}
}
if
(
functionId
==
TSDB_FUNC_LAST_ROW
&&
(
joinQuery
||
twQuery
))
{
if
(
functionId
==
TSDB_FUNC_LAST_ROW
&&
(
joinQuery
||
intervalQuery
||
!
groupbyTagsOrNull
(
pQueryInfo
)
))
{
return
false
;
}
}
...
...
src/client/src/tscSubquery.c
浏览文件 @
d6fd9e58
...
...
@@ -1882,6 +1882,13 @@ void doAppendData(SInterResult* pInterResult, TAOS_ROW row, int32_t numOfCols, S
}
}
if
(
p
&&
taosArrayGetSize
(
p
)
>
0
)
{
SResPair
*
l
=
taosArrayGetLast
(
p
);
if
(
l
->
key
==
key
&&
key
==
INT64_MIN
)
{
continue
;
}
}
//append a new column
if
(
p
==
NULL
)
{
SStddevInterResult
t
=
{.
colId
=
id
,
.
pResult
=
taosArrayInit
(
10
,
sizeof
(
SResPair
)),};
...
...
src/connector/python/linux/python2/setup.py
浏览文件 @
d6fd9e58
...
...
@@ -5,7 +5,7 @@ with open("README.md", "r") as fh:
setuptools
.
setup
(
name
=
"taos"
,
version
=
"2.0.
6
"
,
version
=
"2.0.
7
"
,
author
=
"Taosdata Inc."
,
author_email
=
"support@taosdata.com"
,
description
=
"TDengine python client package"
,
...
...
src/connector/python/linux/python2/taos/cinterface.py
浏览文件 @
d6fd9e58
...
...
@@ -22,10 +22,10 @@ def _crow_timestamp_to_python(data, num_of_rows, nbytes=None, micro=False):
if
num_of_rows
>
0
:
return
list
(
map
(
_timestamp_converter
,
ctypes
.
cast
(
data
,
ctypes
.
POINTER
(
ctypes
.
c_
long
))[:
abs
(
num_of_rows
)]))
data
,
ctypes
.
POINTER
(
ctypes
.
c_
int64
))[:
abs
(
num_of_rows
)]))
else
:
return
list
(
map
(
_timestamp_converter
,
ctypes
.
cast
(
data
,
ctypes
.
POINTER
(
ctypes
.
c_
long
))[:
abs
(
num_of_rows
)]))
data
,
ctypes
.
POINTER
(
ctypes
.
c_
int64
))[:
abs
(
num_of_rows
)]))
def
_crow_bool_to_python
(
data
,
num_of_rows
,
nbytes
=
None
,
micro
=
False
):
...
...
@@ -145,10 +145,10 @@ def _crow_bigint_to_python(data, num_of_rows, nbytes=None, micro=False):
"""
if
num_of_rows
>
0
:
return
[
None
if
ele
==
FieldType
.
C_BIGINT_NULL
else
ele
for
ele
in
ctypes
.
cast
(
data
,
ctypes
.
POINTER
(
ctypes
.
c_
long
))[:
abs
(
num_of_rows
)]]
data
,
ctypes
.
POINTER
(
ctypes
.
c_
int64
))[:
abs
(
num_of_rows
)]]
else
:
return
[
None
if
ele
==
FieldType
.
C_BIGINT_NULL
else
ele
for
ele
in
ctypes
.
cast
(
data
,
ctypes
.
POINTER
(
ctypes
.
c_
long
))[:
abs
(
num_of_rows
)]]
data
,
ctypes
.
POINTER
(
ctypes
.
c_
int64
))[:
abs
(
num_of_rows
)]]
def
_crow_bigint_unsigned_to_python
(
...
...
@@ -162,13 +162,13 @@ def _crow_bigint_unsigned_to_python(
return
[
None
if
ele
==
FieldType
.
C_BIGINT_UNSIGNED_NULL
else
ele
for
ele
in
ctypes
.
cast
(
data
,
ctypes
.
POINTER
(
ctypes
.
c_u
long
))[
ctypes
.
c_u
int64
))[
:
abs
(
num_of_rows
)]]
else
:
return
[
None
if
ele
==
FieldType
.
C_BIGINT_UNSIGNED_NULL
else
ele
for
ele
in
ctypes
.
cast
(
data
,
ctypes
.
POINTER
(
ctypes
.
c_u
long
))[
ctypes
.
c_u
int64
))[
:
abs
(
num_of_rows
)]]
...
...
@@ -600,7 +600,7 @@ class CTaosInterface(object):
# elif (dtype == CTaosInterface.TSDB_DATA_TYPE_INT):
# return ctypes.cast(data, ctypes.POINTER(ctypes.c_int))[0]
# elif (dtype == CTaosInterface.TSDB_DATA_TYPE_BIGINT):
# return ctypes.cast(data, ctypes.POINTER(ctypes.c_
long
))[0]
# return ctypes.cast(data, ctypes.POINTER(ctypes.c_
int64
))[0]
# elif (dtype == CTaosInterface.TSDB_DATA_TYPE_FLOAT):
# return ctypes.cast(data, ctypes.POINTER(ctypes.c_float))[0]
# elif (dtype == CTaosInterface.TSDB_DATA_TYPE_DOUBLE):
...
...
@@ -608,7 +608,7 @@ class CTaosInterface(object):
# elif (dtype == CTaosInterface.TSDB_DATA_TYPE_BINARY):
# return (ctypes.cast(data, ctypes.POINTER(ctypes.c_char))[0:byte]).rstrip('\x00')
# elif (dtype == CTaosInterface.TSDB_DATA_TYPE_TIMESTAMP):
# return ctypes.cast(data, ctypes.POINTER(ctypes.c_
long
))[0]
# return ctypes.cast(data, ctypes.POINTER(ctypes.c_
int64
))[0]
# elif (dtype == CTaosInterface.TSDB_DATA_TYPE_NCHAR):
# return (ctypes.cast(data, ctypes.c_char_p).value).rstrip('\x00')
...
...
src/connector/python/linux/python3/setup.py
浏览文件 @
d6fd9e58
...
...
@@ -5,7 +5,7 @@ with open("README.md", "r") as fh:
setuptools
.
setup
(
name
=
"taos"
,
version
=
"2.0.
5
"
,
version
=
"2.0.
7
"
,
author
=
"Taosdata Inc."
,
author_email
=
"support@taosdata.com"
,
description
=
"TDengine python client package"
,
...
...
src/connector/python/linux/python3/taos/cinterface.py
浏览文件 @
d6fd9e58
...
...
@@ -22,10 +22,10 @@ def _crow_timestamp_to_python(data, num_of_rows, nbytes=None, micro=False):
if
num_of_rows
>
0
:
return
list
(
map
(
_timestamp_converter
,
ctypes
.
cast
(
data
,
ctypes
.
POINTER
(
ctypes
.
c_
long
))[:
abs
(
num_of_rows
)]))
data
,
ctypes
.
POINTER
(
ctypes
.
c_
int64
))[:
abs
(
num_of_rows
)]))
else
:
return
list
(
map
(
_timestamp_converter
,
ctypes
.
cast
(
data
,
ctypes
.
POINTER
(
ctypes
.
c_
long
))[:
abs
(
num_of_rows
)]))
data
,
ctypes
.
POINTER
(
ctypes
.
c_
int64
))[:
abs
(
num_of_rows
)]))
def
_crow_bool_to_python
(
data
,
num_of_rows
,
nbytes
=
None
,
micro
=
False
):
...
...
@@ -145,10 +145,10 @@ def _crow_bigint_to_python(data, num_of_rows, nbytes=None, micro=False):
"""
if
num_of_rows
>
0
:
return
[
None
if
ele
==
FieldType
.
C_BIGINT_NULL
else
ele
for
ele
in
ctypes
.
cast
(
data
,
ctypes
.
POINTER
(
ctypes
.
c_
long
))[:
abs
(
num_of_rows
)]]
data
,
ctypes
.
POINTER
(
ctypes
.
c_
int64
))[:
abs
(
num_of_rows
)]]
else
:
return
[
None
if
ele
==
FieldType
.
C_BIGINT_NULL
else
ele
for
ele
in
ctypes
.
cast
(
data
,
ctypes
.
POINTER
(
ctypes
.
c_
long
))[:
abs
(
num_of_rows
)]]
data
,
ctypes
.
POINTER
(
ctypes
.
c_
int64
))[:
abs
(
num_of_rows
)]]
def
_crow_bigint_unsigned_to_python
(
...
...
@@ -162,13 +162,13 @@ def _crow_bigint_unsigned_to_python(
return
[
None
if
ele
==
FieldType
.
C_BIGINT_UNSIGNED_NULL
else
ele
for
ele
in
ctypes
.
cast
(
data
,
ctypes
.
POINTER
(
ctypes
.
c_u
long
))[
ctypes
.
c_u
int64
))[
:
abs
(
num_of_rows
)]]
else
:
return
[
None
if
ele
==
FieldType
.
C_BIGINT_UNSIGNED_NULL
else
ele
for
ele
in
ctypes
.
cast
(
data
,
ctypes
.
POINTER
(
ctypes
.
c_u
long
))[
ctypes
.
c_u
int64
))[
:
abs
(
num_of_rows
)]]
...
...
@@ -600,7 +600,7 @@ class CTaosInterface(object):
# elif (dtype == CTaosInterface.TSDB_DATA_TYPE_INT):
# return ctypes.cast(data, ctypes.POINTER(ctypes.c_int))[0]
# elif (dtype == CTaosInterface.TSDB_DATA_TYPE_BIGINT):
# return ctypes.cast(data, ctypes.POINTER(ctypes.c_
long
))[0]
# return ctypes.cast(data, ctypes.POINTER(ctypes.c_
int64
))[0]
# elif (dtype == CTaosInterface.TSDB_DATA_TYPE_FLOAT):
# return ctypes.cast(data, ctypes.POINTER(ctypes.c_float))[0]
# elif (dtype == CTaosInterface.TSDB_DATA_TYPE_DOUBLE):
...
...
@@ -608,7 +608,7 @@ class CTaosInterface(object):
# elif (dtype == CTaosInterface.TSDB_DATA_TYPE_BINARY):
# return (ctypes.cast(data, ctypes.POINTER(ctypes.c_char))[0:byte]).rstrip('\x00')
# elif (dtype == CTaosInterface.TSDB_DATA_TYPE_TIMESTAMP):
# return ctypes.cast(data, ctypes.POINTER(ctypes.c_
long
))[0]
# return ctypes.cast(data, ctypes.POINTER(ctypes.c_
int64
))[0]
# elif (dtype == CTaosInterface.TSDB_DATA_TYPE_NCHAR):
# return (ctypes.cast(data, ctypes.c_char_p).value).rstrip('\x00')
...
...
src/connector/python/linux/python3/taos/cursor.py
浏览文件 @
d6fd9e58
from
.cinterface
import
CTaosInterface
from
.error
import
*
from
.constants
import
FieldType
import
threading
# querySeqNum = 0
...
...
@@ -38,7 +37,6 @@ class TDengineCursor(object):
self
.
_block_iter
=
0
self
.
_affected_rows
=
0
self
.
_logfile
=
""
self
.
_threadId
=
threading
.
get_ident
()
if
connection
is
not
None
:
self
.
_connection
=
connection
...
...
@@ -105,12 +103,6 @@ class TDengineCursor(object):
def
execute
(
self
,
operation
,
params
=
None
):
"""Prepare and execute a database operation (query or command).
"""
# if threading.get_ident() != self._threadId:
# info ="Cursor execute:Thread ID not match,creater:"+str(self._threadId)+" caller:"+str(threading.get_ident())
# raise OperationalError(info)
# print(info)
# return None
if
not
operation
:
return
None
...
...
@@ -280,12 +272,6 @@ class TDengineCursor(object):
def
_handle_result
(
self
):
"""Handle the return result from query.
"""
# if threading.get_ident() != self._threadId:
# info = "Cursor handleresult:Thread ID not match,creater:"+str(self._threadId)+" caller:"+str(threading.get_ident())
# raise OperationalError(info)
# print(info)
# return None
self
.
_description
=
[]
for
ele
in
self
.
_fields
:
self
.
_description
.
append
(
...
...
src/connector/python/osx/python3/setup.py
浏览文件 @
d6fd9e58
...
...
@@ -5,7 +5,7 @@ with open("README.md", "r") as fh:
setuptools
.
setup
(
name
=
"taos"
,
version
=
"2.0.
5
"
,
version
=
"2.0.
7
"
,
author
=
"Taosdata Inc."
,
author_email
=
"support@taosdata.com"
,
description
=
"TDengine python client package"
,
...
...
src/connector/python/osx/python3/taos/cinterface.py
浏览文件 @
d6fd9e58
...
...
@@ -22,10 +22,10 @@ def _crow_timestamp_to_python(data, num_of_rows, nbytes=None, micro=False):
if
num_of_rows
>
0
:
return
list
(
map
(
_timestamp_converter
,
ctypes
.
cast
(
data
,
ctypes
.
POINTER
(
ctypes
.
c_
long
))[:
abs
(
num_of_rows
)]))
data
,
ctypes
.
POINTER
(
ctypes
.
c_
int64
))[:
abs
(
num_of_rows
)]))
else
:
return
list
(
map
(
_timestamp_converter
,
ctypes
.
cast
(
data
,
ctypes
.
POINTER
(
ctypes
.
c_
long
))[:
abs
(
num_of_rows
)]))
data
,
ctypes
.
POINTER
(
ctypes
.
c_
int64
))[:
abs
(
num_of_rows
)]))
def
_crow_bool_to_python
(
data
,
num_of_rows
,
nbytes
=
None
,
micro
=
False
):
...
...
@@ -145,10 +145,10 @@ def _crow_bigint_to_python(data, num_of_rows, nbytes=None, micro=False):
"""
if
num_of_rows
>
0
:
return
[
None
if
ele
==
FieldType
.
C_BIGINT_NULL
else
ele
for
ele
in
ctypes
.
cast
(
data
,
ctypes
.
POINTER
(
ctypes
.
c_
long
))[:
abs
(
num_of_rows
)]]
data
,
ctypes
.
POINTER
(
ctypes
.
c_
int64
))[:
abs
(
num_of_rows
)]]
else
:
return
[
None
if
ele
==
FieldType
.
C_BIGINT_NULL
else
ele
for
ele
in
ctypes
.
cast
(
data
,
ctypes
.
POINTER
(
ctypes
.
c_
long
))[:
abs
(
num_of_rows
)]]
data
,
ctypes
.
POINTER
(
ctypes
.
c_
int64
))[:
abs
(
num_of_rows
)]]
def
_crow_bigint_unsigned_to_python
(
...
...
@@ -162,13 +162,13 @@ def _crow_bigint_unsigned_to_python(
return
[
None
if
ele
==
FieldType
.
C_BIGINT_UNSIGNED_NULL
else
ele
for
ele
in
ctypes
.
cast
(
data
,
ctypes
.
POINTER
(
ctypes
.
c_u
long
))[
ctypes
.
c_u
int64
))[
:
abs
(
num_of_rows
)]]
else
:
return
[
None
if
ele
==
FieldType
.
C_BIGINT_UNSIGNED_NULL
else
ele
for
ele
in
ctypes
.
cast
(
data
,
ctypes
.
POINTER
(
ctypes
.
c_u
long
))[
ctypes
.
c_u
int64
))[
:
abs
(
num_of_rows
)]]
...
...
@@ -600,7 +600,7 @@ class CTaosInterface(object):
# elif (dtype == CTaosInterface.TSDB_DATA_TYPE_INT):
# return ctypes.cast(data, ctypes.POINTER(ctypes.c_int))[0]
# elif (dtype == CTaosInterface.TSDB_DATA_TYPE_BIGINT):
# return ctypes.cast(data, ctypes.POINTER(ctypes.c_
long
))[0]
# return ctypes.cast(data, ctypes.POINTER(ctypes.c_
int64
))[0]
# elif (dtype == CTaosInterface.TSDB_DATA_TYPE_FLOAT):
# return ctypes.cast(data, ctypes.POINTER(ctypes.c_float))[0]
# elif (dtype == CTaosInterface.TSDB_DATA_TYPE_DOUBLE):
...
...
@@ -608,7 +608,7 @@ class CTaosInterface(object):
# elif (dtype == CTaosInterface.TSDB_DATA_TYPE_BINARY):
# return (ctypes.cast(data, ctypes.POINTER(ctypes.c_char))[0:byte]).rstrip('\x00')
# elif (dtype == CTaosInterface.TSDB_DATA_TYPE_TIMESTAMP):
# return ctypes.cast(data, ctypes.POINTER(ctypes.c_
long
))[0]
# return ctypes.cast(data, ctypes.POINTER(ctypes.c_
int64
))[0]
# elif (dtype == CTaosInterface.TSDB_DATA_TYPE_NCHAR):
# return (ctypes.cast(data, ctypes.c_char_p).value).rstrip('\x00')
...
...
src/connector/python/osx/python3/taos/cursor.py
浏览文件 @
d6fd9e58
from
.cinterface
import
CTaosInterface
from
.error
import
*
from
.constants
import
FieldType
import
threading
# querySeqNum = 0
...
...
@@ -38,7 +37,6 @@ class TDengineCursor(object):
self
.
_block_iter
=
0
self
.
_affected_rows
=
0
self
.
_logfile
=
""
self
.
_threadId
=
threading
.
get_ident
()
if
connection
is
not
None
:
self
.
_connection
=
connection
...
...
@@ -105,12 +103,6 @@ class TDengineCursor(object):
def
execute
(
self
,
operation
,
params
=
None
):
"""Prepare and execute a database operation (query or command).
"""
# if threading.get_ident() != self._threadId:
# info ="Cursor execute:Thread ID not match,creater:"+str(self._threadId)+" caller:"+str(threading.get_ident())
# raise OperationalError(info)
# print(info)
# return None
if
not
operation
:
return
None
...
...
@@ -280,12 +272,6 @@ class TDengineCursor(object):
def
_handle_result
(
self
):
"""Handle the return result from query.
"""
# if threading.get_ident() != self._threadId:
# info = "Cursor handleresult:Thread ID not match,creater:"+str(self._threadId)+" caller:"+str(threading.get_ident())
# raise OperationalError(info)
# print(info)
# return None
self
.
_description
=
[]
for
ele
in
self
.
_fields
:
self
.
_description
.
append
(
...
...
src/connector/python/windows/python2/setup.py
浏览文件 @
d6fd9e58
...
...
@@ -5,7 +5,7 @@ with open("README.md", "r") as fh:
setuptools
.
setup
(
name
=
"taos"
,
version
=
"2.0.
4
"
,
version
=
"2.0.
7
"
,
author
=
"Taosdata Inc."
,
author_email
=
"support@taosdata.com"
,
description
=
"TDengine python client package"
,
...
...
src/connector/python/windows/python2/taos/cinterface.py
浏览文件 @
d6fd9e58
...
...
@@ -22,10 +22,10 @@ def _crow_timestamp_to_python(data, num_of_rows, nbytes=None, micro=False):
if
num_of_rows
>
0
:
return
list
(
map
(
_timestamp_converter
,
ctypes
.
cast
(
data
,
ctypes
.
POINTER
(
ctypes
.
c_
long
))[:
abs
(
num_of_rows
)]))
data
,
ctypes
.
POINTER
(
ctypes
.
c_
int64
))[:
abs
(
num_of_rows
)]))
else
:
return
list
(
map
(
_timestamp_converter
,
ctypes
.
cast
(
data
,
ctypes
.
POINTER
(
ctypes
.
c_
long
))[:
abs
(
num_of_rows
)]))
data
,
ctypes
.
POINTER
(
ctypes
.
c_
int64
))[:
abs
(
num_of_rows
)]))
def
_crow_bool_to_python
(
data
,
num_of_rows
,
nbytes
=
None
,
micro
=
False
):
...
...
@@ -145,10 +145,10 @@ def _crow_bigint_to_python(data, num_of_rows, nbytes=None, micro=False):
"""
if
num_of_rows
>
0
:
return
[
None
if
ele
==
FieldType
.
C_BIGINT_NULL
else
ele
for
ele
in
ctypes
.
cast
(
data
,
ctypes
.
POINTER
(
ctypes
.
c_
long
))[:
abs
(
num_of_rows
)]]
data
,
ctypes
.
POINTER
(
ctypes
.
c_
int64
))[:
abs
(
num_of_rows
)]]
else
:
return
[
None
if
ele
==
FieldType
.
C_BIGINT_NULL
else
ele
for
ele
in
ctypes
.
cast
(
data
,
ctypes
.
POINTER
(
ctypes
.
c_
long
))[:
abs
(
num_of_rows
)]]
data
,
ctypes
.
POINTER
(
ctypes
.
c_
int64
))[:
abs
(
num_of_rows
)]]
def
_crow_bigint_unsigned_to_python
(
...
...
@@ -162,13 +162,13 @@ def _crow_bigint_unsigned_to_python(
return
[
None
if
ele
==
FieldType
.
C_BIGINT_UNSIGNED_NULL
else
ele
for
ele
in
ctypes
.
cast
(
data
,
ctypes
.
POINTER
(
ctypes
.
c_u
long
))[
ctypes
.
c_u
int64
))[
:
abs
(
num_of_rows
)]]
else
:
return
[
None
if
ele
==
FieldType
.
C_BIGINT_UNSIGNED_NULL
else
ele
for
ele
in
ctypes
.
cast
(
data
,
ctypes
.
POINTER
(
ctypes
.
c_u
long
))[
ctypes
.
c_u
int64
))[
:
abs
(
num_of_rows
)]]
...
...
@@ -600,7 +600,7 @@ class CTaosInterface(object):
# elif (dtype == CTaosInterface.TSDB_DATA_TYPE_INT):
# return ctypes.cast(data, ctypes.POINTER(ctypes.c_int))[0]
# elif (dtype == CTaosInterface.TSDB_DATA_TYPE_BIGINT):
# return ctypes.cast(data, ctypes.POINTER(ctypes.c_
long
))[0]
# return ctypes.cast(data, ctypes.POINTER(ctypes.c_
int64
))[0]
# elif (dtype == CTaosInterface.TSDB_DATA_TYPE_FLOAT):
# return ctypes.cast(data, ctypes.POINTER(ctypes.c_float))[0]
# elif (dtype == CTaosInterface.TSDB_DATA_TYPE_DOUBLE):
...
...
@@ -608,7 +608,7 @@ class CTaosInterface(object):
# elif (dtype == CTaosInterface.TSDB_DATA_TYPE_BINARY):
# return (ctypes.cast(data, ctypes.POINTER(ctypes.c_char))[0:byte]).rstrip('\x00')
# elif (dtype == CTaosInterface.TSDB_DATA_TYPE_TIMESTAMP):
# return ctypes.cast(data, ctypes.POINTER(ctypes.c_
long
))[0]
# return ctypes.cast(data, ctypes.POINTER(ctypes.c_
int64
))[0]
# elif (dtype == CTaosInterface.TSDB_DATA_TYPE_NCHAR):
# return (ctypes.cast(data, ctypes.c_char_p).value).rstrip('\x00')
...
...
src/connector/python/windows/python2/taos/cursor.py
浏览文件 @
d6fd9e58
from
.cinterface
import
CTaosInterface
from
.error
import
*
from
.constants
import
FieldType
import
threading
# querySeqNum = 0
...
...
@@ -38,7 +37,6 @@ class TDengineCursor(object):
self
.
_block_iter
=
0
self
.
_affected_rows
=
0
self
.
_logfile
=
""
self
.
_threadId
=
threading
.
get_ident
()
if
connection
is
not
None
:
self
.
_connection
=
connection
...
...
src/connector/python/windows/python3/setup.py
浏览文件 @
d6fd9e58
...
...
@@ -5,7 +5,7 @@ with open("README.md", "r") as fh:
setuptools
.
setup
(
name
=
"taos"
,
version
=
"2.0.
4
"
,
version
=
"2.0.
7
"
,
author
=
"Taosdata Inc."
,
author_email
=
"support@taosdata.com"
,
description
=
"TDengine python client package"
,
...
...
src/connector/python/windows/python3/taos/cinterface.py
浏览文件 @
d6fd9e58
...
...
@@ -22,10 +22,10 @@ def _crow_timestamp_to_python(data, num_of_rows, nbytes=None, micro=False):
if
num_of_rows
>
0
:
return
list
(
map
(
_timestamp_converter
,
ctypes
.
cast
(
data
,
ctypes
.
POINTER
(
ctypes
.
c_
long
))[:
abs
(
num_of_rows
)]))
data
,
ctypes
.
POINTER
(
ctypes
.
c_
int64
))[:
abs
(
num_of_rows
)]))
else
:
return
list
(
map
(
_timestamp_converter
,
ctypes
.
cast
(
data
,
ctypes
.
POINTER
(
ctypes
.
c_
long
))[:
abs
(
num_of_rows
)]))
data
,
ctypes
.
POINTER
(
ctypes
.
c_
int64
))[:
abs
(
num_of_rows
)]))
def
_crow_bool_to_python
(
data
,
num_of_rows
,
nbytes
=
None
,
micro
=
False
):
...
...
@@ -145,10 +145,10 @@ def _crow_bigint_to_python(data, num_of_rows, nbytes=None, micro=False):
"""
if
num_of_rows
>
0
:
return
[
None
if
ele
==
FieldType
.
C_BIGINT_NULL
else
ele
for
ele
in
ctypes
.
cast
(
data
,
ctypes
.
POINTER
(
ctypes
.
c_
long
))[:
abs
(
num_of_rows
)]]
data
,
ctypes
.
POINTER
(
ctypes
.
c_
int64
))[:
abs
(
num_of_rows
)]]
else
:
return
[
None
if
ele
==
FieldType
.
C_BIGINT_NULL
else
ele
for
ele
in
ctypes
.
cast
(
data
,
ctypes
.
POINTER
(
ctypes
.
c_
long
))[:
abs
(
num_of_rows
)]]
data
,
ctypes
.
POINTER
(
ctypes
.
c_
int64
))[:
abs
(
num_of_rows
)]]
def
_crow_bigint_unsigned_to_python
(
...
...
@@ -162,13 +162,13 @@ def _crow_bigint_unsigned_to_python(
return
[
None
if
ele
==
FieldType
.
C_BIGINT_UNSIGNED_NULL
else
ele
for
ele
in
ctypes
.
cast
(
data
,
ctypes
.
POINTER
(
ctypes
.
c_u
long
))[
ctypes
.
c_u
int64
))[
:
abs
(
num_of_rows
)]]
else
:
return
[
None
if
ele
==
FieldType
.
C_BIGINT_UNSIGNED_NULL
else
ele
for
ele
in
ctypes
.
cast
(
data
,
ctypes
.
POINTER
(
ctypes
.
c_u
long
))[
ctypes
.
c_u
int64
))[
:
abs
(
num_of_rows
)]]
...
...
@@ -600,7 +600,7 @@ class CTaosInterface(object):
# elif (dtype == CTaosInterface.TSDB_DATA_TYPE_INT):
# return ctypes.cast(data, ctypes.POINTER(ctypes.c_int))[0]
# elif (dtype == CTaosInterface.TSDB_DATA_TYPE_BIGINT):
# return ctypes.cast(data, ctypes.POINTER(ctypes.c_
long
))[0]
# return ctypes.cast(data, ctypes.POINTER(ctypes.c_
int64
))[0]
# elif (dtype == CTaosInterface.TSDB_DATA_TYPE_FLOAT):
# return ctypes.cast(data, ctypes.POINTER(ctypes.c_float))[0]
# elif (dtype == CTaosInterface.TSDB_DATA_TYPE_DOUBLE):
...
...
@@ -608,7 +608,7 @@ class CTaosInterface(object):
# elif (dtype == CTaosInterface.TSDB_DATA_TYPE_BINARY):
# return (ctypes.cast(data, ctypes.POINTER(ctypes.c_char))[0:byte]).rstrip('\x00')
# elif (dtype == CTaosInterface.TSDB_DATA_TYPE_TIMESTAMP):
# return ctypes.cast(data, ctypes.POINTER(ctypes.c_
long
))[0]
# return ctypes.cast(data, ctypes.POINTER(ctypes.c_
int64
))[0]
# elif (dtype == CTaosInterface.TSDB_DATA_TYPE_NCHAR):
# return (ctypes.cast(data, ctypes.c_char_p).value).rstrip('\x00')
...
...
src/connector/python/windows/python3/taos/cursor.py
浏览文件 @
d6fd9e58
from
.cinterface
import
CTaosInterface
from
.error
import
*
from
.constants
import
FieldType
import
threading
# querySeqNum = 0
...
...
@@ -38,7 +37,6 @@ class TDengineCursor(object):
self
.
_block_iter
=
0
self
.
_affected_rows
=
0
self
.
_logfile
=
""
self
.
_threadId
=
threading
.
get_ident
()
if
connection
is
not
None
:
self
.
_connection
=
connection
...
...
src/kit/taosdemo/insert.json
浏览文件 @
d6fd9e58
...
...
@@ -11,6 +11,7 @@
"confirm_parameter_prompt"
:
"no"
,
"insert_interval"
:
0
,
"num_of_records_per_req"
:
100
,
"max_sql_len"
:
1024000
,
"databases"
:
[{
"dbinfo"
:
{
"name"
:
"db"
,
...
...
@@ -38,7 +39,9 @@
"auto_create_table"
:
"no"
,
"data_source"
:
"rand"
,
"insert_mode"
:
"taosc"
,
"insert_rows"
:
100000
,
"childtable_limit"
:
33
,
"childtable_offset"
:
33
,
"insert_rows"
:
1000
,
"multi_thread_write_one_tbl"
:
"no"
,
"number_of_tbl_in_one_sql"
:
0
,
"rows_per_tbl"
:
100
,
...
...
src/kit/taosdemo/taosdemo.c
浏览文件 @
d6fd9e58
此差异已折叠。
点击以展开。
src/plugins/http/inc/httpJson.h
浏览文件 @
d6fd9e58
...
...
@@ -63,9 +63,11 @@ void httpJsonString(JsonBuf* buf, char* sVal, int32_t len);
void
httpJsonOriginString
(
JsonBuf
*
buf
,
char
*
sVal
,
int32_t
len
);
void
httpJsonStringForTransMean
(
JsonBuf
*
buf
,
char
*
SVal
,
int32_t
maxLen
);
void
httpJsonInt64
(
JsonBuf
*
buf
,
int64_t
num
);
void
httpJsonUInt64
(
JsonBuf
*
buf
,
uint64_t
num
);
void
httpJsonTimestamp
(
JsonBuf
*
buf
,
int64_t
t
,
bool
us
);
void
httpJsonUtcTimestamp
(
JsonBuf
*
buf
,
int64_t
t
,
bool
us
);
void
httpJsonInt
(
JsonBuf
*
buf
,
int32_t
num
);
void
httpJsonUInt
(
JsonBuf
*
buf
,
uint32_t
num
);
void
httpJsonFloat
(
JsonBuf
*
buf
,
float
num
);
void
httpJsonDouble
(
JsonBuf
*
buf
,
double
num
);
void
httpJsonNull
(
JsonBuf
*
buf
);
...
...
src/plugins/http/src/httpJson.c
浏览文件 @
d6fd9e58
...
...
@@ -256,6 +256,12 @@ void httpJsonInt64(JsonBuf* buf, int64_t num) {
buf
->
lst
+=
snprintf
(
buf
->
lst
,
MAX_NUM_STR_SZ
,
"%"
PRId64
,
num
);
}
void
httpJsonUInt64
(
JsonBuf
*
buf
,
uint64_t
num
)
{
httpJsonItemToken
(
buf
);
httpJsonTestBuf
(
buf
,
MAX_NUM_STR_SZ
);
buf
->
lst
+=
snprintf
(
buf
->
lst
,
MAX_NUM_STR_SZ
,
"%"
PRIu64
,
num
);
}
void
httpJsonTimestamp
(
JsonBuf
*
buf
,
int64_t
t
,
bool
us
)
{
char
ts
[
35
]
=
{
0
};
struct
tm
*
ptm
;
...
...
@@ -303,6 +309,12 @@ void httpJsonInt(JsonBuf* buf, int32_t num) {
buf
->
lst
+=
snprintf
(
buf
->
lst
,
MAX_NUM_STR_SZ
,
"%d"
,
num
);
}
void
httpJsonUInt
(
JsonBuf
*
buf
,
uint32_t
num
)
{
httpJsonItemToken
(
buf
);
httpJsonTestBuf
(
buf
,
MAX_NUM_STR_SZ
);
buf
->
lst
+=
snprintf
(
buf
->
lst
,
MAX_NUM_STR_SZ
,
"%u"
,
num
);
}
void
httpJsonFloat
(
JsonBuf
*
buf
,
float
num
)
{
httpJsonItemToken
(
buf
);
httpJsonTestBuf
(
buf
,
MAX_NUM_STR_SZ
);
...
...
src/plugins/http/src/httpRestJson.c
浏览文件 @
d6fd9e58
...
...
@@ -162,6 +162,18 @@ bool restBuildSqlJson(HttpContext *pContext, HttpSqlCmd *cmd, TAOS_RES *result,
case
TSDB_DATA_TYPE_BIGINT
:
httpJsonInt64
(
jsonBuf
,
*
((
int64_t
*
)
row
[
i
]));
break
;
case
TSDB_DATA_TYPE_UTINYINT
:
httpJsonUInt
(
jsonBuf
,
*
((
uint8_t
*
)
row
[
i
]));
break
;
case
TSDB_DATA_TYPE_USMALLINT
:
httpJsonUInt
(
jsonBuf
,
*
((
uint16_t
*
)
row
[
i
]));
break
;
case
TSDB_DATA_TYPE_UINT
:
httpJsonUInt
(
jsonBuf
,
*
((
uint32_t
*
)
row
[
i
]));
break
;
case
TSDB_DATA_TYPE_UBIGINT
:
httpJsonUInt64
(
jsonBuf
,
*
((
uint64_t
*
)
row
[
i
]));
break
;
case
TSDB_DATA_TYPE_FLOAT
:
httpJsonFloat
(
jsonBuf
,
GET_FLOAT_VAL
(
row
[
i
]));
break
;
...
...
tests/pytest/crash_gen/crash_gen_main.py
浏览文件 @
d6fd9e58
...
...
@@ -1785,7 +1785,7 @@ class TdSuperTable:
'top(speed, 50)'
,
# TODO: not supported?
'bottom(speed, 50)'
,
# TODO: not supported?
'apercentile(speed, 10)'
,
# TODO: TD-1316
'last_row(speed)'
,
# 'last_row(speed)', # TODO: commented out per TD-3231, we should re-create
# Transformation Functions
# 'diff(speed)', # TODO: no supported?!
'spread(speed)'
...
...
tests/pytest/fulltest.sh
浏览文件 @
d6fd9e58
...
...
@@ -183,6 +183,7 @@ python3 ./test.py -f query/isNullTest.py
python3 ./test.py
-f
query/queryWithTaosdKilled.py
python3 ./test.py
-f
query/floatCompare.py
python3 ./test.py
-f
query/queryGroupbySort.py
python3 ./test.py
-f
query/queryBetweenAnd.py
#stream
python3 ./test.py
-f
stream/metric_1.py
...
...
tests/pytest/functions/function_stddev.py
浏览文件 @
d6fd9e58
...
...
@@ -26,6 +26,8 @@ class TDTestCase:
self
.
rowNum
=
10
self
.
ts
=
1537146000000
self
.
stb_prefix
=
's'
self
.
subtb_prefix
=
't'
def
run
(
self
):
tdSql
.
prepare
()
...
...
@@ -85,6 +87,33 @@ class TDTestCase:
tdSql
.
query
(
"select stddev(col6) from test1"
)
tdSql
.
checkData
(
0
,
0
,
np
.
std
(
floatData
))
#add for td-3276
sql
=
"create table s (ts timestamp, c1 int, c2 float, c3 bigint, c4 smallint, c5 tinyint, c6 double, c7 bool,c8 binary(20),c9 nchar(20),c11 int unsigned,c12 smallint unsigned,c13 tinyint unsigned,c14 bigint unsigned)
\
tags(t1 int, t2 float, t3 bigint, t4 smallint, t5 tinyint, t6 double, t7 bool,t8 binary(20),t9 nchar(20), t10 int unsigned , t11 smallint unsigned , t12 tinyint unsigned , t13 bigint unsigned)"
tdSql
.
execute
(
sql
)
for
j
in
range
(
2
):
if
j
%
2
==
0
:
sql
=
"create table %s using %s tags(NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL)"
%
\
(
self
.
subtb_prefix
+
str
(
j
)
+
'_'
+
str
(
j
),
self
.
stb_prefix
)
else
:
sql
=
"create table %s using %s tags(%d,%d,%d,%d,%d,%d,%d,'%s','%s',%d,%d,%d,%d)"
%
\
(
self
.
subtb_prefix
+
str
(
j
)
+
'_'
+
str
(
j
),
self
.
stb_prefix
,
j
,
j
/
2.0
,
j
%
41
,
j
%
51
,
j
%
53
,
j
*
1.0
,
j
%
2
,
'taos'
+
str
(
j
),
'涛思'
+
str
(
j
),
j
%
43
,
j
%
23
,
j
%
17
,
j
%
3167
)
tdSql
.
execute
(
sql
)
for
i
in
range
(
10
):
if
i
%
5
==
0
:
ret
=
tdSql
.
execute
(
"insert into %s values (%d , NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL)"
%
(
self
.
subtb_prefix
+
str
(
j
)
+
'_'
+
str
(
j
),
self
.
ts
+
i
))
else
:
ret
=
tdSql
.
execute
(
"insert into %s values (%d , %d,%d,%d,%d,%d,%d,%d,'%s','%s',%d,%d,%d,%d)"
%
(
self
.
subtb_prefix
+
str
(
j
)
+
'_'
+
str
(
j
),
self
.
ts
+
i
,
i
%
100
,
i
/
2.0
,
i
%
41
,
i
%
51
,
i
%
53
,
i
*
1.0
,
i
%
2
,
'taos'
+
str
(
i
),
'涛思'
+
str
(
i
),
i
%
43
,
i
%
23
,
i
%
17
,
i
%
3167
))
for
i
in
range
(
13
):
tdSql
.
query
(
'select stddev(c4) from s group by t%s'
%
str
(
i
+
1
)
)
def
stop
(
self
):
tdSql
.
close
()
...
...
tests/pytest/query/queryBetweenAnd.py
0 → 100644
浏览文件 @
d6fd9e58
###################################################################
# Copyright (c) 2016 by TAOS Technologies, Inc.
# All rights reserved.
#
# This file is proprietary and confidential to TAOS Technologies.
# No part of this file may be reproduced, stored, transmitted,
# disclosed or used in any form or by any means other than as
# expressly provided by the written permission from Jianhui Tao
#
###################################################################
# -*- coding: utf-8 -*-
import
taos
import
sys
from
util.log
import
*
from
util.sql
import
*
from
util.cases
import
*
class
TDTestCase
:
def
init
(
self
,
conn
,
logSql
):
tdLog
.
debug
(
f
"start to excute
{
__file__
}
"
)
tdSql
.
init
(
conn
.
cursor
())
def
run
(
self
):
tdSql
.
prepare
()
tdLog
.
printNoPrefix
(
"==========step1:create table"
)
tdSql
.
execute
(
'''create table if not exists supt
(ts timestamp, c1 int, c2 float, c3 bigint, c4 double, c5 smallint, c6 tinyint)
tags(location binary(64), type int, isused bool , family nchar(64))'''
)
tdSql
.
execute
(
"create table t1 using supt tags('beijing', 1, 1, '自行车')"
)
tdSql
.
execute
(
"create table t2 using supt tags('shanghai', 2, 0, '拖拉机')"
)
tdLog
.
printNoPrefix
(
"==========step2:insert data"
)
for
i
in
range
(
10
):
tdSql
.
execute
(
f
"insert into t1 values (now+
{
i
}
m,
{
32767
+
i
}
,
{
20.0
+
i
/
10
}
,
{
2
**
31
+
i
}
,
{
3.4
*
10
**
38
+
i
/
10
}
,
{
127
+
i
}
,
{
i
}
)"
)
tdSql
.
execute
(
f
"insert into t2 values (now-
{
i
}
m,
{
-
32767
-
i
}
,
{
20.0
-
i
/
10
}
,
{
-
i
-
2
**
31
}
,
{
-
i
/
10
-
3.4
*
10
**
38
}
,
{
-
127
-
i
}
,
{
-
i
}
)"
)
tdSql
.
execute
(
f
"insert into t1 values (now+11m,
{
2
**
31
-
1
}
,
{
pow
(
10
,
37
)
*
34
}
,
{
pow
(
2
,
63
)
-
1
}
,
{
1.7
*
10
**
308
}
, 32767, 127)"
)
tdSql
.
execute
(
f
"insert into t2 values (now-11m,
{
1
-
2
**
31
}
,
{
-
3.4
*
10
**
38
}
,
{
1
-
2
**
63
}
,
{
-
1.7
*
10
**
308
}
, -32767, -127)"
)
tdSql
.
execute
(
f
"insert into t2 values (now-12m, null ,
{
-
3.4
*
10
**
38
}
, null ,
{
-
1.7
*
10
**
308
}
, null , null)"
)
tdLog
.
printNoPrefix
(
"==========step3:query timestamp type"
)
tdSql
.
query
(
"select * from t1 where ts between now-1m and now+10m"
)
tdSql
.
checkRows
(
10
)
tdSql
.
query
(
"select * from t1 where ts between '2021-01-01 00:00:00.000' and '2121-01-01 00:00:00.000'"
)
tdSql
.
checkRows
(
11
)
tdSql
.
query
(
"select * from t1 where ts between '1969-01-01 00:00:00.000' and '1969-12-31 23:59:59.999'"
)
tdSql
.
checkRows
(
0
)
tdSql
.
query
(
"select * from t1 where ts between -2793600 and 31507199"
)
tdSql
.
checkRows
(
0
)
tdSql
.
query
(
"select * from t1 where ts between 1609430400000 and 4765104000000"
)
tdSql
.
checkRows
(
11
)
tdLog
.
printNoPrefix
(
"==========step4:query int type"
)
tdSql
.
query
(
"select * from t1 where c1 between 32767 and 32776"
)
tdSql
.
checkRows
(
10
)
tdSql
.
query
(
"select * from t1 where c1 between 32766.9 and 32776.1"
)
tdSql
.
checkRows
(
10
)
tdSql
.
query
(
"select * from t1 where c1 between 32776 and 32767"
)
tdSql
.
checkRows
(
0
)
tdSql
.
error
(
"select * from t1 where c1 between 'a' and 'e'"
)
# tdSql.query("select * from t1 where c1 between 0x64 and 0x69")
# tdSql.checkRows(6)
tdSql
.
error
(
"select * from t1 where c1 not between 100 and 106"
)
tdSql
.
query
(
f
"select * from t1 where c1 between
{
2
**
31
-
2
}
and
{
2
**
31
+
1
}
"
)
tdSql
.
checkRows
(
1
)
tdSql
.
error
(
f
"select * from t2 where c1 between null and
{
1
-
2
**
31
}
"
)
# tdSql.checkRows(3)
tdSql
.
query
(
f
"select * from t2 where c1 between
{
-
2
**
31
}
and
{
1
-
2
**
31
}
"
)
tdSql
.
checkRows
(
1
)
tdLog
.
printNoPrefix
(
"==========step5:query float type"
)
tdSql
.
query
(
"select * from t1 where c2 between 20.0 and 21.0"
)
tdSql
.
checkRows
(
10
)
tdSql
.
query
(
f
"select * from t1 where c2 between
{
-
3.4
*
10
**
38
-
1
}
and
{
3.4
*
10
**
38
+
1
}
"
)
tdSql
.
checkRows
(
11
)
tdSql
.
query
(
"select * from t1 where c2 between 21.0 and 20.0"
)
tdSql
.
checkRows
(
0
)
tdSql
.
error
(
"select * from t1 where c2 between 'DC3' and 'SYN'"
)
tdSql
.
error
(
"select * from t1 where c2 not between 0.1 and 0.2"
)
# tdSql.query(f"select * from t1 where c2 between {pow(10,38)*3.4} and {pow(10,38)*3.4+1}")
# tdSql.checkRows(1)
tdSql
.
query
(
f
"select * from t2 where c2 between
{
-
3.4
*
10
**
38
-
1
}
and
{
-
3.4
*
10
**
38
}
"
)
tdSql
.
checkRows
(
0
)
tdSql
.
error
(
f
"select * from t2 where c2 between null and
{
-
3.4
*
10
**
38
}
"
)
# tdSql.checkRows(3)
tdLog
.
printNoPrefix
(
"==========step6:query bigint type"
)
tdSql
.
query
(
f
"select * from t1 where c3 between
{
2
**
31
}
and
{
2
**
31
+
10
}
"
)
tdSql
.
checkRows
(
10
)
tdSql
.
error
(
f
"select * from t1 where c3 between
{
-
2
**
63
}
and
{
2
**
63
}
"
)
# tdSql.checkRows(11)
tdSql
.
query
(
f
"select * from t1 where c3 between
{
2
**
31
+
10
}
and
{
2
**
31
}
"
)
tdSql
.
checkRows
(
0
)
tdSql
.
error
(
"select * from t1 where c3 between 'a' and 'z'"
)
tdSql
.
error
(
"select * from t1 where c3 not between 1 and 2"
)
tdSql
.
query
(
f
"select * from t1 where c3 between
{
2
**
63
-
2
}
and
{
2
**
63
-
1
}
"
)
tdSql
.
checkRows
(
1
)
tdSql
.
error
(
f
"select * from t2 where c3 between
{
-
2
**
63
}
and
{
1
-
2
**
63
}
"
)
# tdSql.checkRows(3)
tdSql
.
error
(
f
"select * from t2 where c3 between null and
{
1
-
2
**
63
}
"
)
# tdSql.checkRows(2)
tdLog
.
printNoPrefix
(
"==========step7:query double type"
)
tdSql
.
query
(
f
"select * from t1 where c4 between
{
3.4
*
10
**
38
}
and
{
3.4
*
10
**
38
+
10
}
"
)
tdSql
.
checkRows
(
10
)
tdSql
.
query
(
f
"select * from t1 where c4 between
{
1.7
*
10
**
308
+
1
}
and
{
1.7
*
10
**
308
+
2
}
"
)
# 因为精度原因,在超出bigint边界后,数值不能进行准确的判断
# tdSql.checkRows(0)
tdSql
.
query
(
f
"select * from t1 where c4 between
{
3.4
*
10
**
38
+
10
}
and
{
3.4
*
10
**
38
}
"
)
# tdSql.checkRows(0)
tdSql
.
error
(
"select * from t1 where c4 between 'a' and 'z'"
)
tdSql
.
error
(
"select * from t1 where c4 not between 1 and 2"
)
tdSql
.
query
(
f
"select * from t1 where c4 between
{
1.7
*
10
**
308
}
and
{
1.7
*
10
**
308
+
1
}
"
)
tdSql
.
checkRows
(
1
)
tdSql
.
query
(
f
"select * from t2 where c4 between
{
-
1.7
*
10
**
308
-
1
}
and
{
-
1.7
*
10
**
308
}
"
)
# tdSql.checkRows(3)
tdSql
.
error
(
f
"select * from t2 where c4 between null and
{
-
1.7
*
10
**
308
}
"
)
# tdSql.checkRows(3)
tdLog
.
printNoPrefix
(
"==========step8:query smallint type"
)
tdSql
.
query
(
"select * from t1 where c5 between 127 and 136"
)
tdSql
.
checkRows
(
10
)
tdSql
.
query
(
"select * from t1 where c5 between 126.9 and 135.9"
)
tdSql
.
checkRows
(
9
)
tdSql
.
query
(
"select * from t1 where c5 between 136 and 127"
)
tdSql
.
checkRows
(
0
)
tdSql
.
error
(
"select * from t1 where c5 between '~' and 'ˆ'"
)
tdSql
.
error
(
"select * from t1 where c5 not between 1 and 2"
)
tdSql
.
query
(
"select * from t1 where c5 between 32767 and 32768"
)
tdSql
.
checkRows
(
1
)
tdSql
.
query
(
"select * from t2 where c5 between -32768 and -32767"
)
tdSql
.
checkRows
(
1
)
tdSql
.
error
(
"select * from t2 where c5 between null and -32767"
)
# tdSql.checkRows(1)
tdLog
.
printNoPrefix
(
"==========step9:query tinyint type"
)
tdSql
.
query
(
"select * from t1 where c6 between 0 and 9"
)
tdSql
.
checkRows
(
10
)
tdSql
.
query
(
"select * from t1 where c6 between -1.1 and 8.9"
)
tdSql
.
checkRows
(
9
)
tdSql
.
query
(
"select * from t1 where c6 between 9 and 0"
)
tdSql
.
checkRows
(
0
)
tdSql
.
error
(
"select * from t1 where c6 between 'NUL' and 'HT'"
)
tdSql
.
error
(
"select * from t1 where c6 not between 1 and 2"
)
tdSql
.
query
(
"select * from t1 where c6 between 127 and 128"
)
tdSql
.
checkRows
(
1
)
tdSql
.
query
(
"select * from t2 where c6 between -128 and -127"
)
tdSql
.
checkRows
(
1
)
tdSql
.
error
(
"select * from t2 where c6 between null and -127"
)
# tdSql.checkRows(3)
tdLog
.
printNoPrefix
(
"==========step10:invalid query type"
)
tdSql
.
query
(
"select * from supt where location between 'beijing' and 'shanghai'"
)
tdSql
.
checkRows
(
23
)
# 非0值均解析为1,因此"between 负值 and o"解析为"between 1 and 0"
tdSql
.
query
(
"select * from supt where isused between 0 and 1"
)
tdSql
.
checkRows
(
23
)
tdSql
.
query
(
"select * from supt where isused between -1 and 0"
)
tdSql
.
checkRows
(
0
)
tdSql
.
error
(
"select * from supt where isused between false and true"
)
tdSql
.
query
(
"select * from supt where family between '拖拉机' and '自行车'"
)
tdSql
.
checkRows
(
23
)
tdLog
.
printNoPrefix
(
"==========step11:query HEX/OCT/BIN type"
)
tdSql
.
error
(
"select * from t1 where c6 between 0x7f and 0x80"
)
# check filter HEX
tdSql
.
error
(
"select * from t1 where c6 between 0b1 and 0b11111"
)
# check filter BIN
tdSql
.
error
(
"select * from t1 where c6 between 0b1 and 0x80"
)
tdSql
.
error
(
"select * from t1 where c6=0b1"
)
tdSql
.
error
(
"select * from t1 where c6=0x1"
)
# 八进制数据会按照十进制数据进行判定
tdSql
.
query
(
"select * from t1 where c6 between 01 and 0200"
)
# check filter OCT
tdSql
.
checkRows
(
10
)
def
stop
(
self
):
tdSql
.
close
()
tdLog
.
success
(
f
"
{
__file__
}
successfully executed"
)
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
\ No newline at end of file
tests/pytest/tools/taosdemoTestWithoutMetric.py
0 → 100644
浏览文件 @
d6fd9e58
###################################################################
# Copyright (c) 2016 by TAOS Technologies, Inc.
# All rights reserved.
#
# This file is proprietary and confidential to TAOS Technologies.
# No part of this file may be reproduced, stored, transmitted,
# disclosed or used in any form or by any means other than as
# expressly provided by the written permission from Jianhui Tao
#
###################################################################
# -*- coding: utf-8 -*-
import
sys
import
os
from
util.log
import
*
from
util.cases
import
*
from
util.sql
import
*
from
util.dnodes
import
*
class
TDTestCase
:
def
init
(
self
,
conn
,
logSql
):
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdSql
.
init
(
conn
.
cursor
(),
logSql
)
self
.
numberOfTables
=
100
self
.
numberOfRecords
=
1000
def
getBuildPath
(
self
):
selfPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
if
(
"community"
in
selfPath
):
projPath
=
selfPath
[:
selfPath
.
find
(
"community"
)]
else
:
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
if
(
"taosd"
in
files
):
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
if
(
"packaging"
not
in
rootRealPath
):
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
break
return
buildPath
def
run
(
self
):
buildPath
=
self
.
getBuildPath
()
if
(
buildPath
==
""
):
tdLog
.
exit
(
"taosd not found!"
)
else
:
tdLog
.
info
(
"taosd found in %s"
%
buildPath
)
binPath
=
buildPath
+
"/build/bin/"
os
.
system
(
"%staosdemo -y -t %d -n %d -x"
%
(
binPath
,
self
.
numberOfTables
,
self
.
numberOfRecords
))
tdSql
.
query
(
"show databases"
)
for
i
in
range
(
18
):
print
(
tdSql
.
getData
(
0
,
i
)
)
tdSql
.
checkData
(
0
,
2
,
self
.
numberOfTables
)
tdSql
.
execute
(
"use test"
)
tdSql
.
query
(
"select count(*) from test.t%d"
%
(
self
.
numberOfTables
-
1
))
tdSql
.
checkData
(
0
,
0
,
self
.
numberOfRecords
)
def
stop
(
self
):
tdSql
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
tests/script/general/db/topic1.sim
浏览文件 @
d6fd9e58
...
...
@@ -740,11 +740,7 @@ endi
if $data02 != 1 then
return -1
endi
#numofvgroups
sql show t1.vgroups;
if $rows != 1 then
return -1
endi
sql show t1.stables;
if $rows != 1 then
return -1
...
...
@@ -773,11 +769,8 @@ endi
if $data02 != 2 then
return -1
endi
#numofvgroups
sql show t1.vgroups;
if $rows != 2 then
return -1
endi
sql show t1.stables;
if $rows != 1 then
return -1
...
...
@@ -806,11 +799,7 @@ endi
if $data02 != 3 then
return -1
endi
#numofvgroups
sql show t1.vgroups;
if $rows != 3 then
return -1
endi
sql show t1.stables;
if $rows != 1 then
return -1
...
...
tests/script/general/parser/groupby.sim
浏览文件 @
d6fd9e58
...
...
@@ -610,6 +610,11 @@ print =================>TD-2665
sql_error create table txx as select avg(c) as t from st;
sql_error create table txx1 as select avg(c) as t from t1;
sql select stddev(c),stddev(c) from st group by c;
if $rows != 4 then
return -1
endi
print =================>TD-2236
sql select first(ts),last(ts) from t1 group by c;
if $rows != 4 then
...
...
tests/script/general/parser/lastrow_query.sim
浏览文件 @
d6fd9e58
...
...
@@ -16,6 +16,9 @@ $stb = $stbPrefix . $i
sql use $db
print ========>TD-3231 last_row with group by column error
sql_error select last_row(c1) from $stb group by c1;
##### select lastrow from STable with two vnodes, timestamp decreases from tables in vnode0 to tables in vnode1
sql select last_row(*) from $stb
if $rows != 1 then
...
...
@@ -224,4 +227,4 @@ sql create table tu(ts timestamp, k int)
sql select last_row(*) from tu
if $row != 0 then
return -1
endi
\ No newline at end of file
endi
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录