Merge branch 'main' into merge/3.0tomain
This commit is contained in:
commit
ef5a561162
|
@ -6,7 +6,7 @@ description: 对表的各种管理操作
|
|||
|
||||
## 创建表
|
||||
|
||||
`CREATE TABLE` 语句用于创建普通表和以超级表为模板创建子表。
|
||||
`CREATE TABLE` 语句用于创建普通表和以超级表为模板创建子表(也可以通过指定 TAGS 字段创建超级表)。
|
||||
|
||||
```sql
|
||||
CREATE TABLE [IF NOT EXISTS] [db_name.]tb_name (create_definition [, create_definition] ...) [table_options]
|
||||
|
|
|
@ -46,7 +46,7 @@ static FORCE_INLINE bool mJoinBlkReachThreshold(SMJoinOperatorInfo* pInfo, int64
|
|||
return blkRows >= pInfo->ctx.mergeCtx.blkThreshold;
|
||||
}
|
||||
|
||||
return (pInfo->execInfo.resRows + blkRows) >= pInfo->ctx.mergeCtx.limit;
|
||||
return (pInfo->execInfo.resRows + blkRows) >= pInfo->ctx.mergeCtx.limit || blkRows >= pInfo->ctx.mergeCtx.blkThreshold;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -44,10 +44,10 @@ static int tfileWriteData(TFileWriter* write, TFileValue* tval);
|
|||
static int tfileWriteFooter(TFileWriter* write);
|
||||
|
||||
// handle file corrupt later
|
||||
static int tfileReaderLoadHeader(TFileReader* reader);
|
||||
static int tfileReaderLoadHeader(TFileReader* reader);
|
||||
static int32_t tfileReaderLoadFst(TFileReader* reader);
|
||||
static int tfileReaderVerify(TFileReader* reader);
|
||||
static int tfileReaderLoadTableIds(TFileReader* reader, int32_t offset, SArray* result);
|
||||
static int tfileReaderVerify(TFileReader* reader);
|
||||
static int tfileReaderLoadTableIds(TFileReader* reader, int32_t offset, SArray* result);
|
||||
|
||||
static int32_t tfileGetFileList(const char* path, SArray** pResult);
|
||||
static int tfileRmExpireFile(SArray* result);
|
||||
|
@ -106,6 +106,11 @@ TFileCache* tfileCacheCreate(SIndex* idx, const char* path) {
|
|||
|
||||
SArray* files = NULL;
|
||||
int32_t code = tfileGetFileList(path, &files);
|
||||
if (code != 0) {
|
||||
indexError("failed to get file list since %s", tstrerror(code));
|
||||
goto End;
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < taosArrayGetSize(files); i++) {
|
||||
char* file = taosArrayGetP(files, i);
|
||||
|
||||
|
@ -1182,7 +1187,6 @@ _exception:
|
|||
TAOS_UNUSED(taosCloseDir(&pDir));
|
||||
if (files != NULL) {
|
||||
taosArrayDestroyEx(files, tfileDestroyFileName);
|
||||
taosArrayDestroy(files);
|
||||
}
|
||||
return code;
|
||||
}
|
||||
|
|
|
@ -908,12 +908,6 @@ const char* tstrerror(int32_t err) {
|
|||
(void)taosThreadOnce(&tsErrorInit, tsSortError);
|
||||
|
||||
// this is a system errno
|
||||
if ((err & 0x00ff0000) == 0x00ff0000) {
|
||||
int32_t code = err & 0x0000ffff;
|
||||
// strerror can handle any invalid code
|
||||
// invalid code return Unknown error
|
||||
return strerror(code);
|
||||
}
|
||||
#ifdef WINDOWS
|
||||
if ((err & 0x01ff0000) == 0x01ff0000) {
|
||||
snprintf(WinAPIErrDesc, 256, "windows api error, code: 0x%08x", err & 0x0000ffff);
|
||||
|
@ -923,6 +917,13 @@ const char* tstrerror(int32_t err) {
|
|||
return WinAPIErrDesc;
|
||||
}
|
||||
#endif
|
||||
if ((err & 0x00ff0000) == 0x00ff0000) {
|
||||
int32_t code = err & 0x0000ffff;
|
||||
// strerror can handle any invalid code
|
||||
// invalid code return Unknown error
|
||||
return strerror(code);
|
||||
}
|
||||
|
||||
int32_t s = 0;
|
||||
int32_t e = sizeof(errors) / sizeof(errors[0]);
|
||||
|
||||
|
|
|
@ -249,6 +249,7 @@
|
|||
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/agg_group_NotReturnValue.py -Q 4
|
||||
|
||||
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/td-32548.py
|
||||
,,n,system-test,python3 ./test.py -f 2-query/large_data.py
|
||||
|
||||
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/stddev_test.py
|
||||
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/stddev_test.py -Q 2
|
||||
|
|
|
@ -19,6 +19,7 @@ import inspect
|
|||
import importlib
|
||||
import traceback
|
||||
from util.log import *
|
||||
import platform
|
||||
|
||||
|
||||
class TDCase:
|
||||
|
@ -146,5 +147,42 @@ class TDCases:
|
|||
|
||||
tdLog.notice("total %d Cluster test case(s) executed" % (runNum))
|
||||
|
||||
def getTaosBenchmarkPath(self, tool="taosBenchmark"):
|
||||
if (platform.system().lower() == 'windows'):
|
||||
tool = tool + ".exe"
|
||||
selfPath = os.path.dirname(os.path.realpath(__file__))
|
||||
|
||||
if "community" in selfPath:
|
||||
projPath = selfPath[: selfPath.find("community")]
|
||||
else:
|
||||
projPath = selfPath[: selfPath.find("tests")]
|
||||
|
||||
paths = []
|
||||
for root, dirs, files in os.walk(projPath):
|
||||
if (tool) in files:
|
||||
rootRealPath = os.path.dirname(os.path.realpath(root))
|
||||
if "packaging" not in rootRealPath:
|
||||
paths.append(os.path.join(root, tool))
|
||||
break
|
||||
if len(paths) == 0:
|
||||
tdLog.exit("taosBenchmark not found!")
|
||||
return
|
||||
else:
|
||||
tdLog.info("taosBenchmark found in %s" % paths[0])
|
||||
return paths[0]
|
||||
|
||||
def taosBenchmarkExec(self, param):
|
||||
buildPath = tdCases.getTaosBenchmarkPath()
|
||||
|
||||
if (platform.system().lower() == 'windows'):
|
||||
cmdStr1 = ' mintty -h never %s %s '%(buildPath, param)
|
||||
tdLog.info(cmdStr1)
|
||||
os.system(cmdStr1)
|
||||
else:
|
||||
cmdStr1 = '%s %s &'%(buildPath, param)
|
||||
tdLog.info(cmdStr1)
|
||||
os.system(cmdStr1)
|
||||
|
||||
time.sleep(5)
|
||||
|
||||
tdCases = TDCases()
|
||||
|
|
|
@ -78,9 +78,34 @@ class TDTestCase:
|
|||
tdSql.error(f'create table {sql} (ts timestamp,c0 int)')
|
||||
tdSql.execute(f'trim database `{dbname}`')
|
||||
tdSql.execute(f'drop database `{dbname}`')
|
||||
|
||||
def tb_name_len_check(self):
|
||||
dbname = tdCom.getLongName(10)
|
||||
tdSql.execute(f'create database if not exists `{dbname}` vgroups 1 replica 1')
|
||||
tdSql.execute(f'use `{dbname}`')
|
||||
tdSql.execute(f'CREATE STABLE `test_csv` (`ts` TIMESTAMP, `c1` VARCHAR(2000), `c2` VARCHAR(2000)) TAGS (`c3` VARCHAR(2000))')
|
||||
tbname = "test_csv_a12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012"
|
||||
tdSql.execute(f"INSERT INTO `{tbname}`\
|
||||
using `test_csv` (`c3`) tags('a12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890')\
|
||||
(`ts`,`c1`,`c2`) values(1591060628000,'a','1');")
|
||||
tdSql.query(f'select * from {tbname}')
|
||||
tdSql.checkRows(1)
|
||||
tdSql.execute(f'drop table {tbname}')
|
||||
|
||||
tdSql.execute(f"INSERT INTO `{dbname}`.`{tbname}`\
|
||||
using `{dbname}`.`test_csv` (`c3`) tags('a12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890')\
|
||||
(`ts`,`c1`,`c2`) values(1591060628000,'a','1');")
|
||||
tdSql.query(f'select * from {tbname}')
|
||||
tdSql.checkRows(1)
|
||||
tdSql.execute(f'drop table {tbname}')
|
||||
|
||||
tdSql.execute(f'trim database `{dbname}`')
|
||||
tdSql.execute(f'drop database `{dbname}`')
|
||||
|
||||
def run(self):
|
||||
self.db_name_check()
|
||||
self.tb_name_check()
|
||||
self.tb_name_len_check()
|
||||
|
||||
def stop(self):
|
||||
tdSql.close()
|
||||
|
|
|
@ -0,0 +1,56 @@
|
|||
from util.log import *
|
||||
from util.sql import *
|
||||
from util.cases import *
|
||||
from util.dnodes import *
|
||||
|
||||
class TDTestCase:
|
||||
|
||||
def init(self, conn, logSql, replicaVar=1):
|
||||
self.replicaVar = int(replicaVar)
|
||||
tdLog.debug(f"start to excute {__file__}")
|
||||
tdSql.init(conn.cursor(), True)
|
||||
|
||||
def prepare_data(self):
|
||||
tdSql.execute("drop database if exists test;")
|
||||
|
||||
tdCases.taosBenchmarkExec("-t 2 -n 1000000 -b int,float,nchar -y")
|
||||
|
||||
while True:
|
||||
tdSql.query("select ts from test.d0;")
|
||||
num1 = tdSql.queryRows
|
||||
tdSql.query("select ts from test.d1;")
|
||||
num2 = tdSql.queryRows
|
||||
if num1 == 1000000 and num2 == 1000000:
|
||||
break
|
||||
tdLog.info(f"waiting for data ready, d0: {num1}, d1: {num2}")
|
||||
time.sleep(1)
|
||||
|
||||
def ts5803(self):
|
||||
tdSql.query("select d0.ts,d0.c1,d0.c2 from test.d0 join test.d1 on d0.ts=d1.ts;")
|
||||
num1 = tdSql.queryRows
|
||||
|
||||
tdSql.query("select d0.ts,d0.c1,d0.c2 from test.d0 join test.d1 on d0.ts=d1.ts limit 1000000;")
|
||||
tdSql.checkRows(num1)
|
||||
|
||||
tdSql.query("select d0.ts from test.d0 join test.d1 on d0.ts=d1.ts limit 1000000;")
|
||||
tdSql.checkRows(num1)
|
||||
|
||||
tdSql.query("select d0.ts,d0.c1,d0.c2 from test.d0 left join test.d1 on d0.ts=d1.ts;")
|
||||
num1 = tdSql.queryRows
|
||||
|
||||
tdSql.query("select d0.ts,d0.c1,d0.c2 from test.d0 left join test.d1 on d0.ts=d1.ts limit 1000000;")
|
||||
tdSql.checkRows(num1)
|
||||
|
||||
tdSql.query("select d0.ts from test.d0 left join test.d1 on d0.ts=d1.ts limit 1000000;")
|
||||
tdSql.checkRows(num1)
|
||||
|
||||
def run(self):
|
||||
self.prepare_data()
|
||||
self.ts5803()
|
||||
|
||||
def stop(self):
|
||||
tdSql.close()
|
||||
tdLog.success(f"{__file__} successfully executed")
|
||||
|
||||
tdCases.addLinux(__file__, TDTestCase())
|
||||
tdCases.addWindows(__file__, TDTestCase())
|
Loading…
Reference in New Issue