提交 6b927296 编写于 作者: G Ganlin Zhao

Merge branch 'develop' into fix/TD-10796

...@@ -4,7 +4,7 @@ PROJECT(TDengine) ...@@ -4,7 +4,7 @@ PROJECT(TDengine)
IF (DEFINED VERNUMBER) IF (DEFINED VERNUMBER)
SET(TD_VER_NUMBER ${VERNUMBER}) SET(TD_VER_NUMBER ${VERNUMBER})
ELSE () ELSE ()
SET(TD_VER_NUMBER "2.3.1.0") SET(TD_VER_NUMBER "2.3.2.0")
ENDIF () ENDIF ()
IF (DEFINED VERCOMPATIBLE) IF (DEFINED VERCOMPATIBLE)
......
...@@ -328,7 +328,7 @@ TDengine的异步API均采用非阻塞调用模式。应用程序可以用多线 ...@@ -328,7 +328,7 @@ TDengine的异步API均采用非阻塞调用模式。应用程序可以用多线
除 C/C++ 语言外,TDengine 的 Java 语言 JNI Connector 也提供参数绑定接口支持,具体请另外参见:[参数绑定接口的 Java 用法](https://www.taosdata.com/cn/documentation/connector/java#stmt-java) 除 C/C++ 语言外,TDengine 的 Java 语言 JNI Connector 也提供参数绑定接口支持,具体请另外参见:[参数绑定接口的 Java 用法](https://www.taosdata.com/cn/documentation/connector/java#stmt-java)
接口相关的具体函数如下(也可以参考 [apitest.c](https://github.com/taosdata/TDengine/blob/develop/tests/examples/c/apitest.c) 文件中使用对应函数的方式): 接口相关的具体函数如下(也可以参考 [prepare.c](https://github.com/taosdata/TDengine/blob/develop/tests/examples/c/prepare.c) 文件中使用对应函数的方式):
- `TAOS_STMT* taos_stmt_init(TAOS *taos)` - `TAOS_STMT* taos_stmt_init(TAOS *taos)`
......
...@@ -628,7 +628,7 @@ func insertData(threadIndex, start, end int, wg *sync.WaitGroup, successRows []i ...@@ -628,7 +628,7 @@ func insertData(threadIndex, start, end int, wg *sync.WaitGroup, successRows []i
buffer.WriteString(",") buffer.WriteString(",")
for _, field := range subTableInfo.config.Fields { for _, field := range subTableInfo.config.Fields {
buffer.WriteString(getFieldValue(currentRow[strings.ToLower(field.Name)])) buffer.WriteString(getFieldValue(currentRow[strings.ToLower(field.Name)],field.Type))
buffer.WriteString(",") buffer.WriteString(",")
} }
...@@ -708,7 +708,10 @@ func executeBatchInsert(insertSql string, connection *sql.DB) int64 { ...@@ -708,7 +708,10 @@ func executeBatchInsert(insertSql string, connection *sql.DB) int64 {
return affected return affected
} }
func getFieldValue(fieldValue interface{}) string { func getFieldValue(fieldValue interface{},fieldtype interface{}) string {
if fieldtype == "timestamp" || fieldtype == "bigint" {
return fmt.Sprintf("%v", fieldValue)
}
return fmt.Sprintf("'%v'", fieldValue) return fmt.Sprintf("'%v'", fieldValue)
} }
......
...@@ -18,6 +18,8 @@ tags = [ ...@@ -18,6 +18,8 @@ tags = [
fields = [ fields = [
# 字段列表,name 为字段名称,type 为字段类型 # 字段列表,name 为字段名称,type 为字段类型
# 除主键外,其他field如果也要设置为timestamp,可以是type ="timestamp" 类型,此时value可同时支持'2006-01-02 15:04:05.000'和millisecond格式
# 也可以是type = "bigint",此时value只支持millisecond格式
{ name = "ts", type = "timestamp" }, { name = "ts", type = "timestamp" },
{ name = "temperature", type = "int" }, { name = "temperature", type = "int" },
{ name = "humidity", type = "float" }, { name = "humidity", type = "float" },
......
name: tdengine name: tdengine
base: core20 base: core20
version: '2.3.1.0' version: '2.3.2.0'
icon: snap/gui/t-dengine.svg icon: snap/gui/t-dengine.svg
summary: an open-source big data platform designed and optimized for IoT. summary: an open-source big data platform designed and optimized for IoT.
description: | description: |
......
...@@ -262,7 +262,7 @@ int32_t shellRunCommand(TAOS* con, char* command) { ...@@ -262,7 +262,7 @@ int32_t shellRunCommand(TAOS* con, char* command) {
} }
if (c == '\\') { if (c == '\\') {
if (quote != 0 && (*command == '_' || *command == '\\')) { if (quote != 0 && (*command == '_' || *command == '%' || *command == '\\')) {
//DO nothing //DO nothing
} else { } else {
esc = true; esc = true;
......
...@@ -77,6 +77,14 @@ ELSEIF (TD_WINDOWS) ...@@ -77,6 +77,14 @@ ELSEIF (TD_WINDOWS)
AUX_SOURCE_DIRECTORY(./src SRC) AUX_SOURCE_DIRECTORY(./src SRC)
ADD_EXECUTABLE(taosdemo ${SRC}) ADD_EXECUTABLE(taosdemo ${SRC})
SET_SOURCE_FILES_PROPERTIES(./src/demoUtil.c PROPERTIES COMPILE_FLAGS -w) SET_SOURCE_FILES_PROPERTIES(./src/demoUtil.c PROPERTIES COMPILE_FLAGS -w)
SET_SOURCE_FILES_PROPERTIES(./src/demoData.c PROPERTIES COMPILE_FLAGS -w)
SET_SOURCE_FILES_PROPERTIES(./src/demoInsert.c PROPERTIES COMPILE_FLAGS -w)
SET_SOURCE_FILES_PROPERTIES(./src/demoCommandOpt.c PROPERTIES COMPILE_FLAGS -w)
SET_SOURCE_FILES_PROPERTIES(./src/demoQuery.c PROPERTIES COMPILE_FLAGS -w)
SET_SOURCE_FILES_PROPERTIES(./src/demoMain.c PROPERTIES COMPILE_FLAGS -w)
SET_SOURCE_FILES_PROPERTIES(./src/demoSubscribe.c PROPERTIES COMPILE_FLAGS -w)
SET_SOURCE_FILES_PROPERTIES(./src/demoOutput.c PROPERTIES COMPILE_FLAGS -w)
SET_SOURCE_FILES_PROPERTIES(./src/demoJsonOpt.c PROPERTIES COMPILE_FLAGS -w)
IF (TD_SOMODE_STATIC) IF (TD_SOMODE_STATIC)
TARGET_LINK_LIBRARIES(taosdemo taos_static cJson lua) TARGET_LINK_LIBRARIES(taosdemo taos_static cJson lua)
ELSE () ELSE ()
......
...@@ -5710,6 +5710,11 @@ static SSDataBlock* doProjectOperation(void* param, bool* newgroup) { ...@@ -5710,6 +5710,11 @@ static SSDataBlock* doProjectOperation(void* param, bool* newgroup) {
} }
} }
if (pOperator->status == OP_EXEC_DONE) {
*newgroup = false;
return NULL;
}
while(1) { while(1) {
bool prevVal = *newgroup; bool prevVal = *newgroup;
...@@ -5722,7 +5727,7 @@ static SSDataBlock* doProjectOperation(void* param, bool* newgroup) { ...@@ -5722,7 +5727,7 @@ static SSDataBlock* doProjectOperation(void* param, bool* newgroup) {
//assert(*newgroup == false); //assert(*newgroup == false);
*newgroup = prevVal; *newgroup = prevVal;
setQueryStatus(pRuntimeEnv, QUERY_COMPLETED); doSetOperatorCompleted(pOperator);
break; break;
} }
......
...@@ -278,6 +278,7 @@ int patternMatch(const char *patterStr, const char *str, size_t size, const SPat ...@@ -278,6 +278,7 @@ int patternMatch(const char *patterStr, const char *str, size_t size, const SPat
if (j <= size) { if (j <= size) {
if (c == '\\' && patterStr[i] == '_' && c1 == '_') { i++; continue; } if (c == '\\' && patterStr[i] == '_' && c1 == '_') { i++; continue; }
if (c == '\\' && patterStr[i] == '%' && c1 == '%') { i++; continue; }
if (c == c1 || tolower(c) == tolower(c1) || (c == pInfo->matchOne && c1 != 0)) { if (c == c1 || tolower(c) == tolower(c1) || (c == pInfo->matchOne && c1 != 0)) {
continue; continue;
} }
......
...@@ -64,7 +64,7 @@ int32_t strRmquote(char *z, int32_t len){ ...@@ -64,7 +64,7 @@ int32_t strRmquote(char *z, int32_t len){
int32_t j = 0; int32_t j = 0;
for (uint32_t k = 1; k < len - 1; ++k) { for (uint32_t k = 1; k < len - 1; ++k) {
if (z[k] == '\\' || (z[k] == delim && z[k + 1] == delim)) { if (z[k] == '\\' || (z[k] == delim && z[k + 1] == delim)) {
if (z[k] == '\\' && z[k + 1] == '_') { if ((z[k] == '\\' && z[k + 1] == '_') || (z[k] == '\\' && z[k + 1] == '%')) {
//match '_' self //match '_' self
} else { } else {
z[j] = z[k + 1]; z[j] = z[k + 1];
......
...@@ -357,7 +357,7 @@ python3 ./test.py -f functions/function_twa.py -r 1 ...@@ -357,7 +357,7 @@ python3 ./test.py -f functions/function_twa.py -r 1
python3 ./test.py -f functions/function_twa_test2.py python3 ./test.py -f functions/function_twa_test2.py
python3 ./test.py -f functions/function_stddev_td2555.py python3 ./test.py -f functions/function_stddev_td2555.py
python3 ./test.py -f functions/showOfflineThresholdIs864000.py python3 ./test.py -f functions/showOfflineThresholdIs864000.py
#python3 ./test.py -f functions/function_interp.py python3 ./test.py -f functions/function_interp.py
python3 ./test.py -f insert/metadataUpdate.py python3 ./test.py -f insert/metadataUpdate.py
python3 ./test.py -f query/last_cache.py python3 ./test.py -f query/last_cache.py
python3 ./test.py -f query/last_row_cache.py python3 ./test.py -f query/last_row_cache.py
......
因为 它太大了无法显示 source diff 。你可以改为 查看blob
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
################################################################### ###################################################################
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from util.dnodes import tdDnodes
from util.log import tdLog from util.log import tdLog
from util.cases import tdCases from util.cases import tdCases
from util.sql import tdSql from util.sql import tdSql
...@@ -71,6 +72,28 @@ class TDTestCase: ...@@ -71,6 +72,28 @@ class TDTestCase:
tdSql.query("select last_row(*), tbname from meters group by tbname order by ts desc") tdSql.query("select last_row(*), tbname from meters group by tbname order by ts desc")
tdSql.checkRows(2) tdSql.checkRows(2)
# TS-561 null tags group by crash
tdLog.info("test case for TS-561")
tdSql.execute("create database openfalcon")
tdSql.execute("use openfalcon")
tdSql.execute("create table stb (ts timestamp, value double) tags(_endpoint binary(150), _hostname binary(150), _indexname binary(50), _ip binary(50), _q_name binary(150))")
tdSql.execute("create table tb0 using stb tags('root.FTBI', 'CNSZ17VL4774', 'max_mem', '10.116.100.10_8088', 'root.line_volume_predict')")
tdSql.execute("create table tb1 using stb(_endpoint, _hostname, _indexname) tags('root.medium_high_freq', 'CNSZ17VL4775', 'max_mem_1')")
for i in range(2):
sql = "insert into tb%d values" % i
for j in range(10000):
sql += "(%d, %d)" % (ts + j * 500, random.randint(1, 10000) + random.uniform(1.0, 1000.0))
tdSql.execute(sql)
tdSql.query("select avg(value) from openfalcon.stb where ts > '2020-11-15 03:30:00.000' and ts < '2020-11-15 04:30:00.000' group by _hostname, _indexname, _ip, _q_name")
tdSql.checkRows(2)
tdDnodes.stop(1)
tdDnodes.start(1)
tdSql.query("select avg(value) from openfalcon.stb where ts > '2020-11-15 03:30:00.000' and ts < '2020-11-15 04:30:00.000' group by _hostname, _indexname, _ip, _q_name")
tdSql.checkRows(2)
def run(self): def run(self):
tdSql.prepare() tdSql.prepare()
......
...@@ -91,6 +91,12 @@ class TDTestCase: ...@@ -91,6 +91,12 @@ class TDTestCase:
tdSql.query("show stables") tdSql.query("show stables")
tdSql.checkRows(1) tdSql.checkRows(1)
# TS-646
tdLog.info("test case for TS-646")
tdSql.execute("drop stable if exists db.st")
tdSql.execute("create table stb(ts timestamp, c1 int) tags(t1 int)")
tdSql.error("create table `` using stb tags(1)")
def stop(self): def stop(self):
tdSql.close() tdSql.close()
tdLog.success("%s successfully executed" % __file__) tdLog.success("%s successfully executed" % __file__)
......
...@@ -23,7 +23,7 @@ sql create table $table2 (ts timestamp, b binary(20)) ...@@ -23,7 +23,7 @@ sql create table $table2 (ts timestamp, b binary(20))
sql insert into $table1 values(now, "table_name") sql insert into $table1 values(now, "table_name")
sql insert into $table1 values(now-1m, "tablexname") sql insert into $table1 values(now-1m, "tablexname")
sql insert into $table1 values(now-2m, "tablexxx") sql insert into $table1 values(now-2m, "tablexxx")
sql insert into $table1 values(now-2m, "table") sql insert into $table1 values(now-3m, "table")
sql select b from $table1 sql select b from $table1
if $rows != 4 then if $rows != 4 then
...@@ -56,6 +56,45 @@ if $rows != 1 then ...@@ -56,6 +56,45 @@ if $rows != 1 then
return -1 return -1
endi endi
sql create database escape_percentage;
sql use escape_percentage;
$table1 = tablename
$table2 = `table%`
sql create table $table1 (ts timestamp, b binary(20))
sql create table $table2 (ts timestamp, b binary(20))
sql insert into $table1 values(now, "table%name")
sql insert into $table1 values(now-1m, "table%")
sql insert into $table1 values(now-2m, "table%%%")
sql insert into $table1 values(now-3m, "table")
sql select b from $table1 where b like 'table\%'
print $rows
if $rows != 1 then
return -1
endi
sql select b from $table1 where b like 'table\%\%\%'
print $rows
if $rows != 1 then
return -1
endi
sql select b from $table1 where b like 'table%'
print $rows
if $rows != 4 then
return -1
endi
sql show tables like 'table\%'
print $rows
if $rows != 1 then
return -1
endi
sql show tables like 'table%'
print $rows
if $rows != 2 then
return -1
endi
sql drop database escape_percentage
system sh/exec.sh -n dnode1 -s stop -x SIGINT system sh/exec.sh -n dnode1 -s stop -x SIGINT
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册