Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
8a358c66
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1192
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看板
提交
8a358c66
编写于
10月 28, 2021
作者:
S
shenglian zhou
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'develop' of github.com:taosdata/TDengine into szhou/hotfix/TD-10735
上级
3f8d20cf
2fd5aa30
变更
52
隐藏空白更改
内联
并排
Showing
52 changed file
with
1887 addition
and
552 deletion
+1887
-552
Jenkinsfile
Jenkinsfile
+1
-1
documentation20/cn/00.index/docs.md
documentation20/cn/00.index/docs.md
+1
-1
documentation20/cn/03.architecture/docs.md
documentation20/cn/03.architecture/docs.md
+8
-8
documentation20/cn/08.connector/docs.md
documentation20/cn/08.connector/docs.md
+43
-45
documentation20/cn/12.taos-sql/docs.md
documentation20/cn/12.taos-sql/docs.md
+3
-3
packaging/release.sh
packaging/release.sh
+1
-1
src/client/inc/tscParseLine.h
src/client/inc/tscParseLine.h
+1
-0
src/client/inc/tscUtil.h
src/client/inc/tscUtil.h
+1
-0
src/client/jni/com_alibaba_datax_plugin_writer_JniConnection.h
...lient/jni/com_alibaba_datax_plugin_writer_JniConnection.h
+81
-0
src/client/jni/jniCommon.h
src/client/jni/jniCommon.h
+87
-0
src/client/src/TSDBJNIConnector.c
src/client/src/TSDBJNIConnector.c
+11
-75
src/client/src/dataxJniConnection.c
src/client/src/dataxJniConnection.c
+232
-0
src/client/src/taos.def
src/client/src/taos.def
+1
-0
src/client/src/tscParseInsert.c
src/client/src/tscParseInsert.c
+8
-0
src/client/src/tscParseLineProtocol.c
src/client/src/tscParseLineProtocol.c
+78
-82
src/client/src/tscParseOpenTSDB.c
src/client/src/tscParseOpenTSDB.c
+26
-25
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+28
-1
src/client/src/tscSql.c
src/client/src/tscSql.c
+4
-0
src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBResultSetRowData.java
...src/main/java/com/taosdata/jdbc/TSDBResultSetRowData.java
+10
-10
src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBResultSetWrapper.java
...src/main/java/com/taosdata/jdbc/TSDBResultSetWrapper.java
+1
-1
src/connector/python/taos/cinterface.py
src/connector/python/taos/cinterface.py
+2
-3
src/connector/python/tests/test_lines.py
src/connector/python/tests/test_lines.py
+0
-3
src/inc/taosdef.h
src/inc/taosdef.h
+1
-0
src/inc/tsdb.h
src/inc/tsdb.h
+0
-3
src/kit/taosdemo/taosdemo.c
src/kit/taosdemo/taosdemo.c
+30
-23
src/kit/taosdump/taosdump.c
src/kit/taosdump/taosdump.c
+1
-1
src/tsdb/src/tsdbMain.c
src/tsdb/src/tsdbMain.c
+2
-11
src/util/src/ttokenizer.c
src/util/src/ttokenizer.c
+1
-1
src/util/src/tutil.c
src/util/src/tutil.c
+7
-6
src/vnode/src/vnodeWrite.c
src/vnode/src/vnodeWrite.c
+2
-2
tests/examples/c/apitest.c
tests/examples/c/apitest.c
+17
-2
tests/examples/python/taosdemo/taosdemo.py
tests/examples/python/taosdemo/taosdemo.py
+37
-17
tests/pytest/client/twoClients.py
tests/pytest/client/twoClients.py
+4
-1
tests/pytest/fulltest.sh
tests/pytest/fulltest.sh
+1
-1
tests/pytest/insert/insertJSONPayload.py
tests/pytest/insert/insertJSONPayload.py
+178
-1
tests/pytest/insert/insertTelnetLines.py
tests/pytest/insert/insertTelnetLines.py
+104
-58
tests/pytest/insert/line_insert.py
tests/pytest/insert/line_insert.py
+47
-0
tests/pytest/tools/taosdemoAllTest/TD-3453/query-interrupt.json
...pytest/tools/taosdemoAllTest/TD-3453/query-interrupt.json
+2
-2
tests/pytest/tools/taosdemoAllTest/taosdemoInsertMSDB.json
tests/pytest/tools/taosdemoAllTest/taosdemoInsertMSDB.json
+1
-1
tests/pytest/tools/taosdemoAllTest/taosdemoInsertNanoDB.json
tests/pytest/tools/taosdemoAllTest/taosdemoInsertNanoDB.json
+1
-1
tests/pytest/tools/taosdemoAllTest/taosdemoInsertUSDB.json
tests/pytest/tools/taosdemoAllTest/taosdemoInsertUSDB.json
+1
-1
tests/pytest/tools/taosdemoAllTest/taosdemoTestNanoDatabase.json
...ytest/tools/taosdemoAllTest/taosdemoTestNanoDatabase.json
+1
-1
tests/pytest/tools/taosdemoAllTest/taosdemoTestNanoDatabaseInsertForSub.json
...taosdemoAllTest/taosdemoTestNanoDatabaseInsertForSub.json
+1
-1
tests/pytest/tools/taosdemoAllTest/taosdemoTestNanoDatabaseNow.json
...st/tools/taosdemoAllTest/taosdemoTestNanoDatabaseNow.json
+1
-1
tests/pytest/tools/taosdemoAllTest/taosdemoTestNanoDatabasecsv.json
...st/tools/taosdemoAllTest/taosdemoTestNanoDatabasecsv.json
+1
-1
tests/pytest/tools/taosdemoAllTest/taosdemoTestQueryWithJson.py
...pytest/tools/taosdemoAllTest/taosdemoTestQueryWithJson.py
+107
-68
tests/pytest/tools/taosdemoAllTest/taosdemoTestSupportNanoInsert.py
...st/tools/taosdemoAllTest/taosdemoTestSupportNanoInsert.py
+40
-28
tests/script/api/openTSDBTest.c
tests/script/api/openTSDBTest.c
+56
-60
tests/script/fullGeneralSuite.sim
tests/script/fullGeneralSuite.sim
+2
-0
tests/script/general/parser/columnName_escape.sim
tests/script/general/parser/columnName_escape.sim
+426
-0
tests/script/general/parser/tagName_escape.sim
tests/script/general/parser/tagName_escape.sim
+186
-0
tests/script/jenkins/basic.txt
tests/script/jenkins/basic.txt
+1
-1
未找到文件。
Jenkinsfile
浏览文件 @
8a358c66
...
...
@@ -413,7 +413,7 @@ pipeline {
stage
(
'test_b4_s7'
)
{
agent
{
label
" slave7 || slave17 "
}
steps
{
timeout
(
time:
5
5
,
unit:
'MINUTES'
){
timeout
(
time:
10
5
,
unit:
'MINUTES'
){
pre_test
()
sh
'''
date
...
...
documentation20/cn/00.index/docs.md
浏览文件 @
8a358c66
...
...
@@ -131,7 +131,7 @@ TDengine是一个高效的存储、查询、分析时序大数据的平台,专
*
[
TDengine写入性能测试工具
](
https://www.taosdata.com/blog/2020/01/18/1166.html
)
*
[
IDEA数据库管理工具可视化使用TDengine
](
https://www.taosdata.com/blog/2020/08/27/1767.html
)
*
[
基于Electron开发的跨平台TDengine图形化管理工具
](
https://github.com/skye0207/TDengineGUI
)
*
[
DataX,支持TDengine的离线数据采集/同步工具
](
https://github.com/wgzhao/DataX
)
(文档:
[
读取插件
](
https://github.com/wgzhao/DataX/blob/master/docs/src/main/sphinx/reader/tdenginereader.md
)
、
[
写入插件
](
https://github.com/wgzhao/DataX/blob/master/docs/src/main/sphinx/writer/tdenginewriter.md
)
)
*
[
基于DataX的TDeninge数据迁移工具
](
https://www.taosdata.com/blog/2021/10/26/3156.html
)
## TDengine与其他数据库的对比测试
...
...
documentation20/cn/03.architecture/docs.md
浏览文件 @
8a358c66
...
...
@@ -382,17 +382,17 @@ dataDir [path] <level> <primary>
各级存储之间的数据流向:0 级存储 -> 1 级存储 -> 2 级存储。
同一存储等级可挂载多个硬盘,同一存储等级上的数据文件分布在该存储等级的所有硬盘上。
需要说明的是,数据在不同级别的存储介质上的移动,是由系统自动完成的,用户无需干预。
-
primary: 是否为主挂载点,0(
是)或 1(否
),省略默认为 1。
-
primary: 是否为主挂载点,0(
否)或 1(是
),省略默认为 1。
在配置中,只允许一个主挂载点的存在(level=0, primary=
0
),例如采用如下的配置方式:
在配置中,只允许一个主挂载点的存在(level=0, primary=
1
),例如采用如下的配置方式:
```
dataDir /mnt/data1 0
0
dataDir /mnt/data2 0
1
dataDir /mnt/data3 1
1
dataDir /mnt/data4 1
1
dataDir /mnt/data5 2
1
dataDir /mnt/data6 2
1
dataDir /mnt/data1 0
1
dataDir /mnt/data2 0
0
dataDir /mnt/data3 1
0
dataDir /mnt/data4 1
0
dataDir /mnt/data5 2
0
dataDir /mnt/data6 2
0
```
注意:
...
...
documentation20/cn/08.connector/docs.md
浏览文件 @
8a358c66
...
...
@@ -405,45 +405,45 @@ typedef struct TAOS_MULTI_BIND {
<a
class=
"anchor"
id=
"schemaless"
></a>
### Schemaless 方式写入接口
除了使用 SQL 方式或者使用参数绑定 API 写入数据外,还可以使用 Schemaless 的方式完成写入。Schemaless 可以免于预先创建超级表/数据子表的数据结构,而是可以直接写入数据,TDengine 系统会根据写入的数据内容自动创建和维护所需要的表结构。Schemaless 的使用方式详见
[
Schemaless 写入
](
https://www.taosdata.com/cn/documentation/insert#schemaless
)
章节,这里介绍与之配套使用的 C/C++ API。
2.
2.0.0版本接口:
-
`int taos_insert_lines(TAOS* taos, char* lines[], int numLines)`
以 Schemaless 格式写入多行数据。其中:
*
taos:调用 taos_connect 返回的数据库连接。
*
lines:由 char 字符串指针组成的数组,指向本次想要写入数据库的多行数据。
*
numLines:lines 数据的总行数。
返回值为 0 表示写入成功,非零值表示出错。具体错误代码请参见
[
taoserror.h
](
https://github.com/taosdata/TDengine/blob/develop/src/inc/taoserror.h
)
文件。
说明:
1.
此接口是一个同步阻塞式接口,使用时机与
`taos_query()`
一致。
2.
在调用此接口之前,必须先调用
`taos_select_db()`
来确定目前是在向哪个 DB 来写入。
2.
3.0.0版本接口:
-
`int taos_schemaless_insert(TAOS* taos, const char* lines[], int numLines, int protocol, const char* precision, int* affectedRows, char* msg, int msgBufLen)`
**参数说明**
taos: 数据库连接,通过taos_connect 函数建立的数据库连接。
lines:文本数据。满足解析格式要求的无模式文本字符串。
numLines:文本数据的行数,不能为 0 。
protocol: 行协议类型,用于标识文本数据格式。
precision:文本数据中的时间戳精度字符串。
affectedRows:插入操作完成以后,正确写入到数据库中的记录行数。
msg: 如果出现错误(函数返回值不为 0)情况下,错误提示信息。该参数是输入参数,需要用户指定消息输出缓冲区,如果不指定该缓冲区(输入为NULL),即使出现错误也不会得到错误提示信息。
msgBufLen: 缓冲区的长度,避免错误提示消息越界。
**返回值**
0:无错误发生。
非 0 值:发生了错误。此时可以通过msg获取错误信息的提示。该返回值含义可以参考taoserror.h文件中的错误码定义。
除了使用 SQL 方式或者使用参数绑定 API 写入数据外,还可以使用 Schemaless 的方式完成写入。Schemaless 可以免于预先创建超级表/数据子表的数据结构,而是可以直接写入数据,TDengine 系统会根据写入的数据内容自动创建和维护所需要的表结构。Schemaless 的使用方式详见
[
Schemaless 写入
](
https://www.taosdata.com/cn/documentation/insert#schemaless
)
章节,这里介绍与之配套使用的 C/C++ API。
-
`TAOS_RES* taos_schemaless_insert(TAOS* taos, const char* lines[], int numLines, int protocol, int precision)`
**说明**
协议类型是枚举类型,包含以下三种格式:
SML_LINE_PROTOCOL:InfluxDB行协议(Line Protocol)
SML_TELNET_PROTOCOL: OpenTSDB文本行协议
SML_JSON_PROTOCOL: OpenTSDB Json协议格式
**功能说明**
该接口将行协议的文本数据写入到TDengine中。
**参数说明**
taos: 数据库连接,通过taos_connect 函数建立的数据库连接。
lines:文本数据。满足解析格式要求的无模式文本字符串。
numLines:文本数据的行数,不能为 0 。
protocol: 行协议类型,用于标识文本数据格式。
precision:文本数据中的时间戳精度字符串。
**返回值**
TAOS_RES 结构体,应用可以通过使用 taos_errstr 获得错误信息,也可以使用 taos_errno 获得错误码。
在某些情况下,返回的 TAOS_RES 为 NULL,此时仍然可以调用 taos_errno 来安全地获得错误码信息。
返回的 TAOS_RES 需要调用方来负责释放,否则会出现内存泄漏。
**说明**
协议类型是枚举类型,包含以下三种格式:
TSDB_SML_LINE_PROTOCOL:InfluxDB行协议(Line Protocol)
TSDB_SML_TELNET_PROTOCOL: OpenTSDB文本行协议
TSDB_SML_JSON_PROTOCOL: OpenTSDB Json协议格式
时间戳分辨率的定义,定义在 taos.h 文件中,具体内容如下:
TSDB_SML_TIMESTAMP_NOT_CONFIGURED = 0,
TSDB_SML_TIMESTAMP_HOURS,
TSDB_SML_TIMESTAMP_MINUTES,
TSDB_SML_TIMESTAMP_SECONDS,
TSDB_SML_TIMESTAMP_MILLI_SECONDS,
TSDB_SML_TIMESTAMP_MICRO_SECONDS,
TSDB_SML_TIMESTAMP_NANO_SECONDS
时间戳分辨率的说明使用如下字符串:“h“ (小时)、”m“(分钟)、”s“ (秒) ”ms“(毫秒)、”u“ (微秒)、”ns”(纳秒),不区分大小写。需要注意的是,时间戳分辨率参数只在协议类型为 SML_LINE_PROTOCOL 的时候生效。对于 OpenTSDB的文本协议,时间戳的解析遵循其官方解析规则 — 按照时间戳包含的字符的数量来确认时间精度。
需要注意的是,时间戳分辨率参数只在协议类型为 SML_LINE_PROTOCOL 的时候生效。
对于 OpenTSDB 的文本协议,时间戳的解析遵循其官方解析规则 — 按照时间戳包含的字符的数量来确认时间精度。
**支持版本**
该功能接口从2.3.0.0版本开始支持。
```
c
#include <stdlib.h>
...
...
@@ -454,10 +454,7 @@ int main() {
const
char
*
host
=
"127.0.0.1"
;
const
char
*
user
=
"root"
;
const
char
*
passwd
=
"taosdata"
;
// error message buffer
char
msg
[
512
]
=
{
0
};
// connect to server
TAOS
*
taos
=
taos_connect
(
host
,
user
,
passwd
,
"test"
,
0
);
...
...
@@ -468,17 +465,18 @@ int main() {
};
// schema-less insert
int
code
=
taos_schemaless_insert
(
taos
,
lines1
,
2
,
SML_LINE_PROTOCOL
,
"ns"
,
msg
,
sizeof
(
msg
)
/
sizeof
(
msg
[
0
])
);
if
(
code
!=
0
)
{
printf
(
"failed to insert schema-less data, reason: %s
\n
"
,
msg
);
TAOS_RES
*
res
=
taos_schemaless_insert
(
taos
,
lines1
,
2
,
TSDB_SML_LINE_PROTOCOL
,
TSDB_SML_TIMESTAMP_NANO_SECONDS
);
if
(
taos_errno
(
res
)
!=
0
)
{
printf
(
"failed to insert schema-less data, reason: %s
\n
"
,
taos_errstr
(
res
)
);
}
taos_free_result
(
res
);
// close the connection
taos_close
(
taos
);
return
(
code
);
}
```
**注**
:后续2.2.0.0版本也更新成2.3.0.0版本的接口。
### 连续查询接口
...
...
documentation20/cn/12.taos-sql/docs.md
浏览文件 @
8a358c66
...
...
@@ -1579,11 +1579,11 @@ SELECT function_list FROM stb_name
CREATE TABLE meters (ts TIMESTAMP, current FLOAT, voltage INT, phase FLOAT) TAGS (location BINARY(64), groupId INT);
```
针对智能电表采集的数据,以 10 分钟为一个阶段,计算过去 24 小时的电流数据的平均值、最大值、电流的中位数
、以及随着时间变化的电流走势拟合直线
。如果没有计算值,用前一个非 NULL 值填充。使用的查询语句如下:
针对智能电表采集的数据,以 10 分钟为一个阶段,计算过去 24 小时的电流数据的平均值、最大值、电流的中位数。如果没有计算值,用前一个非 NULL 值填充。使用的查询语句如下:
```
mysql
SELECT AVG(current), MAX(current),
LEASTSQUARES(current, start_val, step_val),
PERCENTILE(current, 50) FROM meters
WHERE ts>=NOW-1d
SELECT AVG(current), MAX(current),
A
PERCENTILE(current, 50) FROM meters
WHERE ts>=NOW-1d
and ts<=now
INTERVAL(10m)
FILL(PREV);
```
...
...
packaging/release.sh
浏览文件 @
8a358c66
...
...
@@ -213,7 +213,7 @@ else
exit
1
fi
make
-j8
make
cd
${
curr_dir
}
...
...
src/client/inc/tscParseLine.h
浏览文件 @
8a358c66
...
...
@@ -67,6 +67,7 @@ typedef struct {
int64_t
affectedRows
;
}
SSmlLinesInfo
;
void
addEscapeCharToString
(
char
*
str
,
int32_t
len
);
int
tscSmlInsert
(
TAOS
*
taos
,
TAOS_SML_DATA_POINT
*
points
,
int
numPoint
,
SSmlLinesInfo
*
info
);
bool
checkDuplicateKey
(
char
*
key
,
SHashObj
*
pHash
,
SSmlLinesInfo
*
info
);
bool
isValidInteger
(
char
*
str
);
...
...
src/client/inc/tscUtil.h
浏览文件 @
8a358c66
...
...
@@ -251,6 +251,7 @@ void tscColumnListCopyAll(SArray* dst, const SArray* src);
void
convertQueryResult
(
SSqlRes
*
pRes
,
SQueryInfo
*
pQueryInfo
,
uint64_t
objId
,
bool
convertNchar
);
void
tscDequoteAndTrimToken
(
SStrToken
*
pToken
);
void
tscRmEscapeAndTrimToken
(
SStrToken
*
pToken
);
int32_t
tscValidateName
(
SStrToken
*
pToken
,
bool
escapeEnabled
,
bool
*
dbIncluded
);
void
tscIncStreamExecutionCount
(
void
*
pStream
);
...
...
src/client/jni/com_alibaba_datax_plugin_writer_JniConnection.h
0 → 100644
浏览文件 @
8a358c66
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class com_alibaba_datax_plugin_writer_JniConnection */
#ifndef _Included_com_alibaba_datax_plugin_writer_JniConnection
#define _Included_com_alibaba_datax_plugin_writer_JniConnection
#ifdef __cplusplus
extern
"C"
{
#endif
#undef com_alibaba_datax_plugin_writer_JniConnection_JNI_NULL_POINTER
#define com_alibaba_datax_plugin_writer_JniConnection_JNI_NULL_POINTER 0LL
#undef com_alibaba_datax_plugin_writer_JniConnection_JNI_SUCCESSFUL
#define com_alibaba_datax_plugin_writer_JniConnection_JNI_SUCCESSFUL 0L
/*
* Class: com_alibaba_datax_plugin_writer_JniConnection
* Method: initImp
* Signature: (Ljava/lang/String;)V
*/
JNIEXPORT
void
JNICALL
Java_com_alibaba_datax_plugin_writer_JniConnection_initImp
(
JNIEnv
*
,
jclass
,
jstring
);
/*
* Class: com_alibaba_datax_plugin_writer_JniConnection
* Method: setOptions
* Signature: (ILjava/lang/String;)I
*/
JNIEXPORT
jint
JNICALL
Java_com_alibaba_datax_plugin_writer_JniConnection_setOptions
(
JNIEnv
*
,
jclass
,
jint
,
jstring
);
/*
* Class: com_alibaba_datax_plugin_writer_JniConnection
* Method: connectImp
* Signature: (Ljava/lang/String;ILjava/lang/String;Ljava/lang/String;Ljava/lang/String;)J
*/
JNIEXPORT
jlong
JNICALL
Java_com_alibaba_datax_plugin_writer_JniConnection_connectImp
(
JNIEnv
*
,
jobject
,
jstring
,
jint
,
jstring
,
jstring
,
jstring
);
/*
* Class: com_alibaba_datax_plugin_writer_JniConnection
* Method: getErrCodeImp
* Signature: (JJ)I
*/
JNIEXPORT
jint
JNICALL
Java_com_alibaba_datax_plugin_writer_JniConnection_getErrCodeImp
(
JNIEnv
*
,
jobject
,
jlong
,
jlong
);
/*
* Class: com_alibaba_datax_plugin_writer_JniConnection
* Method: getErrMsgImp
* Signature: (J)Ljava/lang/String;
*/
JNIEXPORT
jstring
JNICALL
Java_com_alibaba_datax_plugin_writer_JniConnection_getErrMsgImp
(
JNIEnv
*
,
jobject
,
jlong
);
/*
* Class: com_alibaba_datax_plugin_writer_JniConnection
* Method: freeResultSetImp
* Signature: (JJ)V
*/
JNIEXPORT
void
JNICALL
Java_com_alibaba_datax_plugin_writer_JniConnection_freeResultSetImp
(
JNIEnv
*
,
jobject
,
jlong
,
jlong
);
/*
* Class: com_alibaba_datax_plugin_writer_JniConnection
* Method: closeConnectionImp
* Signature: (J)I
*/
JNIEXPORT
jint
JNICALL
Java_com_alibaba_datax_plugin_writer_JniConnection_closeConnectionImp
(
JNIEnv
*
,
jobject
,
jlong
);
/*
* Class: com_alibaba_datax_plugin_writer_JniConnection
* Method: insertOpentsdbJson
* Signature: (Ljava/lang/String;J)J
*/
JNIEXPORT
jlong
JNICALL
Java_com_alibaba_datax_plugin_writer_JniConnection_insertOpentsdbJson
(
JNIEnv
*
,
jobject
,
jstring
,
jlong
);
#ifdef __cplusplus
}
#endif
#endif
src/client/jni/jniCommon.h
0 → 100644
浏览文件 @
8a358c66
#include <jni.h>
#ifndef TDENGINE_JNICOMMON_H
#define TDENGINE_JNICOMMON_H
#define jniFatal(...) \
{ \
if (jniDebugFlag & DEBUG_FATAL) { \
taosPrintLog("JNI FATAL ", tscEmbedded ? 255 : jniDebugFlag, __VA_ARGS__); \
} \
}
#define jniError(...) \
{ \
if (jniDebugFlag & DEBUG_ERROR) { \
taosPrintLog("JNI ERROR ", tscEmbedded ? 255 : jniDebugFlag, __VA_ARGS__); \
} \
}
#define jniWarn(...) \
{ \
if (jniDebugFlag & DEBUG_WARN) { \
taosPrintLog("JNI WARN ", tscEmbedded ? 255 : jniDebugFlag, __VA_ARGS__); \
} \
}
#define jniInfo(...) \
{ \
if (jniDebugFlag & DEBUG_INFO) { \
taosPrintLog("JNI ", tscEmbedded ? 255 : jniDebugFlag, __VA_ARGS__); \
} \
}
#define jniDebug(...) \
{ \
if (jniDebugFlag & DEBUG_DEBUG) { \
taosPrintLog("JNI ", jniDebugFlag, __VA_ARGS__); \
} \
}
#define jniTrace(...) \
{ \
if (jniDebugFlag & DEBUG_TRACE) { \
taosPrintLog("JNI ", jniDebugFlag, __VA_ARGS__); \
} \
}
extern
jclass
g_arrayListClass
;
extern
jmethodID
g_arrayListConstructFp
;
extern
jmethodID
g_arrayListAddFp
;
extern
jclass
g_metadataClass
;
extern
jmethodID
g_metadataConstructFp
;
extern
jfieldID
g_metadataColtypeField
;
extern
jfieldID
g_metadataColnameField
;
extern
jfieldID
g_metadataColsizeField
;
extern
jfieldID
g_metadataColindexField
;
extern
jclass
g_rowdataClass
;
extern
jmethodID
g_rowdataConstructor
;
extern
jmethodID
g_rowdataClearFp
;
extern
jmethodID
g_rowdataSetBooleanFp
;
extern
jmethodID
g_rowdataSetByteFp
;
extern
jmethodID
g_rowdataSetShortFp
;
extern
jmethodID
g_rowdataSetIntFp
;
extern
jmethodID
g_rowdataSetLongFp
;
extern
jmethodID
g_rowdataSetFloatFp
;
extern
jmethodID
g_rowdataSetDoubleFp
;
extern
jmethodID
g_rowdataSetStringFp
;
extern
jmethodID
g_rowdataSetTimestampFp
;
extern
jmethodID
g_rowdataSetByteArrayFp
;
extern
jmethodID
g_blockdataSetByteArrayFp
;
extern
jmethodID
g_blockdataSetNumOfRowsFp
;
extern
jmethodID
g_blockdataSetNumOfColsFp
;
#define JNI_SUCCESS 0
#define JNI_TDENGINE_ERROR -1
#define JNI_CONNECTION_NULL -2
#define JNI_RESULT_SET_NULL -3
#define JNI_NUM_OF_FIELDS_0 -4
#define JNI_SQL_NULL -5
#define JNI_FETCH_END -6
#define JNI_OUT_OF_MEMORY -7
extern
JavaVM
*
g_vm
;
void
jniGetGlobalMethod
(
JNIEnv
*
env
);
int32_t
check_for_params
(
jobject
jobj
,
jlong
conn
,
jlong
res
);
#endif // TDENGINE_JNICOMMON_H
src/client/src/TSDBJNIConnector.c
浏览文件 @
8a358c66
...
...
@@ -17,46 +17,9 @@
#include "taos.h"
#include "tlog.h"
#include "tscUtil.h"
#include "tscParseLine.h"
#include "com_taosdata_jdbc_TSDBJNIConnector.h"
#define jniFatal(...) \
{ \
if (jniDebugFlag & DEBUG_FATAL) { \
taosPrintLog("JNI FATAL ", tscEmbedded ? 255 : jniDebugFlag, __VA_ARGS__); \
} \
}
#define jniError(...) \
{ \
if (jniDebugFlag & DEBUG_ERROR) { \
taosPrintLog("JNI ERROR ", tscEmbedded ? 255 : jniDebugFlag, __VA_ARGS__); \
} \
}
#define jniWarn(...) \
{ \
if (jniDebugFlag & DEBUG_WARN) { \
taosPrintLog("JNI WARN ", tscEmbedded ? 255 : jniDebugFlag, __VA_ARGS__); \
} \
}
#define jniInfo(...) \
{ \
if (jniDebugFlag & DEBUG_INFO) { \
taosPrintLog("JNI ", tscEmbedded ? 255 : jniDebugFlag, __VA_ARGS__); \
} \
}
#define jniDebug(...) \
{ \
if (jniDebugFlag & DEBUG_DEBUG) { \
taosPrintLog("JNI ", jniDebugFlag, __VA_ARGS__); \
} \
}
#define jniTrace(...) \
{ \
if (jniDebugFlag & DEBUG_TRACE) { \
taosPrintLog("JNI ", jniDebugFlag, __VA_ARGS__); \
} \
}
#include "jniCommon.h"
int
__init
=
0
;
...
...
@@ -91,16 +54,7 @@ jmethodID g_blockdataSetByteArrayFp;
jmethodID
g_blockdataSetNumOfRowsFp
;
jmethodID
g_blockdataSetNumOfColsFp
;
#define JNI_SUCCESS 0
#define JNI_TDENGINE_ERROR -1
#define JNI_CONNECTION_NULL -2
#define JNI_RESULT_SET_NULL -3
#define JNI_NUM_OF_FIELDS_0 -4
#define JNI_SQL_NULL -5
#define JNI_FETCH_END -6
#define JNI_OUT_OF_MEMORY -7
static
void
jniGetGlobalMethod
(
JNIEnv
*
env
)
{
void
jniGetGlobalMethod
(
JNIEnv
*
env
)
{
// make sure init function executed once
switch
(
atomic_val_compare_exchange_32
(
&
__init
,
0
,
1
))
{
case
0
:
...
...
@@ -159,7 +113,7 @@ static void jniGetGlobalMethod(JNIEnv *env) {
jniDebug
(
"native method register finished"
);
}
static
int32_t
check_for_params
(
jobject
jobj
,
jlong
conn
,
jlong
res
)
{
int32_t
check_for_params
(
jobject
jobj
,
jlong
conn
,
jlong
res
)
{
if
((
TAOS
*
)
conn
==
NULL
)
{
jniError
(
"jobj:%p, connection is closed"
,
jobj
);
return
JNI_CONNECTION_NULL
;
...
...
@@ -219,26 +173,8 @@ JNIEXPORT jobject createTSDBException(JNIEnv *env, int code, char *msg) {
return
exception_obj
;
}
/*
* Class: com_taosdata_jdbc_TSDBJNIConnector
* Method: setConfigImp
* Signature: (Ljava/lang/String;)Lcom/taosdata/jdbc/TSDBException;
*/
JNIEXPORT
jobject
JNICALL
Java_com_taosdata_jdbc_TSDBJNIConnector_setConfigImp
(
JNIEnv
*
env
,
jclass
jobj
,
jstring
config
)
{
/*
if (config == NULL) {
jniDebug("config value is null");
return -1;
}
const char *cfg = (*env)->GetStringUTFChars(env, config, NULL);
if (!cfg) {
return -1;
}
return 0;
*/
if
(
config
==
NULL
)
{
char
*
msg
=
"config value is null"
;
jniDebug
(
"config value is null"
);
...
...
@@ -254,7 +190,7 @@ JNIEXPORT jobject JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_setConfigImp(J
setConfRet
result
=
taos_set_config
(
cfg
);
int
code
=
result
.
retCode
;
char
*
msg
=
result
.
retMsg
;
char
*
msg
=
result
.
retMsg
;
return
createTSDBException
(
env
,
code
,
msg
);
}
...
...
@@ -424,7 +360,7 @@ JNIEXPORT jstring JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_getErrMsgImp(J
JNIEXPORT
jlong
JNICALL
Java_com_taosdata_jdbc_TSDBJNIConnector_getResultSetImp
(
JNIEnv
*
env
,
jobject
jobj
,
jlong
con
,
jlong
tres
)
{
TAOS
*
tscon
=
(
TAOS
*
)
con
;
TAOS
*
tscon
=
(
TAOS
*
)
con
;
int32_t
code
=
check_for_params
(
jobj
,
con
,
tres
);
if
(
code
!=
JNI_SUCCESS
)
{
return
code
;
...
...
@@ -467,7 +403,7 @@ JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_freeResultSetImp(
JNIEXPORT
jint
JNICALL
Java_com_taosdata_jdbc_TSDBJNIConnector_getAffectedRowsImp
(
JNIEnv
*
env
,
jobject
jobj
,
jlong
con
,
jlong
res
)
{
TAOS
*
tscon
=
(
TAOS
*
)
con
;
TAOS
*
tscon
=
(
TAOS
*
)
con
;
int32_t
code
=
check_for_params
(
jobj
,
con
,
res
);
if
(
code
!=
JNI_SUCCESS
)
{
return
code
;
...
...
@@ -483,13 +419,13 @@ JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_getAffectedRowsIm
JNIEXPORT
jint
JNICALL
Java_com_taosdata_jdbc_TSDBJNIConnector_getSchemaMetaDataImp
(
JNIEnv
*
env
,
jobject
jobj
,
jlong
con
,
jlong
res
,
jobject
arrayListObj
)
{
TAOS
*
tscon
=
(
TAOS
*
)
con
;
TAOS
*
tscon
=
(
TAOS
*
)
con
;
int32_t
code
=
check_for_params
(
jobj
,
con
,
res
);
if
(
code
!=
JNI_SUCCESS
)
{
return
code
;
}
TAOS_RES
*
tres
=
(
TAOS_RES
*
)
res
;
TAOS_RES
*
tres
=
(
TAOS_RES
*
)
res
;
TAOS_FIELD
*
fields
=
taos_fetch_fields
(
tres
);
int32_t
num_fields
=
taos_num_fields
(
tres
);
...
...
@@ -626,13 +562,13 @@ JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_fetchRowImp(JNIEn
JNIEXPORT
jint
JNICALL
Java_com_taosdata_jdbc_TSDBJNIConnector_fetchBlockImp
(
JNIEnv
*
env
,
jobject
jobj
,
jlong
con
,
jlong
res
,
jobject
rowobj
)
{
TAOS
*
tscon
=
(
TAOS
*
)
con
;
TAOS
*
tscon
=
(
TAOS
*
)
con
;
int32_t
code
=
check_for_params
(
jobj
,
con
,
res
);
if
(
code
!=
JNI_SUCCESS
)
{
return
code
;
}
TAOS_RES
*
tres
=
(
TAOS_RES
*
)
res
;
TAOS_RES
*
tres
=
(
TAOS_RES
*
)
res
;
TAOS_FIELD
*
fields
=
taos_fetch_fields
(
tres
);
int32_t
numOfFields
=
taos_num_fields
(
tres
);
...
...
@@ -1021,7 +957,7 @@ JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_setTableNameTagsI
}
const
char
*
name
=
(
*
env
)
->
GetStringUTFChars
(
env
,
tableName
,
NULL
);
char
*
curTags
=
tagsData
;
char
*
curTags
=
tagsData
;
TAOS_BIND
*
tagsBind
=
calloc
(
numOfTags
,
sizeof
(
TAOS_BIND
));
for
(
int32_t
i
=
0
;
i
<
numOfTags
;
++
i
)
{
...
...
src/client/src/dataxJniConnection.c
0 → 100644
浏览文件 @
8a358c66
#include "os.h"
#include "taos.h"
#include "tlog.h"
#include "tscUtil.h"
#include "com_alibaba_datax_plugin_writer_JniConnection.h"
#include "jniCommon.h"
jclass
g_arrayListClass
;
jmethodID
g_arrayListConstructFp
;
jmethodID
g_arrayListAddFp
;
jclass
g_metadataClass
;
jmethodID
g_metadataConstructFp
;
jfieldID
g_metadataColtypeField
;
jfieldID
g_metadataColnameField
;
jfieldID
g_metadataColsizeField
;
jfieldID
g_metadataColindexField
;
jclass
g_rowdataClass
;
jmethodID
g_rowdataConstructor
;
jmethodID
g_rowdataClearFp
;
jmethodID
g_rowdataSetBooleanFp
;
jmethodID
g_rowdataSetByteFp
;
jmethodID
g_rowdataSetShortFp
;
jmethodID
g_rowdataSetIntFp
;
jmethodID
g_rowdataSetLongFp
;
jmethodID
g_rowdataSetFloatFp
;
jmethodID
g_rowdataSetDoubleFp
;
jmethodID
g_rowdataSetStringFp
;
jmethodID
g_rowdataSetTimestampFp
;
jmethodID
g_rowdataSetByteArrayFp
;
jmethodID
g_blockdataSetByteArrayFp
;
jmethodID
g_blockdataSetNumOfRowsFp
;
jmethodID
g_blockdataSetNumOfColsFp
;
JNIEXPORT
void
JNICALL
Java_com_alibaba_datax_plugin_writer_JniConnection_initImp
(
JNIEnv
*
env
,
jobject
jobj
,
jstring
jconfigDir
)
{
if
(
jconfigDir
!=
NULL
)
{
const
char
*
confDir
=
(
*
env
)
->
GetStringUTFChars
(
env
,
jconfigDir
,
NULL
);
if
(
confDir
&&
strlen
(
confDir
)
!=
0
)
{
tstrncpy
(
configDir
,
confDir
,
TSDB_FILENAME_LEN
);
}
(
*
env
)
->
ReleaseStringUTFChars
(
env
,
jconfigDir
,
confDir
);
}
jniDebug
(
"jni initialized successfully, config directory: %s"
,
configDir
);
}
JNIEXPORT
jint
JNICALL
Java_com_alibaba_datax_plugin_writer_JniConnection_setOptions
(
JNIEnv
*
env
,
jobject
jobj
,
jint
optionIndex
,
jstring
optionValue
)
{
if
(
optionValue
==
NULL
)
{
jniDebug
(
"option index:%d value is null"
,
(
int32_t
)
optionIndex
);
return
0
;
}
int
res
=
0
;
if
(
optionIndex
==
TSDB_OPTION_LOCALE
)
{
const
char
*
locale
=
(
*
env
)
->
GetStringUTFChars
(
env
,
optionValue
,
NULL
);
if
(
locale
&&
strlen
(
locale
)
!=
0
)
{
res
=
taos_options
(
TSDB_OPTION_LOCALE
,
locale
);
jniDebug
(
"set locale to %s, result:%d"
,
locale
,
res
);
}
else
{
jniDebug
(
"input locale is empty"
);
}
(
*
env
)
->
ReleaseStringUTFChars
(
env
,
optionValue
,
locale
);
}
else
if
(
optionIndex
==
TSDB_OPTION_CHARSET
)
{
const
char
*
charset
=
(
*
env
)
->
GetStringUTFChars
(
env
,
optionValue
,
NULL
);
if
(
charset
&&
strlen
(
charset
)
!=
0
)
{
res
=
taos_options
(
TSDB_OPTION_CHARSET
,
charset
);
jniDebug
(
"set character encoding to %s, result:%d"
,
charset
,
res
);
}
else
{
jniDebug
(
"input character encoding is empty"
);
}
(
*
env
)
->
ReleaseStringUTFChars
(
env
,
optionValue
,
charset
);
}
else
if
(
optionIndex
==
TSDB_OPTION_TIMEZONE
)
{
const
char
*
tz1
=
(
*
env
)
->
GetStringUTFChars
(
env
,
optionValue
,
NULL
);
if
(
tz1
&&
strlen
(
tz1
)
!=
0
)
{
res
=
taos_options
(
TSDB_OPTION_TIMEZONE
,
tz1
);
jniDebug
(
"set timezone to %s, result:%d"
,
tz1
,
res
);
}
else
{
jniDebug
(
"input timezone is empty"
);
}
(
*
env
)
->
ReleaseStringUTFChars
(
env
,
optionValue
,
tz1
);
}
else
{
jniError
(
"option index:%d is not found"
,
(
int32_t
)
optionIndex
);
}
return
res
;
}
JNIEXPORT
jlong
JNICALL
Java_com_alibaba_datax_plugin_writer_JniConnection_connectImp
(
JNIEnv
*
env
,
jobject
jobj
,
jstring
jhost
,
jint
jport
,
jstring
jdbName
,
jstring
juser
,
jstring
jpass
)
{
jlong
ret
=
0
;
const
char
*
host
=
NULL
;
const
char
*
user
=
NULL
;
const
char
*
pass
=
NULL
;
const
char
*
dbname
=
NULL
;
if
(
jhost
!=
NULL
)
{
host
=
(
*
env
)
->
GetStringUTFChars
(
env
,
jhost
,
NULL
);
}
if
(
jdbName
!=
NULL
)
{
dbname
=
(
*
env
)
->
GetStringUTFChars
(
env
,
jdbName
,
NULL
);
}
if
(
juser
!=
NULL
)
{
user
=
(
*
env
)
->
GetStringUTFChars
(
env
,
juser
,
NULL
);
}
if
(
jpass
!=
NULL
)
{
pass
=
(
*
env
)
->
GetStringUTFChars
(
env
,
jpass
,
NULL
);
}
if
(
user
==
NULL
)
{
jniDebug
(
"jobj:%p, user not specified, use default user %s"
,
jobj
,
TSDB_DEFAULT_USER
);
}
if
(
pass
==
NULL
)
{
jniDebug
(
"jobj:%p, pass not specified, use default password"
,
jobj
);
}
ret
=
(
jlong
)
taos_connect
((
char
*
)
host
,
(
char
*
)
user
,
(
char
*
)
pass
,
(
char
*
)
dbname
,
(
uint16_t
)
jport
);
if
(
ret
==
0
)
{
jniError
(
"jobj:%p, conn:%p, connect to database failed, host=%s, user=%s, dbname=%s, port=%d"
,
jobj
,
(
void
*
)
ret
,
(
char
*
)
host
,
(
char
*
)
user
,
(
char
*
)
dbname
,
(
int32_t
)
jport
);
}
else
{
jniDebug
(
"jobj:%p, conn:%p, connect to database succeed, host=%s, user=%s, dbname=%s, port=%d"
,
jobj
,
(
void
*
)
ret
,
(
char
*
)
host
,
(
char
*
)
user
,
(
char
*
)
dbname
,
(
int32_t
)
jport
);
}
if
(
host
!=
NULL
)
{
(
*
env
)
->
ReleaseStringUTFChars
(
env
,
jhost
,
host
);
}
if
(
dbname
!=
NULL
)
{
(
*
env
)
->
ReleaseStringUTFChars
(
env
,
jdbName
,
dbname
);
}
if
(
user
!=
NULL
)
{
(
*
env
)
->
ReleaseStringUTFChars
(
env
,
juser
,
user
);
}
if
(
pass
!=
NULL
)
{
(
*
env
)
->
ReleaseStringUTFChars
(
env
,
jpass
,
pass
);
}
return
ret
;
}
JNIEXPORT
jint
JNICALL
Java_com_alibaba_datax_plugin_writer_JniConnection_getErrCodeImp
(
JNIEnv
*
env
,
jobject
jobj
,
jlong
con
,
jlong
tres
)
{
int32_t
code
=
check_for_params
(
jobj
,
con
,
tres
);
if
(
code
!=
JNI_SUCCESS
)
{
return
code
;
}
return
(
jint
)
taos_errno
((
TAOS_RES
*
)
tres
);
}
JNIEXPORT
jstring
JNICALL
Java_com_alibaba_datax_plugin_writer_JniConnection_getErrMsgImp
(
JNIEnv
*
env
,
jobject
jobj
,
jlong
tres
)
{
TAOS_RES
*
pSql
=
(
TAOS_RES
*
)
tres
;
return
(
*
env
)
->
NewStringUTF
(
env
,
(
const
char
*
)
taos_errstr
(
pSql
));
}
JNIEXPORT
void
JNICALL
Java_com_alibaba_datax_plugin_writer_JniConnection_freeResultSetImp
(
JNIEnv
*
env
,
jobject
jobj
,
jlong
con
,
jlong
res
)
{
if
((
TAOS
*
)
con
==
NULL
)
{
jniError
(
"jobj:%p, connection is closed"
,
jobj
);
}
if
((
TAOS_RES
*
)
res
==
NULL
)
{
jniError
(
"jobj:%p, conn:%p, res is null"
,
jobj
,
(
TAOS
*
)
con
);
}
taos_free_result
((
TAOS_RES
*
)
res
);
jniDebug
(
"jobj:%p, conn:%p, free resultset:%p"
,
jobj
,
(
TAOS
*
)
con
,
(
void
*
)
res
);
}
JNIEXPORT
jint
JNICALL
Java_com_alibaba_datax_plugin_writer_JniConnection_closeConnectionImp
(
JNIEnv
*
env
,
jobject
jobj
,
jlong
con
)
{
TAOS
*
tscon
=
(
TAOS
*
)
con
;
if
(
tscon
==
NULL
)
{
jniError
(
"jobj:%p, connection is already closed"
,
jobj
);
return
JNI_CONNECTION_NULL
;
}
else
{
jniDebug
(
"jobj:%p, conn:%p, close connection success"
,
jobj
,
tscon
);
taos_close
(
tscon
);
return
JNI_SUCCESS
;
}
}
JNIEXPORT
jlong
JNICALL
Java_com_alibaba_datax_plugin_writer_JniConnection_insertOpentsdbJson
(
JNIEnv
*
env
,
jobject
jobj
,
jstring
json
,
jlong
con
)
{
// check connection
TAOS
*
conn
=
(
TAOS
*
)
con
;
if
(
conn
==
NULL
)
{
jniError
(
"jobj:%p, connection already closed"
,
jobj
);
return
JNI_CONNECTION_NULL
;
}
// java.lang.String -> char *
char
*
payload
=
NULL
;
if
(
json
!=
NULL
)
{
payload
=
(
char
*
)(
*
env
)
->
GetStringUTFChars
(
env
,
json
,
NULL
);
}
// check payload
if
(
payload
==
NULL
)
{
jniDebug
(
"jobj:%p, invalid argument: opentsdb insert json is NULL"
,
jobj
);
return
JNI_SQL_NULL
;
}
// schemaless insert
char
*
payload_arr
[
1
];
payload_arr
[
0
]
=
payload
;
TAOS_RES
*
result
;
result
=
taos_schemaless_insert
(
conn
,
payload_arr
,
0
,
TSDB_SML_JSON_PROTOCOL
,
TSDB_SML_TIMESTAMP_NOT_CONFIGURED
);
int
code
=
taos_errno
(
result
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
jniError
(
"jobj:%p, conn:%p, code:%s, msg:%s"
,
jobj
,
conn
,
tstrerror
(
code
),
taos_errstr
(
result
));
}
else
{
int32_t
affectRows
=
taos_affected_rows
(
result
);
jniDebug
(
"jobj:%p, conn:%p, code:%s, affect rows:%d"
,
jobj
,
conn
,
tstrerror
(
code
),
affectRows
);
}
(
*
env
)
->
ReleaseStringUTFChars
(
env
,
json
,
payload
);
return
(
jlong
)
result
;
}
\ No newline at end of file
src/client/src/taos.def
浏览文件 @
8a358c66
...
...
@@ -51,3 +51,4 @@ taos_stmt_bind_param_batch
taos_stmt_bind_single_param_batch
taos_is_null
taos_insert_lines
taos_schemaless_insert
src/client/src/tscParseInsert.c
浏览文件 @
8a358c66
...
...
@@ -1251,10 +1251,18 @@ static int32_t parseBoundColumns(SInsertStatementParam *pInsertParam, SParsedDat
sToken
=
tStrGetToken
(
str
,
&
index
,
false
);
str
+=
index
;
char
tmpTokenBuf
[
TSDB_MAX_BYTES_PER_ROW
]
=
{
0
};
// used for deleting Escape character backstick(`)
strncpy
(
tmpTokenBuf
,
sToken
.
z
,
sToken
.
n
);
sToken
.
z
=
tmpTokenBuf
;
if
(
TK_STRING
==
sToken
.
type
)
{
tscDequoteAndTrimToken
(
&
sToken
);
}
if
(
TK_ID
==
sToken
.
type
)
{
tscRmEscapeAndTrimToken
(
&
sToken
);
}
if
(
sToken
.
type
==
TK_RP
)
{
if
(
end
!=
NULL
)
{
// set the end position
*
end
=
str
;
...
...
src/client/src/tscParseLineProtocol.c
浏览文件 @
8a358c66
...
...
@@ -499,6 +499,7 @@ static int32_t fillDbSchema(STableMeta* tableMeta, char* tableName, SSmlSTableSc
for
(
int
i
=
0
;
i
<
tableMeta
->
tableInfo
.
numOfColumns
;
++
i
)
{
SSchema
field
;
tstrncpy
(
field
.
name
,
tableMeta
->
schema
[
i
].
name
,
strlen
(
tableMeta
->
schema
[
i
].
name
)
+
1
);
addEscapeCharToString
(
field
.
name
,
(
int16_t
)
strlen
(
field
.
name
));
field
.
type
=
tableMeta
->
schema
[
i
].
type
;
field
.
bytes
=
tableMeta
->
schema
[
i
].
bytes
;
taosArrayPush
(
schema
->
fields
,
&
field
);
...
...
@@ -510,6 +511,7 @@ static int32_t fillDbSchema(STableMeta* tableMeta, char* tableName, SSmlSTableSc
int
j
=
i
+
tableMeta
->
tableInfo
.
numOfColumns
;
SSchema
field
;
tstrncpy
(
field
.
name
,
tableMeta
->
schema
[
j
].
name
,
strlen
(
tableMeta
->
schema
[
j
].
name
)
+
1
);
addEscapeCharToString
(
field
.
name
,
(
int16_t
)
strlen
(
field
.
name
));
field
.
type
=
tableMeta
->
schema
[
j
].
type
;
field
.
bytes
=
tableMeta
->
schema
[
j
].
bytes
;
taosArrayPush
(
schema
->
tags
,
&
field
);
...
...
@@ -1175,6 +1177,15 @@ static void escapeSpecialCharacter(uint8_t field, const char **pos) {
*
pos
=
cur
;
}
void
addEscapeCharToString
(
char
*
str
,
int32_t
len
)
{
if
(
str
==
NULL
)
{
return
;
}
memmove
(
str
+
1
,
str
,
len
);
str
[
0
]
=
str
[
len
+
1
]
=
TS_ESCAPE_CHAR
;
str
[
len
+
2
]
=
'\0'
;
}
bool
isValidInteger
(
char
*
str
)
{
char
*
c
=
str
;
if
(
*
c
!=
'+'
&&
*
c
!=
'-'
&&
!
isdigit
(
*
c
))
{
...
...
@@ -1435,58 +1446,65 @@ static bool isNchar(char *pVal, uint16_t len) {
return
false
;
}
static
bool
isTimeStamp
(
char
*
pVal
,
uint16_t
len
,
SMLTimeStampType
*
tsType
,
SSmlLinesInfo
*
info
)
{
static
int32_t
isTimeStamp
(
char
*
pVal
,
uint16_t
len
,
SMLTimeStampType
*
tsType
,
SSmlLinesInfo
*
info
)
{
if
(
len
==
0
)
{
return
true
;
return
TSDB_CODE_SUCCESS
;
}
if
((
len
==
1
)
&&
pVal
[
0
]
==
'0'
)
{
*
tsType
=
SML_TIME_STAMP_NOW
;
return
true
;
return
TSDB_CODE_SUCCESS
;
}
//Default no appendix
if
(
isdigit
(
pVal
[
len
-
1
])
&&
isdigit
(
pVal
[
len
-
2
]))
{
if
(
info
->
protocol
==
TSDB_SML_LINE_PROTOCOL
)
{
if
(
info
->
tsType
!=
SML_TIME_STAMP_NOT_CONFIGURED
)
{
*
tsType
=
info
->
tsType
;
}
else
{
*
tsType
=
SML_TIME_STAMP_NANO_SECONDS
;
}
}
else
if
(
info
->
protocol
==
TSDB_SML_TELNET_PROTOCOL
)
{
if
(
len
==
SML_TIMESTAMP_SECOND_DIGITS
)
{
*
tsType
=
SML_TIME_STAMP_SECONDS
;
}
else
if
(
len
==
SML_TIMESTAMP_MILLI_SECOND_DIGITS
)
{
*
tsType
=
SML_TIME_STAMP_MILLI_SECONDS
;
}
else
{
return
TSDB_CODE_TSC_INVALID_TIME_STAMP
;
}
for
(
int
i
=
0
;
i
<
len
;
++
i
)
{
if
(
!
isdigit
(
pVal
[
i
]))
{
return
TSDB_CODE_TSC_INVALID_TIME_STAMP
;
}
return
true
;
}
if
(
pVal
[
len
-
1
]
==
's'
)
{
switch
(
pVal
[
len
-
2
])
{
case
'm'
:
*
tsType
=
SML_TIME_STAMP_MILLI_SECONDS
;
break
;
case
'u'
:
*
tsType
=
SML_TIME_STAMP_MICRO_SECONDS
;
break
;
case
'n'
:
*
tsType
=
SML_TIME_STAMP_NANO_SECONDS
;
break
;
default:
if
(
isdigit
(
pVal
[
len
-
2
]))
{
*
tsType
=
SML_TIME_STAMP_SECONDS
;
break
;
}
else
{
return
false
;
}
/* For InfluxDB line protocol use user passed timestamp precision
* For OpenTSDB protocols only 10 digit(seconds) or 13 digits(milliseconds)
* precision allowed
*/
if
(
info
->
protocol
==
TSDB_SML_LINE_PROTOCOL
)
{
if
(
info
->
tsType
!=
SML_TIME_STAMP_NOT_CONFIGURED
)
{
*
tsType
=
info
->
tsType
;
}
else
{
*
tsType
=
SML_TIME_STAMP_NANO_SECONDS
;
}
}
else
if
(
info
->
protocol
==
TSDB_SML_TELNET_PROTOCOL
)
{
if
(
len
==
SML_TIMESTAMP_SECOND_DIGITS
)
{
*
tsType
=
SML_TIME_STAMP_SECONDS
;
}
else
if
(
len
==
SML_TIMESTAMP_MILLI_SECOND_DIGITS
)
{
*
tsType
=
SML_TIME_STAMP_MILLI_SECONDS
;
}
else
{
return
TSDB_CODE_TSC_INVALID_TIME_STAMP
;
}
//printf("Type is timestamp(%s)\n", pVal);
return
true
;
}
return
false
;
return
TSDB_CODE_SUCCESS
;
//if (pVal[len - 1] == 's') {
// switch (pVal[len - 2]) {
// case 'm':
// *tsType = SML_TIME_STAMP_MILLI_SECONDS;
// break;
// case 'u':
// *tsType = SML_TIME_STAMP_MICRO_SECONDS;
// break;
// case 'n':
// *tsType = SML_TIME_STAMP_NANO_SECONDS;
// break;
// default:
// if (isdigit(pVal[len - 2])) {
// *tsType = SML_TIME_STAMP_SECONDS;
// break;
// } else {
// return false;
// }
// }
// //printf("Type is timestamp(%s)\n", pVal);
// return true;
//}
//return false;
}
static
bool
convertStrToNumber
(
TAOS_SML_KV
*
pVal
,
char
*
str
,
SSmlLinesInfo
*
info
)
{
...
...
@@ -1750,14 +1768,6 @@ bool convertSmlValueType(TAOS_SML_KV *pVal, char *value,
static
int32_t
getTimeStampValue
(
char
*
value
,
uint16_t
len
,
SMLTimeStampType
type
,
int64_t
*
ts
,
SSmlLinesInfo
*
info
)
{
if
(
len
>=
2
)
{
for
(
int
i
=
0
;
i
<
len
-
2
;
++
i
)
{
if
(
!
isdigit
(
value
[
i
]))
{
return
TSDB_CODE_TSC_INVALID_TIME_STAMP
;
}
}
}
//No appendix or no timestamp given (len = 0)
if
(
len
!=
0
&&
type
!=
SML_TIME_STAMP_NOW
)
{
*
ts
=
(
int64_t
)
strtoll
(
value
,
NULL
,
10
);
...
...
@@ -1806,13 +1816,13 @@ int32_t convertSmlTimeStamp(TAOS_SML_KV *pVal, char *value,
SMLTimeStampType
type
;
int64_t
tsVal
;
strntolower_s
(
value
,
value
,
len
);
if
(
!
isTimeStamp
(
value
,
len
,
&
type
,
info
)
)
{
return
TSDB_CODE_TSC_INVALID_TIME_STAMP
;
ret
=
isTimeStamp
(
value
,
len
,
&
type
,
info
);
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
return
ret
;
}
ret
=
getTimeStampValue
(
value
,
len
,
type
,
&
tsVal
,
info
);
if
(
ret
)
{
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
return
ret
;
}
tscDebug
(
"SML:0x%"
PRIx64
"Timestamp after conversion:%"
PRId64
,
info
->
id
,
tsVal
);
...
...
@@ -1884,15 +1894,10 @@ bool checkDuplicateKey(char *key, SHashObj *pHash, SSmlLinesInfo* info) {
static
int32_t
parseSmlKey
(
TAOS_SML_KV
*
pKV
,
const
char
**
index
,
SHashObj
*
pHash
,
SSmlLinesInfo
*
info
)
{
const
char
*
cur
=
*
index
;
char
key
[
TSDB_COL_NAME_LEN
+
1
];
// +1 to avoid key[len] over write
u
int16_t
len
=
0
;
int16_t
len
=
0
;
//key field cannot start with digit
if
(
isdigit
(
*
cur
))
{
tscError
(
"SML:0x%"
PRIx64
" Tag key cannot start with digit"
,
info
->
id
);
return
TSDB_CODE_TSC_LINE_SYNTAX_ERROR
;
}
while
(
*
cur
!=
'\0'
)
{
if
(
len
>
=
TSDB_COL_NAME_LEN
-
1
)
{
if
(
len
>
TSDB_COL_NAME_LEN
-
1
)
{
tscError
(
"SML:0x%"
PRIx64
" Key field cannot exceeds %d characters"
,
info
->
id
,
TSDB_COL_NAME_LEN
-
1
);
return
TSDB_CODE_TSC_INVALID_COLUMN_LENGTH
;
}
...
...
@@ -1919,9 +1924,11 @@ static int32_t parseSmlKey(TAOS_SML_KV *pKV, const char **index, SHashObj *pHash
return
TSDB_CODE_TSC_LINE_SYNTAX_ERROR
;
}
pKV
->
key
=
calloc
(
len
+
1
,
1
);
pKV
->
key
=
calloc
(
len
+
TS_ESCAPE_CHAR_SIZE
+
1
,
1
);
memcpy
(
pKV
->
key
,
key
,
len
+
1
);
//tscDebug("SML:0x%"PRIx64" Key:%s|len:%d", info->id, pKV->key, len);
strntolower_s
(
pKV
->
key
,
pKV
->
key
,
(
int32_t
)
len
);
addEscapeCharToString
(
pKV
->
key
,
len
);
tscDebug
(
"SML:0x%"
PRIx64
" Key:%s|len:%d"
,
info
->
id
,
pKV
->
key
,
len
);
*
index
=
cur
+
1
;
return
TSDB_CODE_SUCCESS
;
}
...
...
@@ -1932,7 +1939,7 @@ static int32_t parseSmlValue(TAOS_SML_KV *pKV, const char **index,
const
char
*
start
,
*
cur
;
int32_t
ret
=
TSDB_CODE_SUCCESS
;
char
*
value
=
NULL
;
u
int16_t
len
=
0
;
int16_t
len
=
0
;
bool
searchQuote
=
false
;
start
=
cur
=
*
index
;
...
...
@@ -2013,21 +2020,15 @@ error:
static
int32_t
parseSmlMeasurement
(
TAOS_SML_DATA_POINT
*
pSml
,
const
char
**
index
,
uint8_t
*
has_tags
,
SSmlLinesInfo
*
info
)
{
const
char
*
cur
=
*
index
;
u
int16_t
len
=
0
;
int16_t
len
=
0
;
pSml
->
stableName
=
calloc
(
TSDB_TABLE_NAME_LEN
+
1
,
1
);
// +1 to avoid 1772 line over write
pSml
->
stableName
=
calloc
(
TSDB_TABLE_NAME_LEN
+
TS_ESCAPE_CHAR_SIZE
,
1
);
if
(
pSml
->
stableName
==
NULL
){
return
TSDB_CODE_TSC_OUT_OF_MEMORY
;
}
if
(
isdigit
(
*
cur
))
{
tscError
(
"SML:0x%"
PRIx64
" Measurement field cannnot start with digit"
,
info
->
id
);
free
(
pSml
->
stableName
);
pSml
->
stableName
=
NULL
;
return
TSDB_CODE_TSC_LINE_SYNTAX_ERROR
;
}
while
(
*
cur
!=
'\0'
)
{
if
(
len
>
=
TSDB_TABLE_NAME_LEN
-
1
)
{
if
(
len
>
TSDB_TABLE_NAME_LEN
-
1
)
{
tscError
(
"SML:0x%"
PRIx64
" Measurement field cannot exceeds %d characters"
,
info
->
id
,
TSDB_TABLE_NAME_LEN
-
1
);
free
(
pSml
->
stableName
);
pSml
->
stableName
=
NULL
;
...
...
@@ -2061,7 +2062,7 @@ static int32_t parseSmlMeasurement(TAOS_SML_DATA_POINT *pSml, const char **index
pSml
->
stableName
=
NULL
;
return
TSDB_CODE_TSC_LINE_SYNTAX_ERROR
;
}
pSml
->
stableName
[
len
]
=
'\0'
;
addEscapeCharToString
(
pSml
->
stableName
,
len
)
;
*
index
=
cur
+
1
;
tscDebug
(
"SML:0x%"
PRIx64
" Stable name in measurement:%s|len:%d"
,
info
->
id
,
pSml
->
stableName
,
len
);
...
...
@@ -2117,17 +2118,11 @@ static int32_t parseSmlKvPairs(TAOS_SML_KV **pKVs, int *num_kvs,
tscError
(
"SML:0x%"
PRIx64
" Unable to parse value"
,
info
->
id
);
goto
error
;
}
if
(
!
isField
&&
(
strcasecmp
(
pkv
->
key
,
"ID"
)
==
0
))
{
ret
=
isValidChildTableName
(
pkv
->
value
,
pkv
->
length
,
info
);
if
(
ret
)
{
free
(
pkv
->
key
);
free
(
pkv
->
value
);
goto
error
;
}
smlData
->
childTableName
=
malloc
(
pkv
->
length
+
1
);
if
(
!
isField
&&
(
strcasecmp
(
pkv
->
key
,
"`ID`"
)
==
0
))
{
smlData
->
childTableName
=
malloc
(
pkv
->
length
+
TS_ESCAPE_CHAR_SIZE
+
1
);
memcpy
(
smlData
->
childTableName
,
pkv
->
value
,
pkv
->
length
);
strntolower_s
(
smlData
->
childTableName
,
smlData
->
childTableName
,
(
int32_t
)
pkv
->
length
);
smlData
->
childTableName
[
pkv
->
length
]
=
'\0'
;
addEscapeCharToString
(
smlData
->
childTableName
,
(
int32_t
)
pkv
->
length
)
;
free
(
pkv
->
key
);
free
(
pkv
->
value
);
}
else
{
...
...
@@ -2373,6 +2368,7 @@ static SSqlObj* createSmlQueryObj(TAOS* taos, int32_t affected_rows, int32_t cod
}
pNew
->
signature
=
pNew
;
pNew
->
pTscObj
=
taos
;
pNew
->
fp
=
NULL
;
tsem_init
(
&
pNew
->
rspSem
,
0
,
0
);
registerSqlObj
(
pNew
);
...
...
src/client/src/tscParseOpenTSDB.c
浏览文件 @
8a358c66
...
...
@@ -37,18 +37,20 @@ static int32_t parseTelnetMetric(TAOS_SML_DATA_POINT *pSml, const char **index,
const
char
*
cur
=
*
index
;
uint16_t
len
=
0
;
pSml
->
stableName
=
tcalloc
(
TSDB_TABLE_NAME_LEN
,
1
);
pSml
->
stableName
=
tcalloc
(
TSDB_TABLE_NAME_LEN
+
TS_ESCAPE_CHAR_SIZE
,
1
);
if
(
pSml
->
stableName
==
NULL
)
{
return
TSDB_CODE_TSC_OUT_OF_MEMORY
;
}
/*
if (isdigit(*cur)) {
tscError("OTD:0x%"PRIx64" Metric cannot start with digit", info->id);
tfree(pSml->stableName);
return TSDB_CODE_TSC_LINE_SYNTAX_ERROR;
}
*/
while
(
*
cur
!=
'\0'
)
{
if
(
len
>
=
TSDB_TABLE_NAME_LEN
-
1
)
{
if
(
len
>
TSDB_TABLE_NAME_LEN
-
1
)
{
tscError
(
"OTD:0x%"
PRIx64
" Metric cannot exceeds %d characters"
,
info
->
id
,
TSDB_TABLE_NAME_LEN
-
1
);
tfree
(
pSml
->
stableName
);
return
TSDB_CODE_TSC_INVALID_TABLE_ID_LENGTH
;
...
...
@@ -63,7 +65,7 @@ static int32_t parseTelnetMetric(TAOS_SML_DATA_POINT *pSml, const char **index,
}
}
pSml
->
stableName
[
len
]
=
*
cur
;
pSml
->
stableName
[
len
]
=
tolower
(
*
cur
)
;
cur
++
;
len
++
;
...
...
@@ -73,7 +75,7 @@ static int32_t parseTelnetMetric(TAOS_SML_DATA_POINT *pSml, const char **index,
return
TSDB_CODE_TSC_LINE_SYNTAX_ERROR
;
}
pSml
->
stableName
[
len
]
=
'\0'
;
addEscapeCharToString
(
pSml
->
stableName
,
len
)
;
*
index
=
cur
+
1
;
tscDebug
(
"OTD:0x%"
PRIx64
" Stable name in metric:%s|len:%d"
,
info
->
id
,
pSml
->
stableName
,
len
);
...
...
@@ -207,12 +209,12 @@ static int32_t parseTelnetTagKey(TAOS_SML_KV *pKV, const char **index, SHashObj
uint16_t
len
=
0
;
//key field cannot start with digit
if
(
isdigit
(
*
cur
))
{
tscError
(
"OTD:0x%"
PRIx64
" Tag key cannot start with digit"
,
info
->
id
);
return
TSDB_CODE_TSC_LINE_SYNTAX_ERROR
;
}
//
if (isdigit(*cur)) {
//
tscError("OTD:0x%"PRIx64" Tag key cannot start with digit", info->id);
//
return TSDB_CODE_TSC_LINE_SYNTAX_ERROR;
//
}
while
(
*
cur
!=
'\0'
)
{
if
(
len
>
=
TSDB_COL_NAME_LEN
-
1
)
{
if
(
len
>
TSDB_COL_NAME_LEN
-
1
)
{
tscError
(
"OTD:0x%"
PRIx64
" Tag key cannot exceeds %d characters"
,
info
->
id
,
TSDB_COL_NAME_LEN
-
1
);
return
TSDB_CODE_TSC_INVALID_COLUMN_LENGTH
;
}
...
...
@@ -236,8 +238,10 @@ static int32_t parseTelnetTagKey(TAOS_SML_KV *pKV, const char **index, SHashObj
return
TSDB_CODE_TSC_DUP_TAG_NAMES
;
}
pKV
->
key
=
tcalloc
(
len
+
1
,
1
);
pKV
->
key
=
tcalloc
(
len
+
TS_ESCAPE_CHAR_SIZE
+
1
,
1
);
memcpy
(
pKV
->
key
,
key
,
len
+
1
);
strntolower_s
(
pKV
->
key
,
pKV
->
key
,
(
int32_t
)
len
);
addEscapeCharToString
(
pKV
->
key
,
len
);
//tscDebug("OTD:0x%"PRIx64" Key:%s|len:%d", info->id, pKV->key, len);
*
index
=
cur
+
1
;
return
TSDB_CODE_SUCCESS
;
...
...
@@ -312,15 +316,12 @@ static int32_t parseTelnetTagKvs(TAOS_SML_KV **pKVs, int *num_kvs,
tscError
(
"OTD:0x%"
PRIx64
" Unable to parse value"
,
info
->
id
);
return
ret
;
}
if
((
strcasecmp
(
pkv
->
key
,
"ID"
)
==
0
))
{
ret
=
isValidChildTableName
(
pkv
->
value
,
pkv
->
length
,
info
);
if
(
ret
)
{
return
ret
;
}
*
childTableName
=
malloc
(
pkv
->
length
+
1
);
if
((
strcasecmp
(
pkv
->
key
,
"`ID`"
)
==
0
))
{
*
childTableName
=
tcalloc
(
pkv
->
length
+
TS_ESCAPE_CHAR_SIZE
+
1
,
1
);
memcpy
(
*
childTableName
,
pkv
->
value
,
pkv
->
length
);
(
*
childTableName
)[
pkv
->
length
]
=
'\0'
;
strntolower_s
(
*
childTableName
,
*
childTableName
,
(
int32_t
)
pkv
->
length
);
addEscapeCharToString
(
*
childTableName
,
pkv
->
length
);
tfree
(
pkv
->
key
);
tfree
(
pkv
->
value
);
}
else
{
...
...
@@ -493,19 +494,22 @@ static int32_t parseMetricFromJSON(cJSON *root, TAOS_SML_DATA_POINT* pSml, SSmlL
return
TSDB_CODE_TSC_INVALID_TABLE_ID_LENGTH
;
}
pSml
->
stableName
=
tcalloc
(
stableLen
+
1
,
sizeof
(
char
));
pSml
->
stableName
=
tcalloc
(
stableLen
+
TS_ESCAPE_CHAR_SIZE
+
1
,
sizeof
(
char
));
if
(
pSml
->
stableName
==
NULL
){
return
TSDB_CODE_TSC_OUT_OF_MEMORY
;
}
/*
if (isdigit(metric->valuestring[0])) {
tscError("OTD:0x%"PRIx64" Metric cannot start with digit in JSON", info->id);
tfree(pSml->stableName);
return TSDB_CODE_TSC_INVALID_JSON;
}
*/
tstrncpy
(
pSml
->
stableName
,
metric
->
valuestring
,
stableLen
+
1
);
strntolower_s
(
pSml
->
stableName
,
pSml
->
stableName
,
(
int32_t
)
stableLen
);
addEscapeCharToString
(
pSml
->
stableName
,
stableLen
);
return
TSDB_CODE_SUCCESS
;
...
...
@@ -888,7 +892,6 @@ static int32_t parseTagsFromJSON(cJSON *root, TAOS_SML_KV **pKVs, int *num_kvs,
if
(
tags
==
NULL
||
tags
->
type
!=
cJSON_Object
)
{
return
TSDB_CODE_TSC_INVALID_JSON
;
}
//only pick up the first ID value as child table name
cJSON
*
id
=
cJSON_GetObjectItem
(
tags
,
"ID"
);
if
(
id
!=
NULL
)
{
...
...
@@ -897,13 +900,10 @@ static int32_t parseTagsFromJSON(cJSON *root, TAOS_SML_KV **pKVs, int *num_kvs,
return
TSDB_CODE_TSC_INVALID_JSON
;
}
size_t
idLen
=
strlen
(
id
->
valuestring
);
ret
=
isValidChildTableName
(
id
->
valuestring
,
(
int16_t
)
idLen
,
info
);
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
return
ret
;
}
*
childTableName
=
tcalloc
(
idLen
+
1
,
sizeof
(
char
));
*
childTableName
=
tcalloc
(
idLen
+
TS_ESCAPE_CHAR_SIZE
+
1
,
sizeof
(
char
));
memcpy
(
*
childTableName
,
id
->
valuestring
,
idLen
);
strntolower_s
(
*
childTableName
,
*
childTableName
,
(
int32_t
)
idLen
);
addEscapeCharToString
(
*
childTableName
,
idLen
);
//check duplicate IDs
cJSON_DeleteItemFromObject
(
tags
,
"ID"
);
...
...
@@ -912,7 +912,6 @@ static int32_t parseTagsFromJSON(cJSON *root, TAOS_SML_KV **pKVs, int *num_kvs,
return
TSDB_CODE_TSC_DUP_TAG_NAMES
;
}
}
int32_t
tagNum
=
cJSON_GetArraySize
(
tags
);
//at least one tag pair required
if
(
tagNum
<=
0
)
{
...
...
@@ -938,8 +937,10 @@ static int32_t parseTagsFromJSON(cJSON *root, TAOS_SML_KV **pKVs, int *num_kvs,
tscError
(
"OTD:0x%"
PRIx64
" Tag key cannot exceeds %d characters in JSON"
,
info
->
id
,
TSDB_COL_NAME_LEN
-
1
);
return
TSDB_CODE_TSC_INVALID_COLUMN_LENGTH
;
}
pkv
->
key
=
tcalloc
(
keyLen
+
1
,
sizeof
(
char
));
pkv
->
key
=
tcalloc
(
keyLen
+
TS_ESCAPE_CHAR_SIZE
+
1
,
sizeof
(
char
));
strncpy
(
pkv
->
key
,
tag
->
string
,
keyLen
);
strntolower_s
(
pkv
->
key
,
pkv
->
key
,
(
int32_t
)
keyLen
);
addEscapeCharToString
(
pkv
->
key
,
keyLen
);
//value
ret
=
parseValueFromJSON
(
tag
,
pkv
,
info
);
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
...
...
src/client/src/tscSQLParser.c
浏览文件 @
8a358c66
...
...
@@ -3174,6 +3174,14 @@ static int16_t doGetColumnIndex(SQueryInfo* pQueryInfo, int32_t index, SStrToken
int16_t
columnIndex
=
COLUMN_INDEX_INITIAL_VAL
;
char
tmpTokenBuf
[
TSDB_MAX_BYTES_PER_ROW
]
=
{
0
};
// create tmp buf to avoid alter orginal sqlstr
strncpy
(
tmpTokenBuf
,
pToken
->
z
,
pToken
->
n
);
pToken
->
z
=
tmpTokenBuf
;
if
(
pToken
->
type
==
TK_ID
)
{
tscRmEscapeAndTrimToken
(
pToken
);
}
for
(
int16_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
if
(
pToken
->
n
!=
strlen
(
pSchema
[
i
].
name
))
{
continue
;
...
...
@@ -6313,6 +6321,13 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
SColumnIndex
columnIndex
=
COLUMN_INDEX_INITIALIZER
;
SStrToken
name
=
{.
type
=
TK_STRING
,
.
z
=
pItem
->
name
,
.
n
=
(
uint32_t
)
strlen
(
pItem
->
name
)};
//handle Escape character backstick
if
(
name
.
z
[
0
]
==
TS_ESCAPE_CHAR
&&
name
.
z
[
name
.
n
-
1
]
==
TS_ESCAPE_CHAR
)
{
memmove
(
name
.
z
,
name
.
z
+
1
,
name
.
n
);
name
.
z
[
name
.
n
-
TS_ESCAPE_CHAR_SIZE
]
=
'\0'
;
name
.
n
-=
TS_ESCAPE_CHAR_SIZE
;
}
if
(
getColumnIndexByName
(
&
name
,
pQueryInfo
,
&
columnIndex
,
tscGetErrorMsgPayload
(
pCmd
))
!=
TSDB_CODE_SUCCESS
)
{
return
invalidOperationMsg
(
pMsg
,
msg17
);
}
...
...
@@ -6646,6 +6661,9 @@ int32_t validateColumnName(char* name) {
}
return
validateColumnName
(
token
.
z
);
}
else
if
(
token
.
type
==
TK_ID
)
{
strRmquoteEscape
(
name
,
token
.
n
);
return
TSDB_CODE_SUCCESS
;
}
else
{
if
(
isNumber
(
&
token
))
{
return
TSDB_CODE_TSC_INVALID_OPERATION
;
...
...
@@ -7711,7 +7729,7 @@ int32_t doCheckForCreateFromStable(SSqlObj* pSql, SSqlInfo* pInfo) {
SCreatedTableInfo
*
pCreateTableInfo
=
taosArrayGet
(
pCreateTable
->
childTableInfo
,
j
);
SStrToken
*
pToken
=
&
pCreateTableInfo
->
stableName
;
bool
dbIncluded
=
false
;
char
buf
[
TSDB_TABLE_FNAME_LEN
];
SStrToken
sTblToken
;
...
...
@@ -7771,10 +7789,19 @@ int32_t doCheckForCreateFromStable(SSqlObj* pSql, SSqlInfo* pInfo) {
for
(
int32_t
i
=
0
;
i
<
nameSize
;
++
i
)
{
SStrToken
*
sToken
=
taosArrayGet
(
pNameList
,
i
);
char
tmpTokenBuf
[
TSDB_MAX_BYTES_PER_ROW
]
=
{
0
};
// create tmp buf to avoid alter orginal sqlstr
strncpy
(
tmpTokenBuf
,
sToken
->
z
,
sToken
->
n
);
sToken
->
z
=
tmpTokenBuf
;
if
(
TK_STRING
==
sToken
->
type
)
{
tscDequoteAndTrimToken
(
sToken
);
}
if
(
TK_ID
==
sToken
->
type
)
{
tscRmEscapeAndTrimToken
(
sToken
);
}
tVariantListItem
*
pItem
=
taosArrayGet
(
pValList
,
i
);
findColumnIndex
=
false
;
...
...
src/client/src/tscSql.c
浏览文件 @
8a358c66
...
...
@@ -629,6 +629,10 @@ static bool hasAdditionalErrorInfo(int32_t code, SSqlCmd *pCmd) {
return
false
;
}
if
(
pCmd
->
payload
==
NULL
)
{
return
false
;
}
size_t
len
=
strlen
(
pCmd
->
payload
);
char
*
z
=
NULL
;
...
...
src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBResultSetRowData.java
浏览文件 @
8a358c66
...
...
@@ -49,7 +49,7 @@ public class TSDBResultSetRowData {
}
/**
* $$$ this method is invoked by databaseMetaDataResultSet and so on which use a index start from 1 in JDBC api
* $$$ this method is invoked by databaseMetaDataResultSet and so on which use a
n
index start from 1 in JDBC api
*/
public
void
setBooleanValue
(
int
col
,
boolean
value
)
{
setBoolean
(
col
-
1
,
value
);
...
...
@@ -86,7 +86,7 @@ public class TSDBResultSetRowData {
}
/**
* $$$ this method is invoked by databaseMetaDataResultSet and so on which use a index start from 1 in JDBC api
* $$$ this method is invoked by databaseMetaDataResultSet and so on which use a
n
index start from 1 in JDBC api
*/
public
void
setByteValue
(
int
colIndex
,
byte
value
)
{
setByte
(
colIndex
-
1
,
value
);
...
...
@@ -100,7 +100,7 @@ public class TSDBResultSetRowData {
}
/**
* $$$ this method is invoked by databaseMetaDataResultSet and so on which use a index start from 1 in JDBC api
* $$$ this method is invoked by databaseMetaDataResultSet and so on which use a
n
index start from 1 in JDBC api
*/
public
void
setShortValue
(
int
colIndex
,
short
value
)
{
setShort
(
colIndex
-
1
,
value
);
...
...
@@ -114,7 +114,7 @@ public class TSDBResultSetRowData {
}
/**
* $$$ this method is invoked by databaseMetaDataResultSet and so on which use a index start from 1 in JDBC api
* $$$ this method is invoked by databaseMetaDataResultSet and so on which use a
n
index start from 1 in JDBC api
*/
public
void
setIntValue
(
int
colIndex
,
int
value
)
{
setInt
(
colIndex
-
1
,
value
);
...
...
@@ -194,7 +194,7 @@ public class TSDBResultSetRowData {
/**
* $$$ this method is invoked by databaseMetaDataResultSet and so on which use a index start from 1 in JDBC api
* $$$ this method is invoked by databaseMetaDataResultSet and so on which use a
n
index start from 1 in JDBC api
*/
public
void
setLongValue
(
int
colIndex
,
long
value
)
{
setLong
(
colIndex
-
1
,
value
);
...
...
@@ -262,7 +262,7 @@ public class TSDBResultSetRowData {
}
/**
* $$$ this method is invoked by databaseMetaDataResultSet and so on which use a index start from 1 in JDBC api
* $$$ this method is invoked by databaseMetaDataResultSet and so on which use a
n
index start from 1 in JDBC api
*/
public
void
setFloatValue
(
int
colIndex
,
float
value
)
{
setFloat
(
colIndex
-
1
,
value
);
...
...
@@ -302,7 +302,7 @@ public class TSDBResultSetRowData {
}
/**
* $$$ this method is invoked by databaseMetaDataResultSet and so on which use a index start from 1 in JDBC api
* $$$ this method is invoked by databaseMetaDataResultSet and so on which use a
n
index start from 1 in JDBC api
*/
public
void
setDoubleValue
(
int
colIndex
,
double
value
)
{
setDouble
(
colIndex
-
1
,
value
);
...
...
@@ -342,7 +342,7 @@ public class TSDBResultSetRowData {
}
/**
* $$$ this method is invoked by databaseMetaDataResultSet and so on which use a index start from 1 in JDBC api
* $$$ this method is invoked by databaseMetaDataResultSet and so on which use a
n
index start from 1 in JDBC api
*/
public
void
setStringValue
(
int
colIndex
,
String
value
)
{
data
.
set
(
colIndex
-
1
,
value
);
...
...
@@ -361,7 +361,7 @@ public class TSDBResultSetRowData {
}
/**
* $$$ this method is invoked by databaseMetaDataResultSet and so on which use a index start from 1 in JDBC api
* $$$ this method is invoked by databaseMetaDataResultSet and so on which use a
n
index start from 1 in JDBC api
*/
public
void
setByteArrayValue
(
int
colIndex
,
byte
[]
value
)
{
setByteArray
(
colIndex
-
1
,
value
);
...
...
@@ -424,7 +424,7 @@ public class TSDBResultSetRowData {
}
/**
* $$$ this method is invoked by databaseMetaDataResultSet and so on which use a index start from 1 in JDBC api
* $$$ this method is invoked by databaseMetaDataResultSet and so on which use a
n
index start from 1 in JDBC api
*/
public
void
setTimestampValue
(
int
colIndex
,
long
value
)
{
setTimestamp
(
colIndex
-
1
,
value
,
0
);
...
...
src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBResultSetWrapper.java
浏览文件 @
8a358c66
...
...
@@ -23,7 +23,7 @@ import java.util.Calendar;
import
java.util.Map
;
/*
* TDengine only supports a subset of the standard SQL, thus this implemetation of the
* TDengine only supports a subset of the standard SQL, thus this impleme
n
tation of the
* standard JDBC API contains more or less some adjustments customized for certain
* compatibility needs.
*/
...
...
src/connector/python/taos/cinterface.py
浏览文件 @
8a358c66
...
...
@@ -64,6 +64,8 @@ _libtaos.taos_consume.restype = ctypes.c_void_p
_libtaos
.
taos_fetch_lengths
.
restype
=
ctypes
.
POINTER
(
ctypes
.
c_int
)
_libtaos
.
taos_free_result
.
restype
=
None
_libtaos
.
taos_query
.
restype
=
ctypes
.
POINTER
(
ctypes
.
c_void_p
)
_libtaos
.
taos_schemaless_insert
.
restype
=
ctypes
.
c_void_p
try
:
_libtaos
.
taos_stmt_errstr
.
restype
=
c_char_p
except
AttributeError
:
...
...
@@ -813,9 +815,6 @@ try:
except
AttributeError
:
print
(
"WARNING: libtaos(%s) does not support insert_lines"
%
taos_get_client_info
())
def
taos_schemaless_insert
(
connection
,
lines
,
protocol
,
precision
):
# type: (c_void_p, list[str] | tuple(str)) -> None
num_of_lines
=
len
(
lines
)
...
...
src/connector/python/tests/test_lines.py
浏览文件 @
8a358c66
...
...
@@ -28,15 +28,12 @@ def test_schemaless_insert(conn):
'stf,t1=4i64,t3="t4",t2=5f64,t4=5f64 c1=3i64,c3=L"passitagin_stf",c2=false,c5=5f64,c6=7u64 1626006933641000000'
,
]
conn
.
schemaless_insert
(
lines
,
0
,
"ns"
)
print
(
"inserted"
)
lines
=
[
'stf,t1=5i64,t3="t4",t2=5f64,t4=5f64 c1=3i64,c3=L"passitagin_stf",c2=false,c5=5f64,c6=7u64 1626006933641000000'
,
]
conn
.
schemaless_insert
(
lines
,
0
,
"ns"
)
print
(
"inserted"
)
result
=
conn
.
query
(
"select * from st"
)
print
(
*
result
.
fields
)
all
=
result
.
rows_iter
()
for
row
in
all
:
print
(
row
)
...
...
src/inc/taosdef.h
浏览文件 @
8a358c66
...
...
@@ -99,6 +99,7 @@ extern const int32_t TYPE_BYTES[15];
#define TS_PATH_DELIMITER "."
#define TS_ESCAPE_CHAR '`'
#define TS_ESCAPE_CHAR_SIZE 2
#define TSDB_TIME_PRECISION_MILLI 0
#define TSDB_TIME_PRECISION_MICRO 1
...
...
src/inc/tsdb.h
浏览文件 @
8a358c66
...
...
@@ -421,9 +421,6 @@ bool tsdbNoProblem(STsdbRepo* pRepo);
// unit of walSize: MB
int
tsdbCheckWal
(
STsdbRepo
*
pRepo
,
uint32_t
walSize
);
// not commit if other instances in committing state or waiting to commit
bool
tsdbIsNeedCommit
(
STsdbRepo
*
pRepo
);
#ifdef __cplusplus
}
#endif
...
...
src/kit/taosdemo/taosdemo.c
浏览文件 @
8a358c66
...
...
@@ -77,6 +77,7 @@ extern char configDir[];
#define MAX_DATA_SIZE (16*TSDB_MAX_COLUMNS)+20 // max record len: 16*MAX_COLUMNS, timestamp string and ,('') need extra space
#define OPT_ABORT 1
/* –abort */
#define MAX_FILE_NAME_LEN 256 // max file name length on linux is 255.
#define MAX_PATH_LEN 4096
#define DEFAULT_START_TIME 1500000000000
...
...
@@ -511,7 +512,7 @@ typedef struct SThreadInfo_S {
int
threadID
;
char
db_name
[
TSDB_DB_NAME_LEN
];
uint32_t
time_precision
;
char
filePath
[
TSDB_FILENAME
_LEN
];
char
filePath
[
MAX_PATH
_LEN
];
FILE
*
fp
;
char
tb_prefix
[
TSDB_TABLE_NAME_LEN
];
uint64_t
start_table_from
;
...
...
@@ -3481,8 +3482,14 @@ static int postProceSql(char *host, uint16_t port,
'w'
,
'x'
,
'y'
,
'z'
,
'0'
,
'1'
,
'2'
,
'3'
,
'4'
,
'5'
,
'6'
,
'7'
,
'8'
,
'9'
,
'+'
,
'/'
};
snprintf
(
userpass_buf
,
INPUT_BUF_LEN
,
"%s:%s"
,
g_Dbs
.
user
,
g_Dbs
.
password
);
if
(
g_args
.
test_mode
==
INSERT_TEST
)
{
snprintf
(
userpass_buf
,
INPUT_BUF_LEN
,
"%s:%s"
,
g_Dbs
.
user
,
g_Dbs
.
password
);
}
else
{
snprintf
(
userpass_buf
,
INPUT_BUF_LEN
,
"%s:%s"
,
g_queryInfo
.
user
,
g_queryInfo
.
password
);
}
size_t
userpass_buf_len
=
strlen
(
userpass_buf
);
size_t
encoded_len
=
4
*
((
userpass_buf_len
+
2
)
/
3
);
...
...
@@ -3574,7 +3581,7 @@ static int postProceSql(char *host, uint16_t port,
"%s() LN%d: received:%d resp_len:%d, response_buf:
\n
%s
\n
"
,
__func__
,
__LINE__
,
received
,
resp_len
,
response_buf
);
break
;
}
}
}
}
while
(
received
<
resp_len
);
...
...
@@ -4380,7 +4387,7 @@ static int createSuperTable(
superTbl
->
lenOfTagOfOneRow
=
lenOfTagOfOneRow
;
snprintf
(
command
,
BUFFER_SIZE
,
superTbl
->
escapeChar
?
"CREATE TABLE IF NOT EXISTS %s.`%s` (ts TIMESTAMP%s) TAGS %s"
:
...
...
@@ -4515,7 +4522,7 @@ int createDatabasesAndStables(char *command) {
if
(
g_Dbs
.
db
[
i
].
superTbls
[
j
].
iface
==
SML_IFACE
)
{
goto
skip
;
}
sprintf
(
command
,
"describe %s.%s;"
,
g_Dbs
.
db
[
i
].
dbName
,
g_Dbs
.
db
[
i
].
superTbls
[
j
].
stbName
);
ret
=
queryDbExec
(
taos
,
command
,
NO_INSERT_TYPE
,
true
);
...
...
@@ -4575,7 +4582,7 @@ static void* createTable(void *sarg)
i
<=
pThreadInfo
->
end_table_to
;
i
++
)
{
if
(
0
==
g_Dbs
.
use_metric
)
{
snprintf
(
pThreadInfo
->
buffer
,
buff_len
,
g_args
.
escapeChar
?
g_args
.
escapeChar
?
"CREATE TABLE IF NOT EXISTS %s.`%s%"
PRIu64
"` %s;"
:
"CREATE TABLE IF NOT EXISTS %s.%s%"
PRIu64
" %s;"
,
pThreadInfo
->
db_name
,
...
...
@@ -6604,7 +6611,7 @@ static int getRowDataFromSample(
stbInfo
->
sampleDataBuf
+
stbInfo
->
lenOfOneRow
*
(
*
sampleUsePos
));
}
dataLen
+=
snprintf
(
dataBuf
+
dataLen
,
maxLen
-
dataLen
,
")"
);
(
*
sampleUsePos
)
++
;
...
...
@@ -7139,7 +7146,7 @@ static void getTableName(char *pTblName,
if
(
stbInfo
)
{
if
(
AUTO_CREATE_SUBTBL
!=
stbInfo
->
autoCreateTable
)
{
if
(
stbInfo
->
childTblLimit
>
0
)
{
snprintf
(
pTblName
,
TSDB_TABLE_NAME_LEN
,
snprintf
(
pTblName
,
TSDB_TABLE_NAME_LEN
,
stbInfo
->
escapeChar
?
"`%s`"
:
"%s"
,
stbInfo
->
childTblName
+
(
tableSeq
-
stbInfo
->
childTblOffset
)
*
TSDB_TABLE_NAME_LEN
);
...
...
@@ -7152,12 +7159,12 @@ static void getTableName(char *pTblName,
stbInfo
->
childTblName
+
tableSeq
*
TSDB_TABLE_NAME_LEN
);
}
}
else
{
snprintf
(
pTblName
,
TSDB_TABLE_NAME_LEN
,
snprintf
(
pTblName
,
TSDB_TABLE_NAME_LEN
,
stbInfo
->
escapeChar
?
"`%s%"
PRIu64
"`"
:
"%s%"
PRIu64
""
,
stbInfo
->
childTblPrefix
,
tableSeq
);
}
}
else
{
snprintf
(
pTblName
,
TSDB_TABLE_NAME_LEN
,
snprintf
(
pTblName
,
TSDB_TABLE_NAME_LEN
,
g_args
.
escapeChar
?
"`%s%"
PRIu64
"`"
:
"%s%"
PRIu64
""
,
g_args
.
tb_prefix
,
tableSeq
);
}
...
...
@@ -9713,7 +9720,7 @@ static void generateSmlHead(char* smlHead, SSuperTable* stbInfo, threadInfo* pTh
}
}
static
void
generateSmlTail
(
char
*
line
,
char
*
smlHead
,
SSuperTable
*
stbInfo
,
static
void
generateSmlTail
(
char
*
line
,
char
*
smlHead
,
SSuperTable
*
stbInfo
,
threadInfo
*
pThreadInfo
,
int64_t
timestamp
)
{
int
dataLen
=
0
;
dataLen
=
snprintf
(
line
,
BUFFER_SIZE
,
"%s "
,
smlHead
);
...
...
@@ -9860,7 +9867,7 @@ static void* syncWriteInterlaceSml(threadInfo *pThreadInfo, uint32_t interlaceRo
}
else
{
batchPerTblTimes
=
1
;
}
char
*
smlHead
[
pThreadInfo
->
ntables
];
for
(
int
t
=
0
;
t
<
pThreadInfo
->
ntables
;
t
++
)
{
smlHead
[
t
]
=
(
char
*
)
calloc
(
HEAD_BUFF_LEN
,
1
);
...
...
@@ -9869,7 +9876,7 @@ static void* syncWriteInterlaceSml(threadInfo *pThreadInfo, uint32_t interlaceRo
exit
(
EXIT_FAILURE
);
}
generateSmlHead
(
smlHead
[
t
],
stbInfo
,
pThreadInfo
,
t
);
}
pThreadInfo
->
totalInsertRows
=
0
;
...
...
@@ -9895,11 +9902,11 @@ static void* syncWriteInterlaceSml(threadInfo *pThreadInfo, uint32_t interlaceRo
pThreadInfo
->
lines
=
calloc
(
g_args
.
reqPerReq
,
sizeof
(
char
*
));
if
(
NULL
==
pThreadInfo
->
lines
)
{
errorPrint2
(
"Failed to alloc %"
PRIu64
" bytes, reason:%s
\n
"
,
g_args
.
reqPerReq
*
sizeof
(
char
*
),
g_args
.
reqPerReq
*
(
uint64_t
)
sizeof
(
char
*
),
strerror
(
errno
));
return
NULL
;
}
while
(
pThreadInfo
->
totalInsertRows
<
pThreadInfo
->
ntables
*
insertRows
)
{
if
((
flagSleep
)
&&
(
insert_interval
))
{
st
=
taosGetTimestampMs
();
...
...
@@ -10470,7 +10477,7 @@ static void* syncWriteProgressiveSml(threadInfo *pThreadInfo) {
exit
(
EXIT_FAILURE
);
}
generateSmlHead
(
smlHead
[
t
],
stbInfo
,
pThreadInfo
,
t
);
}
int
currentPercent
=
0
;
int
percentComplete
=
0
;
...
...
@@ -10481,14 +10488,14 @@ static void* syncWriteProgressiveSml(threadInfo *pThreadInfo) {
pThreadInfo
->
lines
=
calloc
(
g_args
.
reqPerReq
,
sizeof
(
char
*
));
if
(
NULL
==
pThreadInfo
->
lines
)
{
errorPrint2
(
"Failed to alloc %"
PRIu64
" bytes, reason:%s
\n
"
,
g_args
.
reqPerReq
*
sizeof
(
char
*
),
g_args
.
reqPerReq
*
(
uint64_t
)
sizeof
(
char
*
),
strerror
(
errno
));
return
NULL
;
}
for
(
uint64_t
i
=
0
;
i
<
pThreadInfo
->
ntables
;
i
++
)
{
int64_t
timestamp
=
pThreadInfo
->
start_time
;
for
(
uint64_t
j
=
0
;
j
<
insertRows
;)
{
for
(
int
k
=
0
;
k
<
g_args
.
reqPerReq
;
k
++
)
{
pThreadInfo
->
lines
[
k
]
=
calloc
(
BUFFER_SIZE
,
1
);
...
...
@@ -10956,7 +10963,7 @@ static void startMultiThreadInsertData(int threads, char* db_name,
int64_t
ntables
=
0
;
uint64_t
tableFrom
;
if
(
stbInfo
)
{
if
(
stbInfo
->
iface
!=
SML_IFACE
)
{
int64_t
limit
;
...
...
@@ -11198,7 +11205,7 @@ static void startMultiThreadInsertData(int threads, char* db_name,
pThreadInfo->start_time = pThreadInfo->start_time + rand_int() % 10000 - rand_tinyint();
}
*/
if
(
g_args
.
iface
==
REST_IFACE
||
((
stbInfo
)
&&
(
stbInfo
->
iface
==
REST_IFACE
)))
{
#ifdef WINDOWS
WSADATA
wsaData
;
...
...
@@ -11223,7 +11230,7 @@ static void startMultiThreadInsertData(int threads, char* db_name,
}
pThreadInfo
->
sockfd
=
sockfd
;
}
tsem_init
(
&
(
pThreadInfo
->
lock_sem
),
0
,
0
);
if
(
ASYNC_MODE
==
g_Dbs
.
asyncMode
)
{
...
...
src/kit/taosdump/taosdump.c
浏览文件 @
8a358c66
...
...
@@ -2091,7 +2091,7 @@ static int getTableDes(
memset
(
tableDes
->
cols
[
i
].
value
,
0
,
sizeof
(
tableDes
->
cols
[
i
].
note
));
char
tbuf
[
COL_NOTE_LEN
-
2
];
// need reserve 2 bytes for ' '
convertNCharToReadable
((
char
*
)
row
[
TSDB_SHOW_TABLES_NAME_INDEX
],
length
[
0
],
tbuf
,
COL_NOTE_LEN
);
sprintf
(
tableDes
->
cols
[
i
].
value
,
"
\'
%s
\'
"
,
tbuf
);
sprintf
(
tableDes
->
cols
[
i
].
value
,
"
%s
"
,
tbuf
);
break
;
}
case
TSDB_DATA_TYPE_TIMESTAMP
:
...
...
src/tsdb/src/tsdbMain.c
浏览文件 @
8a358c66
...
...
@@ -185,19 +185,10 @@ int tsdbUnlockRepo(STsdbRepo *pRepo) {
return
0
;
}
bool
tsdbIsNeedCommit
(
STsdbRepo
*
pRepo
)
{
int
nVal
=
0
;
if
(
sem_getvalue
(
&
pRepo
->
readyToCommit
,
&
nVal
)
!=
0
)
{
tsdbError
(
"vgId:%d failed to sem_getvalue of readyToCommit"
,
REPO_ID
(
pRepo
));
return
false
;
}
return
nVal
>
0
;
}
int
tsdbCheckWal
(
STsdbRepo
*
pRepo
,
uint32_t
walSize
)
{
// MB
STsdbCfg
*
pCfg
=
&
(
pRepo
->
config
);
if
((
walSize
>
tsdbWalFlushSize
)
&&
(
walSize
>
(
pCfg
->
totalBlocks
/
2
*
pCfg
->
cacheBlockSize
)))
{
if
(
tsdb
IsNeedCommit
(
pRepo
)
&&
(
tsdbAsyncCommit
(
pRepo
)
<
0
)
)
return
-
1
;
if
(
tsdb
AsyncCommit
(
pRepo
)
<
0
)
return
-
1
;
}
return
0
;
}
...
...
@@ -211,7 +202,7 @@ int tsdbCheckCommit(STsdbRepo *pRepo) {
if
((
pRepo
->
mem
->
extraBuffList
!=
NULL
)
||
((
listNEles
(
pRepo
->
mem
->
bufBlockList
)
>=
pCfg
->
totalBlocks
/
3
)
&&
(
pBufBlock
->
remain
<
TSDB_BUFFER_RESERVE
)))
{
// trigger commit
if
(
tsdb
IsNeedCommit
(
pRepo
)
&&
(
tsdbAsyncCommit
(
pRepo
)
<
0
)
)
return
-
1
;
if
(
tsdb
AsyncCommit
(
pRepo
)
<
0
)
return
-
1
;
}
return
0
;
}
...
...
src/util/src/ttokenizer.c
浏览文件 @
8a358c66
...
...
@@ -628,7 +628,7 @@ SStrToken tStrGetToken(char* str, int32_t* i, bool isPrevOptr) {
t0
.
n
=
0
;
return
t0
;
}
t
=
str
[
++
(
*
i
)];
}
...
...
src/util/src/tutil.c
浏览文件 @
8a358c66
...
...
@@ -53,13 +53,13 @@ int32_t strdequote(char *z) {
}
int32_t
strRmquote
(
char
*
z
,
int32_t
len
){
int32_t
strRmquote
(
char
*
z
,
int32_t
len
){
// delete escape character: \\, \', \"
char
delim
=
z
[
0
];
if
(
delim
!=
'\''
&&
delim
!=
'\"'
)
{
return
len
;
}
int32_t
cnt
=
0
;
int32_t
j
=
0
;
for
(
uint32_t
k
=
1
;
k
<
len
-
1
;
++
k
)
{
...
...
@@ -74,23 +74,24 @@ int32_t strRmquote(char *z, int32_t len){
continue
;
}
}
z
[
j
]
=
z
[
k
];
j
++
;
}
z
[
j
]
=
0
;
return
len
-
2
-
cnt
;
}
int32_t
strRmquoteEscape
(
char
*
z
,
int32_t
len
)
{
if
(
len
<=
0
)
return
len
;
if
(
z
[
0
]
==
'\''
||
z
[
0
]
==
'\"'
)
{
return
strRmquote
(
z
,
len
);
}
else
if
(
len
>
1
&&
z
[
0
]
==
TS_ESCAPE_CHAR
&&
z
[
len
-
1
]
==
TS_ESCAPE_CHAR
)
{
memmove
(
z
,
z
+
1
,
len
-
2
);
z
[
len
-
2
]
=
'\0'
;
return
len
-
2
;
}
...
...
src/vnode/src/vnodeWrite.c
浏览文件 @
8a358c66
...
...
@@ -169,7 +169,7 @@ static int32_t vnodeProcessSubmitMsg(SVnodeObj *pVnode, void *pCont, SRspRet *pR
}
static
int32_t
vnodeCheckWal
(
SVnodeObj
*
pVnode
)
{
if
(
tsdbIsNeedCommit
(
pVnode
->
tsdb
)
)
{
if
(
pVnode
->
isCommiting
==
0
)
{
return
tsdbCheckWal
(
pVnode
->
tsdb
,
walGetFSize
(
pVnode
->
wal
)
>>
20
);
}
return
0
;
...
...
@@ -189,7 +189,7 @@ static int32_t vnodeProcessCreateTableMsg(SVnodeObj *pVnode, void *pCont, SRspRe
ASSERT
(
code
!=
0
);
}
if
(((
++
pVnode
->
tblMsgVer
)
&
16383
)
==
0
)
{
// lazy check
if
(((
++
pVnode
->
tblMsgVer
)
&
32767
)
==
0
)
{
// lazy check
vnodeCheckWal
(
pVnode
);
}
...
...
tests/examples/c/apitest.c
浏览文件 @
8a358c66
...
...
@@ -15,7 +15,7 @@ static void prepare_data(TAOS* taos) {
result
=
taos_query
(
taos
,
"drop database if exists test;"
);
taos_free_result
(
result
);
usleep
(
100000
);
result
=
taos_query
(
taos
,
"create database test precision '
u
s';"
);
result
=
taos_query
(
taos
,
"create database test precision '
n
s';"
);
taos_free_result
(
result
);
usleep
(
100000
);
taos_select_db
(
taos
,
"test"
);
...
...
@@ -293,7 +293,7 @@ void verify_schema_less(TAOS* taos) {
result
=
taos_query
(
taos
,
"drop database if exists test;"
);
taos_free_result
(
result
);
usleep
(
100000
);
result
=
taos_query
(
taos
,
"create database test precision '
us' update 1
;"
);
result
=
taos_query
(
taos
,
"create database test precision '
ns' update 1 keep 36500
;"
);
taos_free_result
(
result
);
usleep
(
100000
);
...
...
@@ -401,6 +401,21 @@ void verify_schema_less(TAOS* taos) {
}
taos_free_result
(
result
);
//Test timestamp precision
char
*
lines7
[]
=
{
"stts,t1=10i64,t2=4f64,t3=
\"
t3
\"
c1=3i64,c3=L
\"
passit
\"
,c2=false,c4=4f64 1"
,
};
for
(
int
precision
=
TSDB_SML_TIMESTAMP_HOURS
;
precision
<=
TSDB_SML_TIMESTAMP_NANO_SECONDS
;
++
precision
)
{
result
=
taos_schemaless_insert
(
taos
,
lines7
,
1
,
TSDB_SML_LINE_PROTOCOL
,
precision
);
code
=
taos_errno
(
result
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
affected_rows
=
taos_affected_rows
(
result
);
printf
(
"
\033
[31m [lines7_%d]taos_schemaless_insert failed, code: %d,%s, affected rows:%d
\033
[0m
\n
"
,
precision
,
code
,
taos_errstr
(
result
),
affected_rows
);
}
taos_free_result
(
result
);
}
}
int
main
(
int
argc
,
char
*
argv
[])
{
...
...
tests/examples/python/taosdemo/taosdemo.py
浏览文件 @
8a358c66
...
...
@@ -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/client/twoClients.py
浏览文件 @
8a358c66
...
...
@@ -36,7 +36,8 @@ class TwoClients:
tdDnodes
.
deploy
(
1
)
tdDnodes
.
start
(
1
)
# first client create a stable and insert data
tdLog
.
sleep
(
2
)
# first client create a stable and insert data
conn1
=
taos
.
connect
(
host
=
self
.
host
,
user
=
self
.
user
,
password
=
self
.
password
,
config
=
tdDnodes
.
getSimCfgPath
())
cursor1
=
conn1
.
cursor
()
cursor1
.
execute
(
"drop database if exists db"
)
...
...
@@ -90,6 +91,8 @@ class TwoClients:
cursor2
.
close
()
conn1
.
close
()
conn2
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
clients
=
TwoClients
()
clients
.
initConnection
()
...
...
tests/pytest/fulltest.sh
浏览文件 @
8a358c66
...
...
@@ -313,7 +313,7 @@ python3 testNoCompress.py
python3 testMinTablesPerVnode.py
python3 queryCount.py
python3 ./test.py
-f
query/queryGroupbyWithInterval.py
#
python3 client/twoClients.py
python3 client/twoClients.py
python3 test.py
-f
query/queryInterval.py
python3 test.py
-f
query/queryFillTest.py
# subscribe
...
...
tests/pytest/insert/insertJSONPayload.py
浏览文件 @
8a358c66
...
...
@@ -36,7 +36,7 @@ class TDTestCase:
print
(
"============= step0 : test metric ================"
)
payload
=
[
'''
{
"metric": "
`.stb.0.`
",
"metric": "
.stb.0.
",
"timestamp": 1626006833610,
"value": 10,
"tags": {
...
...
@@ -664,6 +664,183 @@ class TDTestCase:
tdSql
.
checkData
(
9
,
1
,
"BINARY"
)
tdSql
.
checkData
(
10
,
1
,
"NCHAR"
)
### special characters ###
payload
=
[
'''
{
"metric": "1234",
"timestamp": 1626006833,
"value": 1,
"tags": {
"id": "123",
"456": true,
"int": false,
"double": 1,
"into": 1,
"from": 2,
"!@#$.%^&*()": "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>"
}
}
'''
]
code
=
self
.
_conn
.
schemaless_insert
(
payload
,
TDSmlProtocolType
.
JSON
.
value
,
TDSmlTimestampType
.
NOT_CONFIGURED
.
value
)
print
(
"schemaless_insert result {}"
.
format
(
code
))
tdSql
.
query
(
"describe `1234`"
)
tdSql
.
checkRows
(
8
)
tdSql
.
query
(
"select * from `123`"
)
tdSql
.
checkRows
(
1
)
payload
=
[
'''
{
"metric": "int",
"timestamp": 1626006833,
"value": 1,
"tags": {
"id": "and",
"456": true,
"int": false,
"double": 1,
"into": 1,
"from": 2,
"!@#$.%^&*()": "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>"
}
}
'''
]
code
=
self
.
_conn
.
schemaless_insert
(
payload
,
TDSmlProtocolType
.
JSON
.
value
,
TDSmlTimestampType
.
NOT_CONFIGURED
.
value
)
print
(
"schemaless_insert result {}"
.
format
(
code
))
tdSql
.
query
(
"describe `int`"
)
tdSql
.
checkRows
(
8
)
tdSql
.
query
(
"select * from `and`"
)
tdSql
.
checkRows
(
1
)
payload
=
[
'''
{
"metric": "double",
"timestamp": 1626006833,
"value": 1,
"tags": {
"id": "for",
"456": true,
"int": false,
"double": 1,
"into": 1,
"from": 2,
"!@#$.%^&*()": "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>"
}
}
'''
]
code
=
self
.
_conn
.
schemaless_insert
(
payload
,
TDSmlProtocolType
.
JSON
.
value
,
TDSmlTimestampType
.
NOT_CONFIGURED
.
value
)
print
(
"schemaless_insert result {}"
.
format
(
code
))
tdSql
.
query
(
"describe `double`"
)
tdSql
.
checkRows
(
8
)
tdSql
.
query
(
"select * from `for`"
)
tdSql
.
checkRows
(
1
)
payload
=
[
'''
{
"metric": "from",
"timestamp": 1626006833,
"value": 1,
"tags": {
"id": "!@#.^&",
"456": true,
"int": false,
"double": 1,
"into": 1,
"from": 2,
"!@#$.%^&*()": "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>"
}
}
'''
]
code
=
self
.
_conn
.
schemaless_insert
(
payload
,
TDSmlProtocolType
.
JSON
.
value
,
TDSmlTimestampType
.
NOT_CONFIGURED
.
value
)
print
(
"schemaless_insert result {}"
.
format
(
code
))
tdSql
.
query
(
"describe `from`"
)
tdSql
.
checkRows
(
8
)
tdSql
.
query
(
"select * from `!@#.^&`"
)
tdSql
.
checkRows
(
1
)
payload
=
[
'''
{
"metric": "!@#$.%^&*()",
"timestamp": 1626006833,
"value": 1,
"tags": {
"id": "none",
"456": true,
"int": false,
"double": 1,
"into": 1,
"from": 2,
"!@#$.%^&*()": "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>"
}
}
'''
]
code
=
self
.
_conn
.
schemaless_insert
(
payload
,
TDSmlProtocolType
.
JSON
.
value
,
TDSmlTimestampType
.
NOT_CONFIGURED
.
value
)
print
(
"schemaless_insert result {}"
.
format
(
code
))
tdSql
.
query
(
"describe `!@#$.%^&*()`"
)
tdSql
.
checkRows
(
8
)
tdSql
.
query
(
"select * from `none`"
)
tdSql
.
checkRows
(
1
)
payload
=
[
'''
{
"metric": "STABLE",
"timestamp": {
"value": 1626006833,
"type": "s"
},
"value": {
"value": "hello",
"type": "nchar"
},
"tags": {
"id": "KEY",
"456": {
"value": true,
"type": "bool"
},
"int": {
"value": 127,
"type": "tinyint"
},
"double":{
"value": 32767,
"type": "smallint"
},
"into": {
"value": 2147483647,
"type": "int"
},
"INSERT": {
"value": 9.2233720368547758e+18,
"type": "bigint"
},
"!@#$.%^&*()": {
"value": 11.12345,
"type": "float"
}
}
}
'''
]
code
=
self
.
_conn
.
schemaless_insert
(
payload
,
TDSmlProtocolType
.
JSON
.
value
,
TDSmlTimestampType
.
NOT_CONFIGURED
.
value
)
print
(
"schemaless_insert result {}"
.
format
(
code
))
tdSql
.
query
(
"describe `stable`"
)
tdSql
.
checkRows
(
8
)
tdSql
.
query
(
"select * from `key`"
)
tdSql
.
checkRows
(
1
)
def
stop
(
self
):
tdSql
.
close
()
...
...
tests/pytest/insert/insertTelnetLines.py
浏览文件 @
8a358c66
...
...
@@ -35,7 +35,7 @@ class TDTestCase:
"stb0_0 1626006833639000000ns 4i8 host=
\"
host0
\"
interface=
\"
eth0
\"
"
,
"stb0_1 1626006833639000000ns 4i8 host=
\"
host0
\"
interface=
\"
eth0
\"
"
,
"stb0_2 1626006833639000000ns 4i8 host=
\"
host0
\"
interface=
\"
eth0
\"
"
,
"
`.stb0.3.`
1626006833639000000ns 4i8 host=
\"
host0
\"
interface=
\"
eth0
\"
"
,
"
.stb0.3.
1626006833639000000ns 4i8 host=
\"
host0
\"
interface=
\"
eth0
\"
"
,
]
code
=
self
.
_conn
.
schemaless_insert
(
lines0
,
TDSmlProtocolType
.
TELNET
.
value
,
TDSmlTimestampType
.
NOT_CONFIGURED
.
value
)
...
...
@@ -59,28 +59,24 @@ class TDTestCase:
### timestamp ###
print
(
"============= step2 : test timestamp ================"
)
lines1
=
[
"stb1 1626006833s 1i8 host=
\"
host0
\"
"
,
"stb1 1626006833639000000ns 2i8 host=
\"
host0
\"
"
,
"stb1 1626006833640000us 3i8 host=
\"
host0
\"
"
,
"stb1 1626006833641 4i8 host=
\"
host0
\"
"
,
"stb1 1626006834 5i8 host=
\"
host0
\"
"
,
"stb1 1626006833651ms 6i8 host=
\"
host0
\"
"
,
"stb1 0 7i8 host=
\"
host0
\"
"
,
"stb1 1626006833641 1i8 host=
\"
host0
\"
"
,
"stb1 1626006834 2i8 host=
\"
host0
\"
"
,
"stb1 0 3i8 host=
\"
host0
\"
"
,
]
code
=
self
.
_conn
.
schemaless_insert
(
lines1
,
TDSmlProtocolType
.
TELNET
.
value
,
TDSmlTimestampType
.
NOT_CONFIGURED
.
value
)
print
(
"schemaless_insert result {}"
.
format
(
code
))
tdSql
.
query
(
"select * from stb1"
)
tdSql
.
checkRows
(
7
)
tdSql
.
checkRows
(
3
)
### metric value ###
print
(
"============= step3 : test metric value ================"
)
#tinyint
lines2_0
=
[
"stb2_0 1626006833651
ms
-127i8 host=
\"
host0
\"
"
,
"stb2_0 1626006833652
ms
127i8 host=
\"
host0
\"
"
"stb2_0 1626006833651 -127i8 host=
\"
host0
\"
"
,
"stb2_0 1626006833652 127i8 host=
\"
host0
\"
"
]
code
=
self
.
_conn
.
schemaless_insert
(
lines2_0
,
TDSmlProtocolType
.
TELNET
.
value
,
TDSmlTimestampType
.
NOT_CONFIGURED
.
value
)
print
(
"schemaless_insert result {}"
.
format
(
code
))
...
...
@@ -94,8 +90,8 @@ class TDTestCase:
#smallint
lines2_1
=
[
"stb2_1 1626006833651
ms
-32767i16 host=
\"
host0
\"
"
,
"stb2_1 1626006833652
ms
32767i16 host=
\"
host0
\"
"
"stb2_1 1626006833651 -32767i16 host=
\"
host0
\"
"
,
"stb2_1 1626006833652 32767i16 host=
\"
host0
\"
"
]
code
=
self
.
_conn
.
schemaless_insert
(
lines2_1
,
TDSmlProtocolType
.
TELNET
.
value
,
TDSmlTimestampType
.
NOT_CONFIGURED
.
value
)
print
(
"schemaless_insert result {}"
.
format
(
code
))
...
...
@@ -109,8 +105,8 @@ class TDTestCase:
#int
lines2_2
=
[
"stb2_2 1626006833651
ms
-2147483647i32 host=
\"
host0
\"
"
,
"stb2_2 1626006833652
ms
2147483647i32 host=
\"
host0
\"
"
"stb2_2 1626006833651 -2147483647i32 host=
\"
host0
\"
"
,
"stb2_2 1626006833652 2147483647i32 host=
\"
host0
\"
"
]
code
=
self
.
_conn
.
schemaless_insert
(
lines2_2
,
TDSmlProtocolType
.
TELNET
.
value
,
TDSmlTimestampType
.
NOT_CONFIGURED
.
value
)
...
...
@@ -125,8 +121,8 @@ class TDTestCase:
#bigint
lines2_3
=
[
"stb2_3 1626006833651
ms
-9223372036854775807i64 host=
\"
host0
\"
"
,
"stb2_3 1626006833652
ms
9223372036854775807i64 host=
\"
host0
\"
"
"stb2_3 1626006833651 -9223372036854775807i64 host=
\"
host0
\"
"
,
"stb2_3 1626006833652 9223372036854775807i64 host=
\"
host0
\"
"
]
code
=
self
.
_conn
.
schemaless_insert
(
lines2_3
,
TDSmlProtocolType
.
TELNET
.
value
,
TDSmlTimestampType
.
NOT_CONFIGURED
.
value
)
...
...
@@ -141,16 +137,16 @@ class TDTestCase:
#float
lines2_4
=
[
"stb2_4 1626006833610
ms
3f32 host=
\"
host0
\"
"
,
"stb2_4 1626006833620
ms
-3f32 host=
\"
host0
\"
"
,
"stb2_4 1626006833630
ms
3.4f32 host=
\"
host0
\"
"
,
"stb2_4 1626006833640
ms
-3.4f32 host=
\"
host0
\"
"
,
"stb2_4 1626006833650
ms
3.4E10f32 host=
\"
host0
\"
"
,
"stb2_4 1626006833660
ms
-3.4e10f32 host=
\"
host0
\"
"
,
"stb2_4 1626006833670
ms
3.4E+2f32 host=
\"
host0
\"
"
,
"stb2_4 1626006833680
ms
-3.4e-2f32 host=
\"
host0
\"
"
,
"stb2_4 1626006833700
ms
3.4E38f32 host=
\"
host0
\"
"
,
"stb2_4 1626006833710
ms
-3.4E38f32 host=
\"
host0
\"
"
"stb2_4 1626006833610 3f32 host=
\"
host0
\"
"
,
"stb2_4 1626006833620 -3f32 host=
\"
host0
\"
"
,
"stb2_4 1626006833630 3.4f32 host=
\"
host0
\"
"
,
"stb2_4 1626006833640 -3.4f32 host=
\"
host0
\"
"
,
"stb2_4 1626006833650 3.4E10f32 host=
\"
host0
\"
"
,
"stb2_4 1626006833660 -3.4e10f32 host=
\"
host0
\"
"
,
"stb2_4 1626006833670 3.4E+2f32 host=
\"
host0
\"
"
,
"stb2_4 1626006833680 -3.4e-2f32 host=
\"
host0
\"
"
,
"stb2_4 1626006833700 3.4E38f32 host=
\"
host0
\"
"
,
"stb2_4 1626006833710 -3.4E38f32 host=
\"
host0
\"
"
]
code
=
self
.
_conn
.
schemaless_insert
(
lines2_4
,
TDSmlProtocolType
.
TELNET
.
value
,
TDSmlTimestampType
.
NOT_CONFIGURED
.
value
)
...
...
@@ -165,17 +161,17 @@ class TDTestCase:
#double
lines2_5
=
[
"stb2_5 1626006833610
ms
3f64 host=
\"
host0
\"
"
,
"stb2_5 1626006833620
ms
-3f64 host=
\"
host0
\"
"
,
"stb2_5 1626006833630
ms
3.4f64 host=
\"
host0
\"
"
,
"stb2_5 1626006833640
ms
-3.4f64 host=
\"
host0
\"
"
,
"stb2_5 1626006833650
ms
3.4E10f64 host=
\"
host0
\"
"
,
"stb2_5 1626006833660
ms
-3.4e10f64 host=
\"
host0
\"
"
,
"stb2_5 1626006833670
ms
3.4E+2f64 host=
\"
host0
\"
"
,
"stb2_5 1626006833680
ms
-3.4e-2f64 host=
\"
host0
\"
"
,
"stb2_5 1626006833690
ms
1.7E308f64 host=
\"
host0
\"
"
,
"stb2_5 1626006833700
ms
-1.7E308f64 host=
\"
host0
\"
"
,
"stb2_5 1626006833710
ms
3 host=
\"
host0
\"
"
"stb2_5 1626006833610 3f64 host=
\"
host0
\"
"
,
"stb2_5 1626006833620 -3f64 host=
\"
host0
\"
"
,
"stb2_5 1626006833630 3.4f64 host=
\"
host0
\"
"
,
"stb2_5 1626006833640 -3.4f64 host=
\"
host0
\"
"
,
"stb2_5 1626006833650 3.4E10f64 host=
\"
host0
\"
"
,
"stb2_5 1626006833660 -3.4e10f64 host=
\"
host0
\"
"
,
"stb2_5 1626006833670 3.4E+2f64 host=
\"
host0
\"
"
,
"stb2_5 1626006833680 -3.4e-2f64 host=
\"
host0
\"
"
,
"stb2_5 1626006833690 1.7E308f64 host=
\"
host0
\"
"
,
"stb2_5 1626006833700 -1.7E308f64 host=
\"
host0
\"
"
,
"stb2_5 1626006833710 3 host=
\"
host0
\"
"
]
code
=
self
.
_conn
.
schemaless_insert
(
lines2_5
,
TDSmlProtocolType
.
TELNET
.
value
,
TDSmlTimestampType
.
NOT_CONFIGURED
.
value
)
...
...
@@ -190,16 +186,16 @@ class TDTestCase:
#bool
lines2_6
=
[
"stb2_6 1626006833610
ms
t host=
\"
host0
\"
"
,
"stb2_6 1626006833620
ms
T host=
\"
host0
\"
"
,
"stb2_6 1626006833630
ms
true host=
\"
host0
\"
"
,
"stb2_6 1626006833640
ms
True host=
\"
host0
\"
"
,
"stb2_6 1626006833650
ms
TRUE host=
\"
host0
\"
"
,
"stb2_6 1626006833660
ms
f host=
\"
host0
\"
"
,
"stb2_6 1626006833670
ms
F host=
\"
host0
\"
"
,
"stb2_6 1626006833680
ms
false host=
\"
host0
\"
"
,
"stb2_6 1626006833690
ms
False host=
\"
host0
\"
"
,
"stb2_6 1626006833700
ms
FALSE host=
\"
host0
\"
"
"stb2_6 1626006833610 t host=
\"
host0
\"
"
,
"stb2_6 1626006833620 T host=
\"
host0
\"
"
,
"stb2_6 1626006833630 true host=
\"
host0
\"
"
,
"stb2_6 1626006833640 True host=
\"
host0
\"
"
,
"stb2_6 1626006833650 TRUE host=
\"
host0
\"
"
,
"stb2_6 1626006833660 f host=
\"
host0
\"
"
,
"stb2_6 1626006833670 F host=
\"
host0
\"
"
,
"stb2_6 1626006833680 false host=
\"
host0
\"
"
,
"stb2_6 1626006833690 False host=
\"
host0
\"
"
,
"stb2_6 1626006833700 FALSE host=
\"
host0
\"
"
]
code
=
self
.
_conn
.
schemaless_insert
(
lines2_6
,
TDSmlProtocolType
.
TELNET
.
value
,
TDSmlTimestampType
.
NOT_CONFIGURED
.
value
)
...
...
@@ -214,9 +210,9 @@ class TDTestCase:
#binary
lines2_7
=
[
"stb2_7 1626006833610
ms
\"
binary_val .!@#$%^&*
\"
host=
\"
host0
\"
"
,
"stb2_7 1626006833620
ms
\"
binary_val.:;,./?|+-=
\"
host=
\"
host0
\"
"
,
"stb2_7 1626006833630
ms
\"
binary_val.()[]{}<>
\"
host=
\"
host0
\"
"
"stb2_7 1626006833610
\"
binary_val .!@#$%^&*
\"
host=
\"
host0
\"
"
,
"stb2_7 1626006833620
\"
binary_val.:;,./?|+-=
\"
host=
\"
host0
\"
"
,
"stb2_7 1626006833630
\"
binary_val.()[]{}<>
\"
host=
\"
host0
\"
"
]
code
=
self
.
_conn
.
schemaless_insert
(
lines2_7
,
TDSmlProtocolType
.
TELNET
.
value
,
TDSmlTimestampType
.
NOT_CONFIGURED
.
value
)
...
...
@@ -231,8 +227,8 @@ class TDTestCase:
#nchar
lines2_8
=
[
"stb2_8 1626006833610
ms
L
\"
nchar_val 数值一
\"
host=
\"
host0
\"
"
,
"stb2_8 1626006833620
ms
L
\"
nchar_val数值二
\"
host=
\"
host0
\"
"
"stb2_8 1626006833610 L
\"
nchar_val 数值一
\"
host=
\"
host0
\"
"
,
"stb2_8 1626006833620 L
\"
nchar_val数值二
\"
host=
\"
host0
\"
"
]
code
=
self
.
_conn
.
schemaless_insert
(
lines2_8
,
TDSmlProtocolType
.
TELNET
.
value
,
TDSmlTimestampType
.
NOT_CONFIGURED
.
value
)
...
...
@@ -249,8 +245,8 @@ class TDTestCase:
print
(
"============= step3 : test tags ================"
)
#tag value types
lines3_0
=
[
"stb3_0 1626006833610
ms
1 t1=127i8 t2=32767i16 t3=2147483647i32 t4=9223372036854775807i64 t5=3.4E38f32 t6=1.7E308f64 t7=true t8=
\"
binary_val_1
\"
t9=L
\"
标签值1
\"
"
,
"stb3_0 1626006833610
ms
2 t1=-127i8 t2=-32767i16 t3=-2147483647i32 t4=-9223372036854775807i64 t5=-3.4E38f32 t6=-1.7E308f64 t7=false t8=
\"
binary_val_2
\"
t9=L
\"
标签值2
\"
"
"stb3_0 1626006833610 1 t1=127i8 t2=32767i16 t3=2147483647i32 t4=9223372036854775807i64 t5=3.4E38f32 t6=1.7E308f64 t7=true t8=
\"
binary_val_1
\"
t9=L
\"
标签值1
\"
"
,
"stb3_0 1626006833610 2 t1=-127i8 t2=-32767i16 t3=-2147483647i32 t4=-9223372036854775807i64 t5=-3.4E38f32 t6=-1.7E308f64 t7=false t8=
\"
binary_val_2
\"
t9=L
\"
标签值2
\"
"
]
code
=
self
.
_conn
.
schemaless_insert
(
lines3_0
,
TDSmlProtocolType
.
TELNET
.
value
,
TDSmlTimestampType
.
NOT_CONFIGURED
.
value
)
...
...
@@ -292,9 +288,9 @@ class TDTestCase:
#tag ID as child table name
lines3_1
=
[
"stb3_1 1626006833610
ms
1 id=child_table1 host=host1"
,
"stb3_1 1626006833610
ms
2 host=host2 iD=child_table2"
,
"stb3_1 1626006833610
ms
3 ID=child_table3 host=host3"
"stb3_1 1626006833610 1 id=child_table1 host=host1"
,
"stb3_1 1626006833610 2 host=host2 iD=child_table2"
,
"stb3_1 1626006833610 3 ID=child_table3 host=host3"
]
code
=
self
.
_conn
.
schemaless_insert
(
lines3_1
,
TDSmlProtocolType
.
TELNET
.
value
,
TDSmlTimestampType
.
NOT_CONFIGURED
.
value
)
...
...
@@ -308,6 +304,56 @@ class TDTestCase:
tdSql
.
checkData
(
0
,
0
,
"child_table1"
)
### special characters and keywords ###
print
(
"============= step4 : test special characters and keywords ================"
)
lines4_1
=
[
"1234 1626006833610ms 1 id=123 456=true int=true double=false into=1 from=2 !@#$.%^&*()=false"
,
"int 1626006833610ms 2 id=and 456=true int=true double=false into=1 from=2 !@#$.%^&*()=false"
,
"double 1626006833610ms 2 id=for 456=true int=true double=false into=1 from=2 !@#$.%^&*()=false"
,
"from 1626006833610ms 2 id=!@#.^& 456=true int=true double=false into=1 from=2 !@#$.%^&*()=false"
,
"!@#$.%^&*() 1626006833610ms 2 id=none 456=true int=true double=false into=1 from=2 !@#$.%^&*()=false"
,
"STABLE 1626006833610ms 2 id=KEY 456=true int=true double=false TAG=1 FROM=2 COLUMN=false"
,
]
code
=
self
.
_conn
.
schemaless_insert
(
lines4_1
,
TDSmlProtocolType
.
TELNET
.
value
,
TDSmlTimestampType
.
NOT_CONFIGURED
.
value
)
print
(
"schemaless_insert result {}"
.
format
(
code
))
tdSql
.
query
(
'describe `1234`'
)
tdSql
.
checkRows
(
8
)
tdSql
.
query
(
'describe `int`'
)
tdSql
.
checkRows
(
8
)
tdSql
.
query
(
'describe `double`'
)
tdSql
.
checkRows
(
8
)
tdSql
.
query
(
'describe `from`'
)
tdSql
.
checkRows
(
8
)
tdSql
.
query
(
'describe `!@#$.%^&*()`'
)
tdSql
.
checkRows
(
8
)
tdSql
.
query
(
'describe `stable`'
)
tdSql
.
checkRows
(
8
)
tdSql
.
query
(
'select * from `123`'
)
tdSql
.
checkRows
(
1
)
tdSql
.
query
(
'select * from `and`'
)
tdSql
.
checkRows
(
1
)
tdSql
.
query
(
'select * from `for`'
)
tdSql
.
checkRows
(
1
)
tdSql
.
query
(
'select * from `!@#.^&`'
)
tdSql
.
checkRows
(
1
)
tdSql
.
query
(
'select * from `none`'
)
tdSql
.
checkRows
(
1
)
tdSql
.
query
(
'select * from `key`'
)
tdSql
.
checkRows
(
1
)
def
stop
(
self
):
tdSql
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
...
...
tests/pytest/insert/line_insert.py
浏览文件 @
8a358c66
...
...
@@ -85,6 +85,53 @@ class TDTestCase:
tdSql
.
query
(
'select tbname, * from childtable'
)
tdSql
.
checkRows
(
1
)
###Special Character and keyss
self
.
_conn
.
schemaless_insert
([
"1234,id=3456,abc=4i64,def=3i64 123=3i64,int=2i64,bool=false,into=5f64,column=7u64,!@#$.%^&*()=false 1626006933641"
,
"int,id=and,123=4i64,smallint=5f64,double=5f64,of=3i64,key=L
\"
passitagin_stf
\"
,!@#$.%^&*()=false abc=false 1626006933654"
,
"double,id=for,123=4i64,smallint=5f64,double=5f64,of=3i64,key=L
\"
passitagin_stf
\"
,!@#$.%^&*()=false abc=false 1626006933664"
,
"from,id=!@#$.%^,123=4i64,smallint=5f64,double=5f64,of=3i64,key=L
\"
passitagin_stf
\"
,!@#$.%^&*()=false abc=false 1626006933674"
,
"!@#$.%^&*(),id=none,123=4i64,smallint=5f64,double=5f64,of=3i64,key=L
\"
passitagin_stf
\"
,!@#$.%^&*()=false abc=false 1626006933684"
,
"STABLE,id=CREATE,123=4i64,smallint=5f64,DOUBLE=5f64,of=3i64,key=L
\"
passitagin_stf
\"
,!@#$.%^&*()=false SELECT=false 1626006933684"
,
],
TDSmlProtocolType
.
LINE
.
value
,
TDSmlTimestampType
.
MILLI_SECOND
.
value
)
tdSql
.
execute
(
'reset query cache'
)
tdSql
.
query
(
'describe `1234`'
)
tdSql
.
checkRows
(
9
)
tdSql
.
query
(
'describe `int`'
)
tdSql
.
checkRows
(
8
)
tdSql
.
query
(
'describe `double`'
)
tdSql
.
checkRows
(
8
)
tdSql
.
query
(
'describe `from`'
)
tdSql
.
checkRows
(
8
)
tdSql
.
query
(
'describe `!@#$.%^&*()`'
)
tdSql
.
checkRows
(
8
)
tdSql
.
query
(
'describe `stable`'
)
tdSql
.
checkRows
(
8
)
tdSql
.
query
(
'select * from `3456`'
)
tdSql
.
checkRows
(
1
)
tdSql
.
query
(
'select * from `and`'
)
tdSql
.
checkRows
(
1
)
tdSql
.
query
(
'select * from `for`'
)
tdSql
.
checkRows
(
1
)
tdSql
.
query
(
'select * from `!@#$.%^`'
)
tdSql
.
checkRows
(
1
)
tdSql
.
query
(
'select * from `none`'
)
tdSql
.
checkRows
(
1
)
tdSql
.
query
(
'select * from `create`'
)
tdSql
.
checkRows
(
1
)
def
stop
(
self
):
tdSql
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
...
...
tests/pytest/tools/taosdemoAllTest/TD-3453/query-interrupt.json
浏览文件 @
8a358c66
...
...
@@ -22,7 +22,7 @@
"cache"
:
50
,
"blocks"
:
8
,
"precision"
:
"ms"
,
"keep"
:
365
,
"keep"
:
365
00
,
"minRows"
:
100
,
"maxRows"
:
4096
,
"comp"
:
2
,
...
...
@@ -36,7 +36,7 @@
"name"
:
"stb0"
,
"child_table_exists"
:
"no"
,
"childtable_count"
:
60
,
"childtable_prefix"
:
"stb00_"
,
"childtable_prefix"
:
"stb00_"
,
"auto_create_table"
:
"no"
,
"batch_create_tbl_num"
:
20
,
"data_source"
:
"rand"
,
...
...
tests/pytest/tools/taosdemoAllTest/taosdemoInsertMSDB.json
浏览文件 @
8a358c66
...
...
@@ -22,7 +22,7 @@
"cache"
:
50
,
"blocks"
:
8
,
"precision"
:
"ms"
,
"keep"
:
36
,
"keep"
:
36
500
,
"minRows"
:
100
,
"maxRows"
:
4096
,
"comp"
:
2
,
...
...
tests/pytest/tools/taosdemoAllTest/taosdemoInsertNanoDB.json
浏览文件 @
8a358c66
...
...
@@ -22,7 +22,7 @@
"cache"
:
50
,
"blocks"
:
8
,
"precision"
:
"ns"
,
"keep"
:
36
,
"keep"
:
36
500
,
"minRows"
:
100
,
"maxRows"
:
4096
,
"comp"
:
2
,
...
...
tests/pytest/tools/taosdemoAllTest/taosdemoInsertUSDB.json
浏览文件 @
8a358c66
...
...
@@ -22,7 +22,7 @@
"cache"
:
50
,
"blocks"
:
8
,
"precision"
:
"us"
,
"keep"
:
36
,
"keep"
:
36
500
,
"minRows"
:
100
,
"maxRows"
:
4096
,
"comp"
:
2
,
...
...
tests/pytest/tools/taosdemoAllTest/taosdemoTestNanoDatabase.json
浏览文件 @
8a358c66
...
...
@@ -22,7 +22,7 @@
"cache"
:
50
,
"blocks"
:
8
,
"precision"
:
"ns"
,
"keep"
:
36
,
"keep"
:
36
500
,
"minRows"
:
100
,
"maxRows"
:
4096
,
"comp"
:
2
,
...
...
tests/pytest/tools/taosdemoAllTest/taosdemoTestNanoDatabaseInsertForSub.json
浏览文件 @
8a358c66
...
...
@@ -22,7 +22,7 @@
"cache"
:
50
,
"blocks"
:
8
,
"precision"
:
"ns"
,
"keep"
:
36
,
"keep"
:
36
500
,
"minRows"
:
100
,
"maxRows"
:
4096
,
"comp"
:
2
,
...
...
tests/pytest/tools/taosdemoAllTest/taosdemoTestNanoDatabaseNow.json
浏览文件 @
8a358c66
...
...
@@ -22,7 +22,7 @@
"cache"
:
50
,
"blocks"
:
8
,
"precision"
:
"ns"
,
"keep"
:
36
,
"keep"
:
36
500
,
"minRows"
:
100
,
"maxRows"
:
4096
,
"comp"
:
2
,
...
...
tests/pytest/tools/taosdemoAllTest/taosdemoTestNanoDatabasecsv.json
浏览文件 @
8a358c66
...
...
@@ -22,7 +22,7 @@
"cache"
:
50
,
"blocks"
:
8
,
"precision"
:
"ns"
,
"keep"
:
36
,
"keep"
:
36
500
,
"minRows"
:
100
,
"maxRows"
:
4096
,
"comp"
:
2
,
...
...
tests/pytest/tools/taosdemoAllTest/taosdemoTestQueryWithJson.py
浏览文件 @
8a358c66
...
...
@@ -20,14 +20,16 @@ from util.dnodes import *
import
time
from
datetime
import
datetime
import
ast
import
re
# from assertpy import assert_that
import
subprocess
class
TDTestCase
:
def
init
(
self
,
conn
,
logSql
):
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdSql
.
init
(
conn
.
cursor
(),
logSql
)
def
getBuildPath
(
self
):
selfPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
...
...
@@ -40,52 +42,54 @@ class TDTestCase:
if
(
"taosd"
in
files
):
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
if
(
"packaging"
not
in
rootRealPath
):
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
break
return
buildPath
# 获取taosc接口查询的结果文件中的内容,返回每行数据,并断言数据的第一列内容。
def
assertfileDataTaosc
(
self
,
filename
,
expectResult
):
def
assertfileDataTaosc
(
self
,
filename
,
expectResult
):
self
.
filename
=
filename
self
.
expectResult
=
expectResult
with
open
(
"%s"
%
filename
,
'r+'
)
as
f1
:
with
open
(
"%s"
%
filename
,
'r+'
)
as
f1
:
for
line
in
f1
.
readlines
():
queryResult
=
line
.
strip
().
split
()[
0
]
self
.
assertCheck
(
filename
,
queryResult
,
expectResult
)
self
.
assertCheck
(
filename
,
queryResult
,
expectResult
)
# 获取restful接口查询的结果文件中的关键内容,目前的关键内容找到第一个key就跳出循,所以就只有一个数据。后续再修改多个结果文件。
def
getfileDataRestful
(
self
,
filename
):
def
getfileDataRestful
(
self
,
filename
):
self
.
filename
=
filename
with
open
(
"%s"
%
filename
,
'r+'
)
as
f1
:
with
open
(
"%s"
%
filename
,
'r+'
)
as
f1
:
for
line
in
f1
.
readlines
():
contents
=
line
.
strip
()
if
contents
.
find
(
"data"
)
!=
-
1
:
pattern
=
re
.
compile
(
"{.*}"
)
contents
=
pattern
.
search
(
contents
).
group
()
contentsDict
=
ast
.
literal_eval
(
contents
)
# 字符串转换为字典
queryResult
=
contentsDict
[
'data'
][
0
][
0
]
break
return
queryResult
# 获取taosc接口查询次数
def
queryTimesTaosc
(
self
,
filename
):
def
queryTimesTaosc
(
self
,
filename
):
self
.
filename
=
filename
command
=
'cat %s |wc -l'
%
filename
times
=
int
(
subprocess
.
getstatusoutput
(
command
)[
1
])
command
=
'cat %s |wc -l'
%
filename
times
=
int
(
subprocess
.
getstatusoutput
(
command
)[
1
])
return
times
# 获取restful接口查询次数
def
queryTimesRestful
(
self
,
filename
):
def
queryTimesRestful
(
self
,
filename
):
self
.
filename
=
filename
command
=
'cat %s |grep "200 OK" |wc -l'
%
filename
times
=
int
(
subprocess
.
getstatusoutput
(
command
)[
1
])
command
=
'cat %s |grep "200 OK" |wc -l'
%
filename
times
=
int
(
subprocess
.
getstatusoutput
(
command
)[
1
])
return
times
# 定义断言结果是否正确。不正确返回错误结果,正确即通过。
def
assertCheck
(
self
,
filename
,
queryResult
,
expectResult
):
def
assertCheck
(
self
,
filename
,
queryResult
,
expectResult
):
self
.
filename
=
filename
self
.
queryResult
=
queryResult
self
.
expectResult
=
expectResult
args0
=
(
filename
,
queryResult
,
expectResult
)
assert
queryResult
==
expectResult
,
"Queryfile:%s ,result is %s != expect: %s"
%
args0
assert
queryResult
==
expectResult
,
"Queryfile:%s ,result is %s != expect: %s"
%
args0
def
run
(
self
):
buildPath
=
self
.
getBuildPath
()
...
...
@@ -93,109 +97,144 @@ class TDTestCase:
tdLog
.
exit
(
"taosd not found!"
)
else
:
tdLog
.
info
(
"taosd found in %s"
%
buildPath
)
binPath
=
buildPath
+
"/build/bin/"
binPath
=
buildPath
+
"/build/bin/"
# delete useless files
os
.
system
(
"rm -rf ./query_res*"
)
os
.
system
(
"rm -rf ./query_res*"
)
os
.
system
(
"rm -rf ./all_query*"
)
# taosc query: query specified table and query super table
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/queryInsertdata.json"
%
binPath
)
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/queryTaosc.json"
%
binPath
)
# taosc query: query specified table and query super table
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/queryInsertdata.json"
%
binPath
)
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/queryTaosc.json"
%
binPath
)
os
.
system
(
"cat query_res0.txt* > all_query_res0_taosc.txt"
)
os
.
system
(
"cat query_res1.txt* > all_query_res1_taosc.txt"
)
os
.
system
(
"cat query_res2.txt* > all_query_res2_taosc.txt"
)
# correct Times testcases
# correct Times testcases
queryTimes0Taosc
=
self
.
queryTimesTaosc
(
"all_query_res0_taosc.txt"
)
self
.
assertCheck
(
"all_query_res0_taosc.txt"
,
queryTimes0Taosc
,
6
)
self
.
assertCheck
(
"all_query_res0_taosc.txt"
,
queryTimes0Taosc
,
6
)
queryTimes1Taosc
=
self
.
queryTimesTaosc
(
"all_query_res1_taosc.txt"
)
self
.
assertCheck
(
"all_query_res1_taosc.txt"
,
queryTimes1Taosc
,
6
)
self
.
assertCheck
(
"all_query_res1_taosc.txt"
,
queryTimes1Taosc
,
6
)
queryTimes2Taosc
=
self
.
queryTimesTaosc
(
"all_query_res2_taosc.txt"
)
self
.
assertCheck
(
"all_query_res2_taosc.txt"
,
queryTimes2Taosc
,
20
)
self
.
assertCheck
(
"all_query_res2_taosc.txt"
,
queryTimes2Taosc
,
20
)
# correct data testcase
self
.
assertfileDataTaosc
(
"all_query_res0_taosc.txt"
,
"1604160000099"
)
self
.
assertfileDataTaosc
(
"all_query_res1_taosc.txt"
,
"100"
)
self
.
assertfileDataTaosc
(
"all_query_res2_taosc.txt"
,
"1604160000199"
)
self
.
assertfileDataTaosc
(
"all_query_res0_taosc.txt"
,
"1604160000099"
)
self
.
assertfileDataTaosc
(
"all_query_res1_taosc.txt"
,
"100"
)
self
.
assertfileDataTaosc
(
"all_query_res2_taosc.txt"
,
"1604160000199"
)
# delete useless files
os
.
system
(
"rm -rf ./query_res*"
)
os
.
system
(
"rm -rf ./query_res*"
)
os
.
system
(
"rm -rf ./all_query*"
)
# use restful api to query
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/queryInsertrestdata.json"
%
binPath
)
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/queryRestful.json"
%
binPath
)
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/queryInsertrestdata.json"
%
binPath
)
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/queryRestful.json"
%
binPath
)
os
.
system
(
"cat query_res0.txt* > all_query_res0_rest.txt"
)
os
.
system
(
"cat query_res1.txt* > all_query_res1_rest.txt"
)
os
.
system
(
"cat query_res2.txt* > all_query_res2_rest.txt"
)
# correct Times testcases
# correct Times testcases
queryTimes0Restful
=
self
.
queryTimesRestful
(
"all_query_res0_rest.txt"
)
self
.
assertCheck
(
"all_query_res0_rest.txt"
,
queryTimes0Restful
,
6
)
self
.
assertCheck
(
"all_query_res0_rest.txt"
,
queryTimes0Restful
,
6
)
queryTimes1Restful
=
self
.
queryTimesRestful
(
"all_query_res1_rest.txt"
)
self
.
assertCheck
(
"all_query_res1_rest.txt"
,
queryTimes1Restful
,
6
)
self
.
assertCheck
(
"all_query_res1_rest.txt"
,
queryTimes1Restful
,
6
)
queryTimes2Restful
=
self
.
queryTimesRestful
(
"all_query_res2_rest.txt"
)
self
.
assertCheck
(
"all_query_res2_rest.txt"
,
queryTimes2Restful
,
4
)
self
.
assertCheck
(
"all_query_res2_rest.txt"
,
queryTimes2Restful
,
4
)
# correct data testcase
data0
=
self
.
getfileDataRestful
(
"all_query_res0_rest.txt"
)
self
.
assertCheck
(
'all_query_res0_rest.txt'
,
data0
,
"2020-11-01 00:00:00.009"
)
self
.
assertCheck
(
'all_query_res0_rest.txt'
,
data0
,
"2020-11-01 00:00:00.009"
)
data1
=
self
.
getfileDataRestful
(
"all_query_res1_rest.txt"
)
self
.
assertCheck
(
'all_query_res1_rest.txt'
,
data1
,
10
)
self
.
assertCheck
(
'all_query_res1_rest.txt'
,
data1
,
10
)
data2
=
self
.
getfileDataRestful
(
"all_query_res2_rest.txt"
)
self
.
assertCheck
(
'all_query_res2_rest.txt'
,
data2
,
"2020-11-01 00:00:00.004"
)
self
.
assertCheck
(
'all_query_res2_rest.txt'
,
data2
,
"2020-11-01 00:00:00.004"
)
# query times less than or equal to 100
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/queryInsertdata.json"
%
binPath
)
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/querySpeciMutisql100.json"
%
binPath
)
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/querySuperMutisql100.json"
%
binPath
)
#query result print QPS
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/queryInsertdata.json"
%
binPath
)
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/queryQps.json"
%
binPath
)
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/queryInsertdata.json"
%
binPath
)
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/querySpeciMutisql100.json"
%
binPath
)
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/querySuperMutisql100.json"
%
binPath
)
# query result print QPS
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/queryInsertdata.json"
%
binPath
)
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/queryQps.json"
%
binPath
)
# use illegal or out of range parameters query json file
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/queryInsertdata.json"
%
binPath
)
exceptcode
=
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/queryTimes0.json"
%
binPath
)
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/queryInsertdata.json"
%
binPath
)
exceptcode
=
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/queryTimes0.json"
%
binPath
)
assert
exceptcode
!=
0
exceptcode0
=
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/queryTimesless0.json"
%
binPath
)
exceptcode0
=
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/queryTimesless0.json"
%
binPath
)
assert
exceptcode0
!=
0
exceptcode1
=
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/queryConcurrentless0.json"
%
binPath
)
exceptcode1
=
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/queryConcurrentless0.json"
%
binPath
)
assert
exceptcode1
!=
0
exceptcode2
=
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/queryConcurrent0.json"
%
binPath
)
exceptcode2
=
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/queryConcurrent0.json"
%
binPath
)
assert
exceptcode2
!=
0
exceptcode3
=
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/querrThreadsless0.json"
%
binPath
)
exceptcode3
=
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/querrThreadsless0.json"
%
binPath
)
assert
exceptcode3
!=
0
exceptcode4
=
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/querrThreads0.json"
%
binPath
)
exceptcode4
=
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/querrThreads0.json"
%
binPath
)
assert
exceptcode4
!=
0
# delete useless files
os
.
system
(
"rm -rf ./insert_res.txt"
)
os
.
system
(
"rm -rf tools/taosdemoAllTest/*.py.sql"
)
os
.
system
(
"rm -rf ./querySystemInfo*"
)
os
.
system
(
"rm -rf ./query_res*"
)
os
.
system
(
"rm -rf ./all_query*"
)
os
.
system
(
"rm -rf tools/taosdemoAllTest/*.py.sql"
)
os
.
system
(
"rm -rf ./querySystemInfo*"
)
os
.
system
(
"rm -rf ./query_res*"
)
#
os.system("rm -rf ./all_query*")
os
.
system
(
"rm -rf ./test_query_res0.txt"
)
def
stop
(
self
):
tdSql
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
tests/pytest/tools/taosdemoAllTest/taosdemoTestSupportNanoInsert.py
浏览文件 @
8a358c66
...
...
@@ -36,7 +36,7 @@ class TDTestCase:
if
(
"taosd"
in
files
):
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
if
(
"packaging"
not
in
rootRealPath
):
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
break
return
buildPath
...
...
@@ -46,14 +46,15 @@ class TDTestCase:
tdLog
.
exit
(
"taosd not found!"
)
else
:
tdLog
.
info
(
"taosd found in %s"
%
buildPath
)
binPath
=
buildPath
+
"/build/bin/"
binPath
=
buildPath
+
"/build/bin/"
# insert: create one or mutiple tables per sql and insert multiple rows per sql
# insert data from a special timestamp
# check stable stb0
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/taosdemoTestNanoDatabase.json -y "
%
binPath
)
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/taosdemoTestNanoDatabase.json -y "
%
binPath
)
tdSql
.
execute
(
"use nsdb"
)
tdSql
.
query
(
"show stables"
)
tdSql
.
checkData
(
0
,
4
,
100
)
...
...
@@ -64,9 +65,9 @@ class TDTestCase:
tdSql
.
query
(
"select count(*) from stb0"
)
tdSql
.
checkData
(
0
,
0
,
10000
)
tdSql
.
query
(
"describe stb0"
)
tdSql
.
checkDataType
(
9
,
1
,
"TIMESTAMP"
)
tdSql
.
checkDataType
(
9
,
1
,
"TIMESTAMP"
)
tdSql
.
query
(
"select last(ts) from stb0"
)
tdSql
.
checkData
(
0
,
0
,
"2021-07-01 00:00:00.990000000"
)
tdSql
.
checkData
(
0
,
0
,
"2021-07-01 00:00:00.990000000"
)
# check stable stb1 which is insert with disord
...
...
@@ -78,16 +79,18 @@ class TDTestCase:
tdSql
.
checkData
(
0
,
0
,
10000
)
# check c8 is an nano timestamp
tdSql
.
query
(
"describe stb1"
)
tdSql
.
checkDataType
(
9
,
1
,
"TIMESTAMP"
)
tdSql
.
checkDataType
(
9
,
1
,
"TIMESTAMP"
)
# check insert timestamp_step is nano_second
tdSql
.
query
(
"select last(ts) from stb1"
)
tdSql
.
checkData
(
0
,
0
,
"2021-07-01 00:00:00.990000000"
)
tdSql
.
checkData
(
0
,
0
,
"2021-07-01 00:00:00.990000000"
)
# insert data from now time
# check stable stb0
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/taosdemoTestNanoDatabaseNow.json -y "
%
binPath
)
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/taosdemoTestNanoDatabaseNow.json -y "
%
binPath
)
tdSql
.
execute
(
"use nsdb2"
)
tdSql
.
query
(
"show stables"
)
tdSql
.
checkData
(
0
,
4
,
100
)
...
...
@@ -99,11 +102,14 @@ class TDTestCase:
tdSql
.
checkData
(
0
,
0
,
10000
)
# check c8 is an nano timestamp
tdSql
.
query
(
"describe stb0"
)
tdSql
.
checkDataType
(
9
,
1
,
"TIMESTAMP"
)
tdSql
.
checkDataType
(
9
,
1
,
"TIMESTAMP"
)
# insert by csv files and timetamp is long int , strings in ts and
# cols
# insert by csv files and timetamp is long int , strings in ts and cols
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/taosdemoTestNanoDatabasecsv.json -y "
%
binPath
)
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/taosdemoTestNanoDatabasecsv.json -y "
%
binPath
)
tdSql
.
execute
(
"use nsdbcsv"
)
tdSql
.
query
(
"show stables"
)
tdSql
.
checkData
(
0
,
4
,
100
)
...
...
@@ -111,29 +117,36 @@ class TDTestCase:
tdSql
.
checkData
(
0
,
0
,
10000
)
tdSql
.
query
(
"describe stb0"
)
tdSql
.
checkDataType
(
3
,
1
,
"TIMESTAMP"
)
tdSql
.
query
(
"select count(*) from stb0 where ts >
\"
2021-07-01 00:00:00.490000000
\"
"
)
tdSql
.
query
(
"select count(*) from stb0 where ts >
\"
2021-07-01 00:00:00.490000000
\"
"
)
tdSql
.
checkData
(
0
,
0
,
5000
)
tdSql
.
query
(
"select count(*) from stb0 where ts < 1626918583000000000"
)
tdSql
.
checkData
(
0
,
0
,
10000
)
os
.
system
(
"rm -rf ./insert_res.txt"
)
os
.
system
(
"rm -rf tools/taosdemoAllTest/taosdemoTestSupportNano*.py.sql"
)
# taosdemo test insert with command and parameter , detals show taosdemo --help
os
.
system
(
"%staosdemo -u root -ptaosdata -P 6030 -a 1 -m pre -n 10 -T 20 -t 60 -o res.txt -y "
%
binPath
)
# taosdemo test insert with command and parameter , detals show
# taosdemo --help
os
.
system
(
"%staosdemo -u root -ptaosdata -P 6030 -a 1 -m pre -n 10 -T 20 -t 60 -o res.txt -y "
%
binPath
)
tdSql
.
query
(
"select count(*) from test.meters"
)
tdSql
.
checkData
(
0
,
0
,
600
)
# check taosdemo -s
sqls_ls
=
[
'drop database if exists nsdbsql;'
,
'create database nsdbsql precision "ns" keep 36 days 6 update 1;'
,
'use nsdbsql;'
,
'CREATE STABLE meters (ts timestamp, current float, voltage int, phase float) TAGS (location binary(64), groupdId int);'
,
'CREATE TABLE d1001 USING meters TAGS ("Beijing.Chaoyang", 2);'
,
'INSERT INTO d1001 USING METERS TAGS ("Beijng.Chaoyang", 2) VALUES (now, 10.2, 219, 0.32);'
,
'INSERT INTO d1001 USING METERS TAGS ("Beijng.Chaoyang", 2) VALUES (now, 85, 32, 0.76);'
]
sqls_ls
=
[
'drop database if exists nsdbsql;'
,
'create database nsdbsql precision "ns" keep 36500 days 6 update 1;'
,
'use nsdbsql;'
,
'CREATE STABLE meters (ts timestamp, current float, voltage int, phase float) TAGS (location binary(64), groupdId int);'
,
'CREATE TABLE d1001 USING meters TAGS ("Beijing.Chaoyang", 2);'
,
'INSERT INTO d1001 USING METERS TAGS ("Beijng.Chaoyang", 2) VALUES (now, 10.2, 219, 0.32);'
,
'INSERT INTO d1001 USING METERS TAGS ("Beijng.Chaoyang", 2) VALUES (now, 85, 32, 0.76);'
]
with
open
(
"./taosdemoTestNanoCreateDB.sql"
,
mode
=
"a"
)
as
sql_files
:
with
open
(
"./taosdemoTestNanoCreateDB.sql"
,
mode
=
"a"
)
as
sql_files
:
for
sql
in
sqls_ls
:
sql_files
.
write
(
sql
+
"
\n
"
)
sql_files
.
write
(
sql
+
"
\n
"
)
sql_files
.
close
()
sleep
(
10
)
...
...
@@ -141,11 +154,10 @@ class TDTestCase:
os
.
system
(
"%staosdemo -s taosdemoTestNanoCreateDB.sql -y "
%
binPath
)
tdSql
.
query
(
"select count(*) from nsdbsql.meters"
)
tdSql
.
checkData
(
0
,
0
,
2
)
os
.
system
(
"rm -rf ./res.txt"
)
os
.
system
(
"rm -rf ./*.py.sql"
)
os
.
system
(
"rm -rf ./taosdemoTestNanoCreateDB.sql"
)
def
stop
(
self
):
tdSql
.
close
()
...
...
tests/script/api/openTSDBTest.c
浏览文件 @
8a358c66
...
...
@@ -22,9 +22,9 @@ void verify_telnet_insert(TAOS* taos) {
/* metric */
char
*
lines0
[]
=
{
"stb0_0 1626006833639
000000ns
4i8 host=
\"
host0
\"
interface=
\"
eth0
\"
"
,
"stb0_1 1626006833639
000000ns
4i8 host=
\"
host0
\"
interface=
\"
eth0
\"
"
,
"stb0_2 1626006833639
000000ns
4i8 host=
\"
host0
\"
interface=
\"
eth0
\"
"
,
"stb0_0 1626006833639 4i8 host=
\"
host0
\"
interface=
\"
eth0
\"
"
,
"stb0_1 1626006833639 4i8 host=
\"
host0
\"
interface=
\"
eth0
\"
"
,
"stb0_2 1626006833639 4i8 host=
\"
host0
\"
interface=
\"
eth0
\"
"
,
};
result
=
taos_schemaless_insert
(
taos
,
lines0
,
3
,
TSDB_SML_TELNET_PROTOCOL
,
TSDB_SML_TIMESTAMP_NOT_CONFIGURED
);
code
=
taos_errno
(
result
);
...
...
@@ -35,15 +35,11 @@ void verify_telnet_insert(TAOS* taos) {
/* timestamp */
char
*
lines1
[]
=
{
"stb1 1626006833s 1i8 host=
\"
host0
\"
"
,
"stb1 1626006833639000000ns 2i8 host=
\"
host0
\"
"
,
"stb1 1626006833640000us 3i8 host=
\"
host0
\"
"
,
"stb1 1626006833641 4i8 host=
\"
host0
\"
"
,
"stb1 1626006832 5i8 host=
\"
host0
\"
"
,
"stb1 1626006833651ms 6i8 host=
\"
host0
\"
"
,
"stb1 0 7i8 host=
\"
host0
\"
"
,
"stb1 1626006833641 1i8 host=
\"
host0
\"
"
,
"stb1 1626006832 2i8 host=
\"
host0
\"
"
,
"stb1 0 3i8 host=
\"
host0
\"
"
,
};
result
=
taos_schemaless_insert
(
taos
,
lines1
,
7
,
TSDB_SML_TELNET_PROTOCOL
,
TSDB_SML_TIMESTAMP_NOT_CONFIGURED
);
result
=
taos_schemaless_insert
(
taos
,
lines1
,
3
,
TSDB_SML_TELNET_PROTOCOL
,
TSDB_SML_TIMESTAMP_NOT_CONFIGURED
);
code
=
taos_errno
(
result
);
if
(
code
)
{
printf
(
"lines1 code: %d, %s.
\n
"
,
code
,
tstrerror
(
code
));
...
...
@@ -53,8 +49,8 @@ void verify_telnet_insert(TAOS* taos) {
/* metric value */
//tinyint
char
*
lines2_0
[]
=
{
"stb2_0 1626006833651
ms
-127i8 host=
\"
host0
\"
"
,
"stb2_0 1626006833652
ms
127i8 host=
\"
host0
\"
"
"stb2_0 1626006833651 -127i8 host=
\"
host0
\"
"
,
"stb2_0 1626006833652 127i8 host=
\"
host0
\"
"
};
result
=
taos_schemaless_insert
(
taos
,
lines2_0
,
2
,
TSDB_SML_TELNET_PROTOCOL
,
TSDB_SML_TIMESTAMP_NOT_CONFIGURED
);
code
=
taos_errno
(
result
);
...
...
@@ -65,8 +61,8 @@ void verify_telnet_insert(TAOS* taos) {
//smallint
char
*
lines2_1
[]
=
{
"stb2_1 1626006833651
ms
-32767i16 host=
\"
host0
\"
"
,
"stb2_1 1626006833652
ms
32767i16 host=
\"
host0
\"
"
"stb2_1 1626006833651 -32767i16 host=
\"
host0
\"
"
,
"stb2_1 1626006833652 32767i16 host=
\"
host0
\"
"
};
result
=
taos_schemaless_insert
(
taos
,
lines2_1
,
2
,
TSDB_SML_TELNET_PROTOCOL
,
TSDB_SML_TIMESTAMP_NOT_CONFIGURED
);
code
=
taos_errno
(
result
);
...
...
@@ -77,8 +73,8 @@ void verify_telnet_insert(TAOS* taos) {
//int
char
*
lines2_2
[]
=
{
"stb2_2 1626006833651
ms
-2147483647i32 host=
\"
host0
\"
"
,
"stb2_2 1626006833652
ms
2147483647i32 host=
\"
host0
\"
"
"stb2_2 1626006833651 -2147483647i32 host=
\"
host0
\"
"
,
"stb2_2 1626006833652 2147483647i32 host=
\"
host0
\"
"
};
result
=
taos_schemaless_insert
(
taos
,
lines2_2
,
2
,
TSDB_SML_TELNET_PROTOCOL
,
TSDB_SML_TIMESTAMP_NOT_CONFIGURED
);
code
=
taos_errno
(
result
);
...
...
@@ -89,8 +85,8 @@ void verify_telnet_insert(TAOS* taos) {
//bigint
char
*
lines2_3
[]
=
{
"stb2_3 1626006833651
ms
-9223372036854775807i64 host=
\"
host0
\"
"
,
"stb2_3 1626006833652
ms
9223372036854775807i64 host=
\"
host0
\"
"
"stb2_3 1626006833651 -9223372036854775807i64 host=
\"
host0
\"
"
,
"stb2_3 1626006833652 9223372036854775807i64 host=
\"
host0
\"
"
};
result
=
taos_schemaless_insert
(
taos
,
lines2_3
,
2
,
TSDB_SML_TELNET_PROTOCOL
,
TSDB_SML_TIMESTAMP_NOT_CONFIGURED
);
code
=
taos_errno
(
result
);
...
...
@@ -101,16 +97,16 @@ void verify_telnet_insert(TAOS* taos) {
//float
char
*
lines2_4
[]
=
{
"stb2_4 1626006833610
ms
3f32 host=
\"
host0
\"
"
,
"stb2_4 1626006833620
ms
-3f32 host=
\"
host0
\"
"
,
"stb2_4 1626006833630
ms
3.4f32 host=
\"
host0
\"
"
,
"stb2_4 1626006833640
ms
-3.4f32 host=
\"
host0
\"
"
,
"stb2_4 1626006833650
ms
3.4E10f32 host=
\"
host0
\"
"
,
"stb2_4 1626006833660
ms
-3.4e10f32 host=
\"
host0
\"
"
,
"stb2_4 1626006833670
ms
3.4E+2f32 host=
\"
host0
\"
"
,
"stb2_4 1626006833680
ms
-3.4e-2f32 host=
\"
host0
\"
"
,
"stb2_4 1626006833700
ms
3.4E38f32 host=
\"
host0
\"
"
,
"stb2_4 1626006833710
ms
-3.4E38f32 host=
\"
host0
\"
"
"stb2_4 1626006833610 3f32 host=
\"
host0
\"
"
,
"stb2_4 1626006833620 -3f32 host=
\"
host0
\"
"
,
"stb2_4 1626006833630 3.4f32 host=
\"
host0
\"
"
,
"stb2_4 1626006833640 -3.4f32 host=
\"
host0
\"
"
,
"stb2_4 1626006833650 3.4E10f32 host=
\"
host0
\"
"
,
"stb2_4 1626006833660 -3.4e10f32 host=
\"
host0
\"
"
,
"stb2_4 1626006833670 3.4E+2f32 host=
\"
host0
\"
"
,
"stb2_4 1626006833680 -3.4e-2f32 host=
\"
host0
\"
"
,
"stb2_4 1626006833700 3.4E38f32 host=
\"
host0
\"
"
,
"stb2_4 1626006833710 -3.4E38f32 host=
\"
host0
\"
"
};
result
=
taos_schemaless_insert
(
taos
,
lines2_4
,
10
,
TSDB_SML_TELNET_PROTOCOL
,
TSDB_SML_TIMESTAMP_NOT_CONFIGURED
);
code
=
taos_errno
(
result
);
...
...
@@ -121,17 +117,17 @@ void verify_telnet_insert(TAOS* taos) {
//double
char
*
lines2_5
[]
=
{
"stb2_5 1626006833610
ms
3f64 host=
\"
host0
\"
"
,
"stb2_5 1626006833620
ms
-3f64 host=
\"
host0
\"
"
,
"stb2_5 1626006833630
ms
3.4f64 host=
\"
host0
\"
"
,
"stb2_5 1626006833640
ms
-3.4f64 host=
\"
host0
\"
"
,
"stb2_5 1626006833650
ms
3.4E10f64 host=
\"
host0
\"
"
,
"stb2_5 1626006833660
ms
-3.4e10f64 host=
\"
host0
\"
"
,
"stb2_5 1626006833670
ms
3.4E+2f64 host=
\"
host0
\"
"
,
"stb2_5 1626006833680
ms
-3.4e-2f64 host=
\"
host0
\"
"
,
"stb2_5 1626006833690
ms
1.7E308f64 host=
\"
host0
\"
"
,
"stb2_5 1626006833700
ms
-1.7E308f64 host=
\"
host0
\"
"
,
"stb2_5 1626006833710
ms
3.15 host=
\"
host0
\"
"
"stb2_5 1626006833610 3f64 host=
\"
host0
\"
"
,
"stb2_5 1626006833620 -3f64 host=
\"
host0
\"
"
,
"stb2_5 1626006833630 3.4f64 host=
\"
host0
\"
"
,
"stb2_5 1626006833640 -3.4f64 host=
\"
host0
\"
"
,
"stb2_5 1626006833650 3.4E10f64 host=
\"
host0
\"
"
,
"stb2_5 1626006833660 -3.4e10f64 host=
\"
host0
\"
"
,
"stb2_5 1626006833670 3.4E+2f64 host=
\"
host0
\"
"
,
"stb2_5 1626006833680 -3.4e-2f64 host=
\"
host0
\"
"
,
"stb2_5 1626006833690 1.7E308f64 host=
\"
host0
\"
"
,
"stb2_5 1626006833700 -1.7E308f64 host=
\"
host0
\"
"
,
"stb2_5 1626006833710 3.15 host=
\"
host0
\"
"
};
result
=
taos_schemaless_insert
(
taos
,
lines2_5
,
11
,
TSDB_SML_TELNET_PROTOCOL
,
TSDB_SML_TIMESTAMP_NOT_CONFIGURED
);
code
=
taos_errno
(
result
);
...
...
@@ -142,16 +138,16 @@ void verify_telnet_insert(TAOS* taos) {
//bool
char
*
lines2_6
[]
=
{
"stb2_6 1626006833610
ms
t host=
\"
host0
\"
"
,
"stb2_6 1626006833620
ms
T host=
\"
host0
\"
"
,
"stb2_6 1626006833630
ms
true host=
\"
host0
\"
"
,
"stb2_6 1626006833640
ms
True host=
\"
host0
\"
"
,
"stb2_6 1626006833650
ms
TRUE host=
\"
host0
\"
"
,
"stb2_6 1626006833660
ms
f host=
\"
host0
\"
"
,
"stb2_6 1626006833670
ms
F host=
\"
host0
\"
"
,
"stb2_6 1626006833680
ms
false host=
\"
host0
\"
"
,
"stb2_6 1626006833690
ms
False host=
\"
host0
\"
"
,
"stb2_6 1626006833700
ms
FALSE host=
\"
host0
\"
"
"stb2_6 1626006833610 t host=
\"
host0
\"
"
,
"stb2_6 1626006833620 T host=
\"
host0
\"
"
,
"stb2_6 1626006833630 true host=
\"
host0
\"
"
,
"stb2_6 1626006833640 True host=
\"
host0
\"
"
,
"stb2_6 1626006833650 TRUE host=
\"
host0
\"
"
,
"stb2_6 1626006833660 f host=
\"
host0
\"
"
,
"stb2_6 1626006833670 F host=
\"
host0
\"
"
,
"stb2_6 1626006833680 false host=
\"
host0
\"
"
,
"stb2_6 1626006833690 False host=
\"
host0
\"
"
,
"stb2_6 1626006833700 FALSE host=
\"
host0
\"
"
};
result
=
taos_schemaless_insert
(
taos
,
lines2_6
,
10
,
TSDB_SML_TELNET_PROTOCOL
,
TSDB_SML_TIMESTAMP_NOT_CONFIGURED
);
code
=
taos_errno
(
result
);
...
...
@@ -162,9 +158,9 @@ void verify_telnet_insert(TAOS* taos) {
//binary
char
*
lines2_7
[]
=
{
"stb2_7 1626006833610
ms
\"
binary_val.!@#$%^&*
\"
host=
\"
host0
\"
"
,
"stb2_7 1626006833620
ms
\"
binary_val.:;,./?|+-=
\"
host=
\"
host0
\"
"
,
"stb2_7 1626006833630
ms
\"
binary_val.()[]{}<>
\"
host=
\"
host0
\"
"
"stb2_7 1626006833610
\"
binary_val.!@#$%^&*
\"
host=
\"
host0
\"
"
,
"stb2_7 1626006833620
\"
binary_val.:;,./?|+-=
\"
host=
\"
host0
\"
"
,
"stb2_7 1626006833630
\"
binary_val.()[]{}<>
\"
host=
\"
host0
\"
"
};
result
=
taos_schemaless_insert
(
taos
,
lines2_7
,
3
,
TSDB_SML_TELNET_PROTOCOL
,
TSDB_SML_TIMESTAMP_NOT_CONFIGURED
);
code
=
taos_errno
(
result
);
...
...
@@ -175,8 +171,8 @@ void verify_telnet_insert(TAOS* taos) {
//nchar
char
*
lines2_8
[]
=
{
"stb2_8 1626006833610
ms
L
\"
nchar_val数值一
\"
host=
\"
host0
\"
"
,
"stb2_8 1626006833620
ms
L
\"
nchar_val数值二
\"
host=
\"
host0
\"
"
"stb2_8 1626006833610 L
\"
nchar_val数值一
\"
host=
\"
host0
\"
"
,
"stb2_8 1626006833620 L
\"
nchar_val数值二
\"
host=
\"
host0
\"
"
};
result
=
taos_schemaless_insert
(
taos
,
lines2_8
,
2
,
TSDB_SML_TELNET_PROTOCOL
,
TSDB_SML_TIMESTAMP_NOT_CONFIGURED
);
code
=
taos_errno
(
result
);
...
...
@@ -188,8 +184,8 @@ void verify_telnet_insert(TAOS* taos) {
/* tags */
//tag value types
char
*
lines3_0
[]
=
{
"stb3_0 1626006833610
ms
1 t1=127i8 t2=32767i16 t3=2147483647i32 t4=9223372036854775807i64 t5=3.4E38f32 t6=1.7E308f64 t7=true t8=
\"
binary_val_1
\"
t9=L
\"
标签值1
\"
"
,
"stb3_0 1626006833610
ms
2 t1=-127i8 t2=-32767i16 t3=-2147483647i32 t4=-9223372036854775807i64 t5=-3.4E38f32 t6=-1.7E308f64 t7=false t8=
\"
binary_val_2
\"
t9=L
\"
标签值2
\"
"
"stb3_0 1626006833610 1 t1=127i8 t2=32767i16 t3=2147483647i32 t4=9223372036854775807i64 t5=3.4E38f32 t6=1.7E308f64 t7=true t8=
\"
binary_val_1
\"
t9=L
\"
标签值1
\"
"
,
"stb3_0 1626006833610 2 t1=-127i8 t2=-32767i16 t3=-2147483647i32 t4=-9223372036854775807i64 t5=-3.4E38f32 t6=-1.7E308f64 t7=false t8=
\"
binary_val_2
\"
t9=L
\"
标签值2
\"
"
};
result
=
taos_schemaless_insert
(
taos
,
lines3_0
,
2
,
TSDB_SML_TELNET_PROTOCOL
,
TSDB_SML_TIMESTAMP_NOT_CONFIGURED
);
code
=
taos_errno
(
result
);
...
...
@@ -200,9 +196,9 @@ void verify_telnet_insert(TAOS* taos) {
//tag ID as child table name
char
*
lines3_1
[]
=
{
"stb3_1 1626006833610
ms
1 id=child_table1 host=host1"
,
"stb3_1 1626006833610
ms
2 host=host2 iD=child_table2"
,
"stb3_1 1626006833610
ms
3 ID=child_table3 host=host3"
"stb3_1 1626006833610 1 id=child_table1 host=host1"
,
"stb3_1 1626006833610 2 host=host2 iD=child_table2"
,
"stb3_1 1626006833610 3 ID=child_table3 host=host3"
};
result
=
taos_schemaless_insert
(
taos
,
lines3_1
,
3
,
TSDB_SML_TELNET_PROTOCOL
,
TSDB_SML_TIMESTAMP_NOT_CONFIGURED
);
code
=
taos_errno
(
result
);
...
...
tests/script/fullGeneralSuite.sim
浏览文件 @
8a358c66
...
...
@@ -228,4 +228,6 @@ run general/db/show_create_table.sim
run general/parser/like.sim
run general/parser/regex.sim
run general/parser/tbname_escape.sim
run general/parser/columnName_escape.sim
run general/parser/tagName_escape.sim
run general/parser/interp_blocks.sim
tests/script/general/parser/columnName_escape.sim
0 → 100644
浏览文件 @
8a358c66
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1 -c walLevel -v 1
system sh/exec.sh -n dnode1 -s start
sleep 100
sql connect
print ======================== dnode1 start
sql create database colesc;
sql use colesc;
print ======================= test create table/stable
sql create table tb0 (ts timestamp, `123` int, `123 456` int, `123.abc` int)
sql create table tb1 (ts timestamp, `!%^&*()` int)
sql create table tb2 (ts timestamp, `int` int, `bool` int, `double` int, `INTO` int, `COLUMN` int)
sql create table stb0 (ts timestamp, `123` int, `123 456` int, `123.abc` int) tags (t1 int)
sql create table stb1 (ts timestamp, `!%^&*()` int) tags (t2 int)
sql create table stb2 (ts timestamp, `int` int, `bool` int, `double` int, `INTO` int, `COLUMN` int) tags (t3 int)
sql create table ctb0 using stb0 tags (1)
sql create table ctb1 using stb1 tags (1)
sql create table ctb2 using stb2 tags (1)
##check table
sql describe tb0;
if $rows != 4 then
return -1
endi
if $data10 != @123@ then
return -1
endi
if $data20 != @123 456@ then
return -1
endi
if $data30 != @123.abc@ then
return -1
endi
sql describe tb1;
if $rows != 2 then
return -1
endi
if $data10 != @!%^&*()@ then
return -1
endi
sql describe tb2;
if $rows != 6 then
return -1
endi
if $data10 != @int@ then
return -1
endi
if $data20 != @bool@ then
return -1
endi
if $data30 != @double@ then
return -1
endi
if $data40 != @INTO@ then
return -1
endi
if $data50 != @COLUMN@ then
return -1
endi
##check stable
sql describe stb0;
if $rows != 5 then
return -1
endi
if $data10 != @123@ then
return -1
endi
if $data20 != @123 456@ then
return -1
endi
if $data30 != @123.abc@ then
return -1
endi
sql describe stb1;
if $rows != 3 then
return -1
endi
if $data10 != @!%^&*()@ then
return -1
endi
sql describe stb2;
if $rows != 7 then
return -1
endi
if $data10 != @int@ then
return -1
endi
if $data20 != @bool@ then
return -1
endi
if $data30 != @double@ then
return -1
endi
if $data40 != @INTO@ then
return -1
endi
if $data50 != @COLUMN@ then
return -1
endi
print ======================= test Alter columns for table/stable
##Add column
sql_error alter table tb0 add column `123` int
sql_error alter table tb0 add column `123 456` int
sql_error alter table tb0 add column `123.abc` int
sql_error alter table ctb0 add column `1234`
sql alter table tb0 add column `!%^&*()` int
sql alter table tb0 add column `int` int
sql alter table tb0 add column `bool` int
sql alter table tb0 add column `double` int
sql alter table tb0 add column `INTO` nchar(10)
sql alter table tb0 add column `COLUMN` binary(10)
sql alter table stb0 add column `!%^&*()` int
sql alter table stb0 add column `int` int
sql alter table stb0 add column `bool` int
sql alter table stb0 add column `double` int
sql alter table stb0 add column `INTO` nchar(10)
sql alter table stb0 add column `COLUMN` binary(10)
##check table
sql describe tb0;
if $rows != 10 then
return -1
endi
if $data40 != @!%^&*()@ then
return -1
endi
if $data50 != @int@ then
return -1
endi
if $data60 != @bool@ then
return -1
endi
if $data70 != @double@ then
return -1
endi
if $data80 != @INTO@ then
return -1
endi
if $data90 != @COLUMN@ then
return -1
endi
#check stable
sql describe stb0;
if $rows != 11 then
return -1
endi
if $data40 != @!%^&*()@ then
return -1
endi
if $data50 != @int@ then
return -1
endi
if $data60 != @bool@ then
return -1
endi
if $data70 != @double@ then
return -1
endi
if $data80 != @INTO@ then
return -1
endi
if $data90 != @COLUMN@ then
return -1
endi
##Drop column
sql_error alter table ctb0 drop column `123`
sql_error alter table ctb0 drop column `123 456`
sql_error alter table ctb0 drop column `123.abc`
sql alter table tb0 drop column `!%^&*()`
sql alter table tb0 drop column `int`
sql alter table tb0 drop column `bool`
sql alter table tb0 drop column `double`
sql alter table tb0 drop column `INTO`
sql alter table tb0 drop column `COLUMN`
sql alter table stb0 drop column `!%^&*()`
sql alter table stb0 drop column `int`
sql alter table stb0 drop column `bool`
sql alter table stb0 drop column `double`
sql alter table stb0 drop column `INTO`
sql alter table stb0 drop column `COLUMN`
##check table
sql describe tb0;
if $rows != 4 then
return -1
endi
if $data10 != @123@ then
return -1
endi
if $data20 != @123 456@ then
return -1
endi
if $data30 != @123.abc@ then
return -1
endi
##check stable
sql describe stb0;
if $rows != 5 then
return -1
endi
if $data10 != @123@ then
return -1
endi
if $data20 != @123 456@ then
return -1
endi
if $data30 != @123.abc@ then
return -1
endi
##Modify column for binary/nchar length
sql alter table tb0 add column `INTO` nchar(10)
sql alter table tb0 add column `COLUMN` binary(10)
sql alter table stb0 add column `INTO` nchar(10)
sql alter table stb0 add column `COLUMN` binary(10)
sql alter table tb0 modify column `INTO` nchar(15)
sql alter table tb0 modify column `COLUMN` binary(15)
sql alter table stb0 modify column `INTO` nchar(15)
sql alter table stb0 modify column `COLUMN` binary(15)
sql describe tb0;
if $rows != 6 then
return -1
endi
if $data42 != @15@ then
return -1
endi
if $data52 != @15@ then
return -1
endi
sql describe stb0;
if $rows != 7 then
return -1
endi
if $data42 != @15@ then
return -1
endi
if $data52 != @15@ then
return -1
endi
print ======================= test insert columns for table/stable
sql insert into tb0 (ts, `123`, `123 456`, `123.abc`) values (now, 1, 1, 1)
sql insert into tb1 (ts, `!%^&*()`) values (now, 1)
sql insert into tb2 (ts, `int`, `bool`, `double`, `INTO`, `COLUMN`) values (now, 1, 1, 1, 1, 1)
sql insert into ctb0 (ts, `123`, `123 456`, `123.abc`) values (now, 1, 1, 1)
sql insert into ctb1 (ts, `!%^&*()`) values (now, 1)
sql insert into ctb2 (ts, `int`, `bool`, `double`, `INTO`, `COLUMN`) values (now, 1, 1, 1, 1, 1)
sql select * from tb0;
if $rows != 1 then
return -1
endi
sql select * from tb1;
if $rows != 1 then
return -1
endi
sql select * from tb2;
if $rows != 1 then
return -1
endi
sql select * from ctb0;
if $rows != 1 then
return -1
endi
sql select * from ctb1;
if $rows != 1 then
return -1
endi
sql select * from ctb2;
if $rows != 1 then
return -1
endi
print ======================= test select columns for table/stable
sql select `123`,`123 456`,`123.abc` from tb0;
if $rows != 1 then
return -1
endi
if $data00 != 1 then
return -1
endi
if $data01 != 1 then
return -1
endi
if $data02 != 1 then
return -1
endi
sql select `!%^&*()` from tb1;
if $rows != 1 then
return -1
endi
if $data00 != 1 then
return -1
endi
sql select `int`,`bool`,`double`,`INTO`,`COLUMN` from tb2;
if $rows != 1 then
return -1
endi
if $data00 != 1 then
return -1
endi
if $data01 != 1 then
return -1
endi
if $data02 != 1 then
return -1
endi
if $data03 != 1 then
return -1
endi
if $data04 != 1 then
return -1
endi
sql select `123`,`123 456`,`123.abc` from stb0;
if $rows != 1 then
return -1
endi
if $data00 != 1 then
return -1
endi
if $data01 != 1 then
return -1
endi
if $data02 != 1 then
return -1
endi
sql select `!%^&*()` from stb1;
if $rows != 1 then
return -1
endi
if $data00 != 1 then
return -1
endi
sql select `int`,`bool`,`double`,`INTO`,`COLUMN` from stb2;
if $rows != 1 then
return -1
endi
if $data00 != 1 then
return -1
endi
if $data01 != 1 then
return -1
endi
if $data02 != 1 then
return -1
endi
if $data03 != 1 then
return -1
endi
if $data04 != 1 then
return -1
endi
system sh/exec.sh -n dnode1 -s stop -x SIGINT
tests/script/general/parser/tagName_escape.sim
0 → 100644
浏览文件 @
8a358c66
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1 -c walLevel -v 1
system sh/exec.sh -n dnode1 -s start
sleep 100
sql connect
print ======================== dnode1 start
sql create database tagesc;
sql use tagesc;
print ======================= test create table/stable
sql create stable stb0 (ts timestamp, c0 int) tags (`123` int, `123 456` int, `123.abc` int)
sql create stable stb1 (ts timestamp, c1 int) tags (`!%^&*()` int)
sql create stable stb2 (ts timestamp, c2 int) tags (`int` int, `bool` int, `double` int, `INTO` int, `COLUMN` int)
sql create table ctb0 using stb0 (`123`, `123 456`, `123.abc`) tags (1, 1, 1)
sql create table ctb1 using stb1 (`!%^&*()`) tags (1)
sql create table ctb2 using stb2 (`int`, `bool`, `double`, `INTO`, `COLUMN`) tags (1, 1, 1, 1, 1)
##check table
sql describe ctb0;
if $rows != 5 then
return -1
endi
if $data20 != @123@ then
return -1
endi
if $data30 != @123 456@ then
return -1
endi
if $data40 != @123.abc@ then
return -1
endi
sql describe ctb1;
if $rows != 3 then
return -1
endi
if $data20 != @!%^&*()@ then
return -1
endi
sql describe ctb2;
if $rows != 7 then
return -1
endi
if $data20 != @int@ then
return -1
endi
if $data30 != @bool@ then
return -1
endi
if $data40 != @double@ then
return -1
endi
if $data50 != @INTO@ then
return -1
endi
if $data60 != @COLUMN@ then
return -1
endi
print ======================= test Alter tags for stable
##ADD TAG
sql_error alter stable stb0 add tag `123` int
sql_error alter stable stb0 add tag `123 456` int
sql_error alter stable stb0 add tag `123.abc` int
sql alter stable stb0 add tag `!%^&*()` int
sql alter stable stb0 add tag `int` int
sql alter stable stb0 add tag `bool` int
sql alter stable stb0 add tag `double` int
sql alter stable stb0 add tag `INTO` int
sql alter stable stb0 add tag `COLUMN` int
sql describe stb0;
if $rows != 11 then
return -1
endi
if $data50 != @!%^&*()@ then
return -1
endi
if $data60 != @int@ then
return -1
endi
if $data70 != @bool@ then
return -1
endi
if $data80 != @double@ then
return -1
endi
if $data90 != @INTO@ then
return -1
endi
##DROP TAG
sql alter stable stb0 drop tag `!%^&*()`
sql alter stable stb0 drop tag `int`
sql alter stable stb0 drop tag `bool`
sql alter stable stb0 drop tag `double`
sql alter stable stb0 drop tag `INTO`
sql alter stable stb0 drop tag `COLUMN`
sql describe stb0;
if $rows != 5 then
return -1
endi
if $data20 != @123@ then
return -1
endi
if $data30 != @123 456@ then
return -1
endi
if $data40 != @123.abc@ then
return -1
endi
##CHANGE TAG
sql alter stable stb0 change tag `123` `321`
sql alter stable stb0 change tag `123 456` `456 123`
#sql alter stable stb0 change tag `123.abc` `abc.123`
#change tag has bug when using dot in tagname
sql describe stb0;
if $rows != 5 then
return -1
endi
if $data20 != @321@ then
return -1
endi
if $data30 != @456 123@ then
return -1
endi
##SET TAG
sql insert into ctb0 values (now, 1)
sql insert into ctb1 values (now, 1)
sql insert into ctb2 values (now, 1)
sql alter table ctb0 set tag `321`=2
sql alter table ctb0 set tag `456 123`=2
#sql alter table ctb0 set tag `abc.123`=2
#change tag has bug when using dot in tagname
print ======================= test insert specific tags automatically create table
sql alter table ctb0 set tag `321`=2
sql alter table ctb0 set tag `321`=2
sql insert into ctb0_0 using stb0 (`321`, `456 123`, `123.abc`) tags (1, 1, 1) values (now + 10s, 5)
sql insert into ctb1_0 using stb1 (`!%^&*()`) tags (1) values (now + 10s, 5)
sql insert into ctb2_0 using stb2 (`int`, `bool`, `double`, `INTO`, `COLUMN`) tags (1, 1, 1, 1, 1) values (now + 10s, 5)
sql insert into ctb2_1 using stb2 (`int`, `bool`, `INTO`, `COLUMN`) tags (1, 1, 1, 1) values (now + 10s, 5)
sql select * from stb0;
if $rows != 2 then
return -1
endi
sql select * from stb1;
if $rows != 2 then
return -1
endi
sql select * from stb2;
if $rows != 3 then
return -1
endi
if $data24 != NULL then
return -1
endi
system sh/exec.sh -n dnode1 -s stop -x SIGINT
tests/script/jenkins/basic.txt
浏览文件 @
8a358c66
...
...
@@ -404,7 +404,7 @@ cd ../../../debug; make
./test.sh -f unique/mnode/mgmt34.sim
./test.sh -f unique/mnode/mgmtr2.sim
./test.sh -f unique/arbitrator/insert_duplicationTs.sim
#
./test.sh -f unique/arbitrator/insert_duplicationTs.sim
./test.sh -f general/parser/join_manyblocks.sim
./test.sh -f general/parser/stableOp.sim
./test.sh -f general/parser/timestamp.sim
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录