Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
519c456d
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
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看板
提交
519c456d
编写于
11月 30, 2021
作者:
S
shenglian zhou
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'origin/feature/TD-6140' into szhou/feature/support-math-functions
上级
ff9fe10c
26b362bc
变更
20
展开全部
隐藏空白更改
内联
并排
Showing
20 changed file
with
4832 addition
and
845 deletion
+4832
-845
src/client/inc/tscUtil.h
src/client/inc/tscUtil.h
+3
-3
src/client/inc/tsclient.h
src/client/inc/tsclient.h
+2
-0
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+73
-20
src/client/src/tscUtil.c
src/client/src/tscUtil.c
+2
-0
src/common/inc/texpr.h
src/common/inc/texpr.h
+7
-3
src/common/src/texpr.c
src/common/src/texpr.c
+249
-110
src/inc/ttokendef.h
src/inc/ttokendef.h
+4
-0
src/inc/ttype.h
src/inc/ttype.h
+36
-0
src/kit/shell/src/shellEngine.c
src/kit/shell/src/shellEngine.c
+1
-1
src/query/inc/qAggMain.h
src/query/inc/qAggMain.h
+1
-1
src/query/inc/qSqlparser.h
src/query/inc/qSqlparser.h
+3
-0
src/query/inc/sql.y
src/query/inc/sql.y
+3
-0
src/query/src/qAggMain.c
src/query/src/qAggMain.c
+3
-3
src/query/src/qSqlParser.c
src/query/src/qSqlParser.c
+31
-0
src/query/src/sql.c
src/query/src/sql.c
+525
-703
tests/pytest/tag_lite/alter_tag.py
tests/pytest/tag_lite/alter_tag.py
+1
-1
tests/script/general/compute/cast.sim
tests/script/general/compute/cast.sim
+106
-0
tests/script/general/compute/cast_query1.sim
tests/script/general/compute/cast_query1.sim
+2454
-0
tests/script/general/compute/cast_query2.sim
tests/script/general/compute/cast_query2.sim
+1265
-0
tests/script/general/compute/cast_query3.sim
tests/script/general/compute/cast_query3.sim
+63
-0
未找到文件。
src/client/inc/tscUtil.h
浏览文件 @
519c456d
...
...
@@ -35,12 +35,12 @@ extern "C" {
#define UTIL_TABLE_IS_CHILD_TABLE(metaInfo) \
(((metaInfo)->pTableMeta != NULL) && ((metaInfo)->pTableMeta->tableType == TSDB_CHILD_TABLE))
#define UTIL_TABLE_IS_NORMAL_TABLE(metaInfo) \
(!(UTIL_TABLE_IS_SUPER_TABLE(metaInfo) || UTIL_TABLE_IS_CHILD_TABLE(metaInfo)))
#define UTIL_TABLE_IS_TMP_TABLE(metaInfo) \
(((metaInfo)->pTableMeta != NULL) && ((metaInfo)->pTableMeta->tableType == TSDB_TEMP_TABLE))
#define UTIL_TABLE_IS_NORMAL_TABLE(metaInfo) \
(!(UTIL_TABLE_IS_SUPER_TABLE(metaInfo) || UTIL_TABLE_IS_CHILD_TABLE(metaInfo) || UTIL_TABLE_IS_TMP_TABLE(metaInfo)))
#define UTIL_GET_VGROUPMAP(pSql) \
(pSql->pTscObj->pClusterInfo->vgroupMap)
...
...
src/client/inc/tsclient.h
浏览文件 @
519c456d
...
...
@@ -499,6 +499,8 @@ bool tscHasReachLimitation(SQueryInfo *pQueryInfo, SSqlRes *pRes);
void
tscSetBoundColumnInfo
(
SParsedDataColInfo
*
pColInfo
,
SSchema
*
pSchema
,
int32_t
numOfCols
);
char
*
tscGetErrorMsgPayload
(
SSqlCmd
*
pCmd
);
int32_t
tscGetErrorMsgLength
(
SSqlCmd
*
pCmd
);
int32_t
tscErrorMsgWithCode
(
int32_t
code
,
char
*
dstBuffer
,
const
char
*
errMsg
,
const
char
*
sql
);
int32_t
tscInvalidOperationMsg
(
char
*
msg
,
const
char
*
additionalInfo
,
const
char
*
sql
);
...
...
src/client/src/tscSQLParser.c
浏览文件 @
519c456d
无法预览此类型文件
src/client/src/tscUtil.c
浏览文件 @
519c456d
...
...
@@ -4409,6 +4409,8 @@ bool tscHasReachLimitation(SQueryInfo* pQueryInfo, SSqlRes* pRes) {
char
*
tscGetErrorMsgPayload
(
SSqlCmd
*
pCmd
)
{
return
pCmd
->
payload
;
}
int32_t
tscGetErrorMsgLength
(
SSqlCmd
*
pCmd
)
{
return
(
int32_t
)
strlen
(
pCmd
->
payload
);
}
/**
* If current vnode query does not return results anymore (pRes->numOfRows == 0), try the next vnode if exists,
* while multi-vnode super table projection query and the result does not reach the limitation.
...
...
src/common/inc/texpr.h
浏览文件 @
519c456d
...
...
@@ -64,7 +64,8 @@ struct SSchema;
#define TSDB_FUNC_SCALAR_LENGTH (TSDB_FUNC_FLAG_SCALAR | 0x000E)
#define TSDB_FUNC_SCALAR_CONCAT_WS (TSDB_FUNC_FLAG_SCALAR | 0x000F)
#define TSDB_FUNC_SCALAR_CHAR_LENGTH (TSDB_FUNC_FLAG_SCALAR | 0x0010)
#define TSDB_FUNC_SCALAR_MAX_NUM 17
#define TSDB_FUNC_SCALAR_CAST (TSDB_FUNC_FLAG_SCALAR | 0x0011)
#define TSDB_FUNC_SCALAR_MAX_NUM 18
#define TSDB_FUNC_SCALAR_NAME_MAX_LEN 16
...
...
@@ -97,7 +98,8 @@ enum {
TSQL_NODE_EXPR
=
0x1
,
TSQL_NODE_COL
=
0x2
,
TSQL_NODE_VALUE
=
0x4
,
TSQL_NODE_FUNC
=
0x8
TSQL_NODE_FUNC
=
0x8
,
TSQL_NODE_TYPE
=
0x10
};
/**
...
...
@@ -131,6 +133,8 @@ typedef struct tExprNode {
int32_t
numChildren
;
struct
tExprNode
**
pChildren
;
}
_func
;
TAOS_FIELD
*
pType
;
};
int16_t
resultType
;
int16_t
resultBytes
;
...
...
@@ -144,7 +148,7 @@ typedef struct SExprTraverseSupp {
void
tExprTreeDestroy
(
tExprNode
*
pNode
,
void
(
*
fp
)(
void
*
));
int32_t
exprTreeValidateTree
(
tExprNode
*
pExpr
);
int32_t
exprTreeValidateTree
(
char
*
msgbuf
,
tExprNode
*
pExpr
);
void
exprTreeToBinary
(
SBufferWriter
*
bw
,
tExprNode
*
pExprTree
);
tExprNode
*
exprTreeFromBinary
(
const
void
*
data
,
size_t
size
);
...
...
src/common/src/texpr.c
浏览文件 @
519c456d
此差异已折叠。
点击以展开。
src/inc/ttokendef.h
浏览文件 @
519c456d
...
...
@@ -218,6 +218,10 @@
#define TK_SPACE 300
#define TK_COMMENT 301
#define TK_ILLEGAL 302
...
...
src/inc/ttype.h
浏览文件 @
519c456d
...
...
@@ -166,6 +166,42 @@ typedef struct {
} \
} while (0)
#define NUM_TO_STRING(_inputType, _input, _outputBytes, _output) \
do { \
switch (_inputType) { \
case TSDB_DATA_TYPE_TINYINT: \
snprintf(_output, (int32_t)(_outputBytes), "%d", *(int8_t *)(_input)); \
break; \
case TSDB_DATA_TYPE_UTINYINT: \
snprintf(_output, (int32_t)(_outputBytes), "%d", *(uint8_t *)(_input)); \
break; \
case TSDB_DATA_TYPE_SMALLINT: \
snprintf(_output, (int32_t)(_outputBytes), "%d", *(int16_t *)(_input)); \
break; \
case TSDB_DATA_TYPE_USMALLINT: \
snprintf(_output, (int32_t)(_outputBytes), "%d", *(uint16_t *)(_input)); \
break; \
case TSDB_DATA_TYPE_BIGINT: \
snprintf(_output, (int32_t)(_outputBytes), "%" PRId64, *(int64_t *)(_input)); \
break; \
case TSDB_DATA_TYPE_UBIGINT: \
snprintf(_output, (int32_t)(_outputBytes), "%" PRIu64, *(uint64_t *)(_input)); \
break; \
case TSDB_DATA_TYPE_FLOAT: \
snprintf(_output, (int32_t)(_outputBytes), "%f", *(float *)(_input)); \
break; \
case TSDB_DATA_TYPE_DOUBLE: \
snprintf(_output, (int32_t)(_outputBytes), "%f", *(double *)(_input)); \
break; \
case TSDB_DATA_TYPE_UINT: \
snprintf(_output, (int32_t)(_outputBytes), "%u", *(uint32_t *)(_input)); \
break; \
default: \
snprintf(_output, (int32_t)(_outputBytes), "%d", *(int32_t *)(_input)); \
break; \
} \
} while (0)
#define IS_SIGNED_NUMERIC_TYPE(_t) ((_t) >= TSDB_DATA_TYPE_TINYINT && (_t) <= TSDB_DATA_TYPE_BIGINT)
#define IS_UNSIGNED_NUMERIC_TYPE(_t) ((_t) >= TSDB_DATA_TYPE_UTINYINT && (_t) <= TSDB_DATA_TYPE_UBIGINT)
#define IS_FLOAT_TYPE(_t) ((_t) == TSDB_DATA_TYPE_FLOAT || (_t) == TSDB_DATA_TYPE_DOUBLE)
...
...
src/kit/shell/src/shellEngine.c
浏览文件 @
519c456d
...
...
@@ -645,7 +645,7 @@ static void shellPrintNChar(const char *str, int length, int width) {
static
void
printField
(
const
char
*
val
,
TAOS_FIELD
*
field
,
int
width
,
int32_t
length
,
int
precision
)
{
if
(
val
==
NULL
)
{
int
w
=
width
;
if
(
field
->
type
<
TSDB_DATA_TYPE_TINYINT
||
field
->
type
>
TSDB_DATA_TYPE_DOUBLE
)
{
if
(
field
->
type
==
TSDB_DATA_TYPE_BINARY
||
field
->
type
==
TSDB_DATA_TYPE_NCHAR
||
field
->
type
==
TSDB_DATA_TYPE_TIMESTAMP
)
{
w
=
0
;
}
w
=
printf
(
"%*s"
,
w
,
TSDB_DATA_NULL_STR
);
...
...
src/query/inc/qAggMain.h
浏览文件 @
519c456d
...
...
@@ -251,7 +251,7 @@ void blockDistInfoToBinary(STableBlockDist* pDist, struct SBufferWriter* bw);
void
blockDistInfoFromBinary
(
const
char
*
data
,
int32_t
len
,
STableBlockDist
*
pDist
);
/* global sql function array */
extern
struct
SAggFunctionInfo
aAggs
[];
extern
struct
SAggFunctionInfo
aAggs
[
40
];
extern
int32_t
functionCompatList
[];
// compatible check array list
...
...
src/query/inc/qSqlparser.h
浏览文件 @
519c456d
...
...
@@ -38,6 +38,7 @@ enum SQL_NODE_TYPE {
SQL_NODE_SQLFUNCTION
=
2
,
SQL_NODE_VALUE
=
3
,
SQL_NODE_EXPR
=
4
,
SQL_NODE_DATA_TYPE
=
5
,
};
enum
SQL_NODE_FROM_TYPE
{
...
...
@@ -264,6 +265,7 @@ typedef struct tSqlExpr {
int32_t
functionId
;
// function id, todo remove it
SStrToken
columnName
;
// table column info
TAOS_FIELD
dataType
;
// data type
tVariant
value
;
// the use input value
SStrToken
exprToken
;
// original sql expr string
uint32_t
flags
;
// todo remove it
...
...
@@ -292,6 +294,7 @@ SRelationInfo *addSubqueryElem(SRelationInfo* pRelationInfo, SArray* pSub, SStrT
tSqlExpr
*
tSqlExprCreateTimestamp
(
SStrToken
*
pToken
,
int32_t
optrType
);
tSqlExpr
*
tSqlExprCreateIdValue
(
SSqlInfo
*
pInfo
,
SStrToken
*
pToken
,
int32_t
optrType
);
tSqlExpr
*
tSqlExprCreateFunction
(
SArray
*
pParam
,
SStrToken
*
pFuncToken
,
SStrToken
*
endToken
,
int32_t
optType
);
tSqlExpr
*
tSqlExprCreateFuncWithParams
(
SSqlInfo
*
pInfo
,
tSqlExpr
*
col
,
TAOS_FIELD
*
colType
,
SStrToken
*
pFuncToken
,
SStrToken
*
endToken
,
int32_t
optType
);
SArray
*
tStrTokenAppend
(
SArray
*
pList
,
SStrToken
*
pToken
);
tSqlExpr
*
tSqlExprCreate
(
tSqlExpr
*
pLeft
,
tSqlExpr
*
pRight
,
int32_t
optrType
);
...
...
src/query/inc/sql.y
浏览文件 @
519c456d
...
...
@@ -733,6 +733,9 @@ expr(A) ::= ID(X) LP exprlist(Y) RP(E). { tStrTokenAppend(pInfo->funcs, &X); A =
// for parsing sql functions with wildcard for parameters. e.g., count(*)/first(*)/last(*) operation
expr(A) ::= ID(X) LP STAR RP(Y). { tStrTokenAppend(pInfo->funcs, &X); A = tSqlExprCreateFunction(NULL, &X, &Y, X.type); }
// for parsing sql function CAST(column as typename)
expr(A) ::= ID(X) LP expr(B) AS typename(C) RP(Y). { tStrTokenAppend(pInfo->funcs, &X); A = tSqlExprCreateFuncWithParams(pInfo, B, &C, &X, &Y, X.type); }
// is (not) null expression
expr(A) ::= expr(X) IS NULL. {A = tSqlExprCreate(X, NULL, TK_ISNULL);}
expr(A) ::= expr(X) IS NOT NULL. {A = tSqlExprCreate(X, NULL, TK_NOTNULL);}
...
...
src/query/src/qAggMain.c
浏览文件 @
519c456d
...
...
@@ -492,7 +492,7 @@ int32_t isValidFunction(const char* name, int32_t len) {
}
}
for
(
int32_t
i
=
0
;
i
<=
TSDB_FUNC_BLKINFO
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<=
tListLen
(
aAggs
)
;
++
i
)
{
int32_t
nameLen
=
(
int32_t
)
strlen
(
aAggs
[
i
].
name
);
if
(
len
!=
nameLen
)
{
continue
;
...
...
@@ -4779,7 +4779,7 @@ int32_t functionCompatList[] = {
7
};
SAggFunctionInfo
aAggs
[]
=
{{
SAggFunctionInfo
aAggs
[
40
]
=
{{
// 0, count function does not invoke the finalize function
"count"
,
TSDB_FUNC_COUNT
,
...
...
@@ -5226,4 +5226,4 @@ SAggFunctionInfo aAggs[] = {{
block_func_merge
,
dataBlockRequired
,
},
};
\ No newline at end of file
};
src/query/src/qSqlParser.c
浏览文件 @
519c456d
...
...
@@ -178,6 +178,14 @@ tSqlExpr *tSqlExprCreateIdValue(SSqlInfo* pInfo, SStrToken *pToken, int32_t optr
pSqlExpr
->
value
.
nType
=
TSDB_DATA_TYPE_BIGINT
;
pSqlExpr
->
tokenId
=
TK_TIMESTAMP
;
pSqlExpr
->
type
=
SQL_NODE_VALUE
;
}
else
if
(
optrType
==
TK_AS
)
{
// Here it must be column type
if
(
pToken
!=
NULL
)
{
pSqlExpr
->
dataType
=
*
(
TAOS_FIELD
*
)
pToken
;
}
pSqlExpr
->
tokenId
=
optrType
;
pSqlExpr
->
type
=
SQL_NODE_DATA_TYPE
;
}
else
{
// Here it must be the column name (tk_id) if it is not a number or string.
assert
(
optrType
==
TK_ID
||
optrType
==
TK_ALL
);
...
...
@@ -275,6 +283,25 @@ tSqlExpr *tSqlExprCreateFunction(SArray *pParam, SStrToken *pFuncToken, SStrToke
return
pExpr
;
}
tSqlExpr
*
tSqlExprCreateFuncWithParams
(
SSqlInfo
*
pInfo
,
tSqlExpr
*
col
,
TAOS_FIELD
*
colType
,
SStrToken
*
pFuncToken
,
SStrToken
*
endToken
,
int32_t
optType
)
{
if
(
colType
==
NULL
||
col
==
NULL
)
{
return
NULL
;
}
if
(
NULL
==
col
)
{
return
NULL
;
}
tSqlExpr
*
ctype
=
tSqlExprCreateIdValue
(
pInfo
,
(
SStrToken
*
)
colType
,
TK_AS
);
SArray
*
exprList
=
tSqlExprListAppend
(
0
,
col
,
0
,
0
);
tSqlExprListAppend
(
exprList
,
ctype
,
0
,
0
);
return
tSqlExprCreateFunction
(
exprList
,
pFuncToken
,
endToken
,
optType
);
}
/*
* create binary expression in this procedure
* if the expr is arithmetic, calculate the result and set it to tSqlExpr Object
...
...
@@ -801,6 +828,10 @@ void tSetColumnType(TAOS_FIELD *pField, SStrToken *type) {
pField
->
bytes
=
(
int16_t
)
bytes
;
}
}
else
{
if
(
type
->
type
>
0
)
{
pField
->
type
=
-
1
;
}
}
}
...
...
src/query/src/sql.c
浏览文件 @
519c456d
此差异已折叠。
点击以展开。
tests/pytest/tag_lite/alter_tag.py
浏览文件 @
519c456d
...
...
@@ -30,7 +30,7 @@ class TDTestCase:
print
(
"==============step1"
)
tdSql
.
execute
(
"CREATE TABLE IF NOT EXISTS ampere (ts TIMESTAMP
(8),ampere DOUBLE(8)
) TAGS (device_name BINARY(50),build_id BINARY(50),project_id BINARY(50),alias BINARY(50))"
)
"CREATE TABLE IF NOT EXISTS ampere (ts TIMESTAMP
,ampere DOUBLE
) TAGS (device_name BINARY(50),build_id BINARY(50),project_id BINARY(50),alias BINARY(50))"
)
tdSql
.
execute
(
"insert into d1001 using ampere tags('test', '2', '2', '2') VALUES (now, 123)"
)
tdSql
.
execute
(
"ALTER TABLE ampere ADD TAG variable_id BINARY(50)"
)
...
...
tests/script/general/compute/cast.sim
0 → 100644
浏览文件 @
519c456d
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/cfg.sh -n dnode1 -c maxtablespervnode -v 6
system sh/cfg.sh -n dnode1 -c cache -v 1
system sh/cfg.sh -n dnode1 -c minRows -v 10
system sh/exec.sh -n dnode1 -s start
sleep 100
sql connect
sql drop database if exists db
sql create database if not exists db
sql use db
sql create table stb1 (ts timestamp, c1 bool, c2 tinyint, c3 smallint, c4 int, c5 bigint, c6 float, c7 double, c8 binary(10), c9 nchar(10), c10 tinyint unsigned, c11 smallint unsigned, c12 int unsigned, c13 bigint unsigned) TAGS(t1 int, t2 binary(10), t3 double);
sql create table tb1 using stb1 tags(1,'1',1.0);
sql create table tb2 using stb1 tags(2,'2',2.0);
sql create table tb3 using stb1 tags(3,'3',3.0);
sql insert into tb1 values ('2021-11-11 09:00:00',true,1,1,1,1,1,1,"123","1234",1,1,1,1);
sql insert into tb1 values ('2021-11-11 09:00:01',true,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
sql insert into tb1 values ('2021-11-11 09:00:02',true,2,NULL,2,NULL,2,NULL,"234",NULL,2,NULL,2,NULL);
sql insert into tb1 values ('2021-11-11 09:00:03',false,NULL,3,NULL,3,NULL,3,NULL,"3456",NULL,3,NULL,3);
sql insert into tb1 values ('2021-11-11 09:00:04',true,4,4,4,4,4,4,"456","4567",4,4,4,4);
sql insert into tb1 values ('2021-11-11 09:00:05',true,127,32767,2147483647,9223372036854775807,3.402823466e+38,1.79769e+308,"567","5678",254,65534,4294967294,9223372036854775807);
sql insert into tb1 values ('2021-11-11 09:00:06',true,-127,-32767,-2147483647,-9223372036854775807,-3.402823466e+38,-1.79769e+308,"678","6789",0,0,0,0);
sql insert into tb2 values ('2021-11-11 09:00:00',true,1,1,1,1,1,1,"111","1111",1,1,1,1);
sql insert into tb2 values ('2021-11-11 09:00:01',true,2,2,2,2,2,2,"222","2222",2,2,2,2);
sql insert into tb2 values ('2021-11-11 09:00:02',true,3,3,2,3,3,3,"333","3333",3,3,3,3);
sql insert into tb2 values ('2021-11-11 09:00:03',false,4,4,4,4,4,4,"444","4444",4,4,4,4);
sql insert into tb2 values ('2021-11-11 09:00:04',true,5,5,5,5,5,5,"555","5555",5,5,5,5);
sql insert into tb2 values ('2021-11-11 09:00:05',true,6,6,6,6,6,6,"666","6666",6,6,6,6);
sql insert into tb2 values ('2021-11-11 09:00:06',true,7,7,7,7,7,7,"777","7777",7,7,7,7);
sql create table tbn (ts timestamp, c1 bool, c2 tinyint, c3 smallint, c4 int, c5 bigint, c6 float, c7 double, c8 binary(10), c9 nchar(10), c10 tinyint unsigned, c11 smallint unsigned, c12 int unsigned, c13 bigint unsigned);
sql insert into tbn values ('2021-11-11 09:00:00',true,1,1,1,1,1,1,"111","1111",1,1,1,1);
sql insert into tbn values ('2021-11-11 09:00:01',true,2,2,2,2,2,2,"222","2222",2,2,2,2);
sql insert into tbn values ('2021-11-11 09:00:02',true,3,3,2,3,3,3,"333","3333",3,3,3,3);
sql insert into tbn values ('2021-11-11 09:00:03',false,4,4,4,4,4,4,"444","4444",4,4,4,4);
sql insert into tbn values ('2021-11-11 09:00:04',true,5,5,5,5,5,5,"555","5555",5,5,5,5);
sql insert into tbn values ('2021-11-11 09:00:05',true,6,6,6,6,6,6,"666","6666",6,6,6,6);
sql insert into tbn values ('2021-11-11 09:00:06',true,7,7,7,7,7,7,"777","7777",7,7,7,7);
run general/compute/cast_query1.sim
run general/compute/cast_query2.sim
sql create table stba (ts timestamp, c1 bool, c2 tinyint, c3 smallint, c4 int, c5 bigint, c6 float, c7 double, c8 binary(10), c9 nchar(10), c10 tinyint unsigned, c11 smallint unsigned, c12 int unsigned, c13 bigint unsigned) TAGS(t1 int, t2 binary(10), t3 double);
sql create table tba1 using stba tags(1,'1',1.0);
sql insert into tba1 values ('2021-11-11 09:00:00',true, 1,1,1,1,1,1,"111","1111",1,1,1,1);
sql insert into tba1 values ('2021-11-11 09:00:01',true, 2,2,2,2,2,2,"222","2222",2,2,2,2);
sql insert into tba1 values ('2021-11-11 09:00:02',true, 3,3,2,3,3,3,"333","3333",3,3,3,3);
sql insert into tba1 values ('2021-11-11 09:00:03',false,4,4,4,4,4,4,"444","4444",4,4,4,4);
sql insert into tba1 values ('2021-11-11 09:00:04',true, 5,5,5,5,5,5,"555","5555",5,5,5,5);
sql insert into tba1 values ('2021-11-11 09:00:05',true, 6,6,6,6,6,6,"666","6666",6,6,6,6);
sql insert into tba1 values ('2021-11-11 09:00:06',true, 7,7,7,7,7,7,"777","7777",7,7,7,7);
sql insert into tba1 values ('2021-11-11 09:00:07',true, 8,8,8,8,8,8,"888","8888",8,8,8,8);
sql insert into tba1 values ('2021-11-11 09:00:08',true, 9,9,9,9,9,9,"999","9999",9,9,9,9);
sql insert into tba1 values ('2021-11-11 09:00:09',true, 0,0,0,0,0,0,"000","0000",0,0,0,0);
print ================== restart server to commit data into disk
system sh/exec.sh -n dnode1 -s stop -x SIGINT
sleep 500
system sh/exec.sh -n dnode1 -s start
print ================== server restart completed
sql insert into tba1 values ('2021-11-11 09:00:10',true, 1,1,1,1,1,1,"111","1111",1,1,1,1);
sql insert into tba1 values ('2021-11-11 09:00:11',true, 2,2,2,2,2,2,"222","2222",2,2,2,2);
sql insert into tba1 values ('2021-11-11 09:00:12',true, 3,3,2,3,3,3,"333","3333",3,3,3,3);
sql insert into tba1 values ('2021-11-11 09:00:13',false,4,4,4,4,4,4,"444","4444",4,4,4,4);
sql insert into tba1 values ('2021-11-11 09:00:14',true, 5,5,5,5,5,5,"555","5555",5,5,5,5);
sql insert into tba1 values ('2021-11-11 09:00:15',true, 6,6,6,6,6,6,"666","6666",6,6,6,6);
sql insert into tba1 values ('2021-11-11 09:00:16',true, 7,7,7,7,7,7,"777","7777",7,7,7,7);
sql insert into tba1 values ('2021-11-11 09:00:17',true, 8,8,8,8,8,8,"888","8888",8,8,8,8);
sql insert into tba1 values ('2021-11-11 09:00:18',true, 9,9,9,9,9,9,"999","9999",9,9,9,9);
sql insert into tba1 values ('2021-11-11 09:00:19',true, 0,0,0,0,0,0,"000","0000",0,0,0,0);
print ================== restart server to commit data into disk
system sh/exec.sh -n dnode1 -s stop -x SIGINT
sleep 500
system sh/exec.sh -n dnode1 -s start
print ================== server restart completed
sql insert into tba1 values ('2021-11-11 09:00:20',true, 1,1,1,1,1,1,"111","1111",1,1,1,1);
sql insert into tba1 values ('2021-11-11 09:00:21',true, 2,2,2,2,2,2,"222","2222",2,2,2,2);
sql insert into tba1 values ('2021-11-11 09:00:22',true, 3,3,2,3,3,3,"333","3333",3,3,3,3);
sql insert into tba1 values ('2021-11-11 09:00:23',false,4,4,4,4,4,4,"444","4444",4,4,4,4);
sql insert into tba1 values ('2021-11-11 09:00:24',true, 5,5,5,5,5,5,"555","5555",5,5,5,5);
sql insert into tba1 values ('2021-11-11 09:00:25',true, 6,6,6,6,6,6,"666","6666",6,6,6,6);
sql insert into tba1 values ('2021-11-11 09:00:26',true, 7,7,7,7,7,7,"777","7777",7,7,7,7);
sql insert into tba1 values ('2021-11-11 09:00:27',true, 8,8,8,8,8,8,"888","8888",8,8,8,8);
sql insert into tba1 values ('2021-11-11 09:00:28',true, 9,9,9,9,9,9,"999","9999",9,9,9,9);
sql insert into tba1 values ('2021-11-11 09:00:29',true, 0,0,0,0,0,0,"000","0000",0,0,0,0);
run general/compute/cast_query1.sim
run general/compute/cast_query2.sim
run general/compute/cast_query3.sim
#system sh/exec.sh -n dnode1 -s stop -x SIGINT
tests/script/general/compute/cast_query1.sim
0 → 100644
浏览文件 @
519c456d
此差异已折叠。
点击以展开。
tests/script/general/compute/cast_query2.sim
0 → 100644
浏览文件 @
519c456d
此差异已折叠。
点击以展开。
tests/script/general/compute/cast_query3.sim
0 → 100644
浏览文件 @
519c456d
sleep 100
sql connect
sql use db;
sql select cast(stb1.c4 as binary(10)),cast(stba.c5 as binary(10)) from stb1,stba where stb1.t1=stba.t1 and stb1.ts=stba.ts;
if $rows != 7 then
return -1
endi
if $data00 != 1 then
return -1
endi
if $data01 != 1 then
return -1
endi
if $data10 != NULL then
return -1
endi
if $data11 != 2 then
return -1
endi
if $data20 != 2 then
return -1
endi
if $data21 != 3 then
return -1
endi
if $data30 != NULL then
return -1
endi
if $data31 != 4 then
return -1
endi
if $data40 != 4 then
return -1
endi
if $data41 != 5 then
return -1
endi
if $data50 != 2147483647 then
return -1
endi
if $data51 != 6 then
return -1
endi
if $data60 != -214748364 then
return -1
endi
if $data61 != 7 then
return -1
endi
sql select cast(c4 as binary(10)) as a from stb1 union all select cast(c5 as binary(10)) as a from stba;
if $rows != 44 then
return -1
endi
sql select cast(c2 as bigint) from stba;
if $rows != 30 then
return -1
endi
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录