Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
c4f96ffc
T
TDengine
项目概览
慢慢CG
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
c4f96ffc
编写于
7月 03, 2021
作者:
H
Haojun Liao
提交者:
GitHub
7月 03, 2021
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #6727 from taosdata/feature/query
Feature/query
上级
adb56981
76998130
变更
11
显示空白变更内容
内联
并排
Showing
11 changed file
with
223 addition
and
163 deletion
+223
-163
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+94
-82
src/client/src/tscServer.c
src/client/src/tscServer.c
+6
-5
src/client/src/tscSubquery.c
src/client/src/tscSubquery.c
+1
-0
src/client/src/tscUtil.c
src/client/src/tscUtil.c
+56
-50
src/common/src/tname.c
src/common/src/tname.c
+1
-1
src/common/src/tvariant.c
src/common/src/tvariant.c
+4
-2
src/mnode/src/mnodeTable.c
src/mnode/src/mnodeTable.c
+15
-7
src/query/inc/qExecutor.h
src/query/inc/qExecutor.h
+1
-0
src/query/src/qExecutor.c
src/query/src/qExecutor.c
+18
-13
src/tsdb/src/tsdbRead.c
src/tsdb/src/tsdbRead.c
+3
-3
tests/script/general/parser/nestquery.sim
tests/script/general/parser/nestquery.sim
+24
-0
未找到文件。
src/client/src/tscSQLParser.c
浏览文件 @
c4f96ffc
...
@@ -118,7 +118,7 @@ static bool hasNormalColumnFilter(SQueryInfo* pQueryInfo);
...
@@ -118,7 +118,7 @@ static bool hasNormalColumnFilter(SQueryInfo* pQueryInfo);
static
int32_t
validateLimitNode
(
SSqlCmd
*
pCmd
,
SQueryInfo
*
pQueryInfo
,
SSqlNode
*
pSqlNode
,
SSqlObj
*
pSql
);
static
int32_t
validateLimitNode
(
SSqlCmd
*
pCmd
,
SQueryInfo
*
pQueryInfo
,
SSqlNode
*
pSqlNode
,
SSqlObj
*
pSql
);
static
int32_t
parseCreateDBOptions
(
SSqlCmd
*
pCmd
,
SCreateDbInfo
*
pCreateDbSql
);
static
int32_t
parseCreateDBOptions
(
SSqlCmd
*
pCmd
,
SCreateDbInfo
*
pCreateDbSql
);
static
int32_t
getColumnIndexByName
(
SSqlCmd
*
pCmd
,
const
SStrToken
*
pToken
,
SQueryInfo
*
pQueryInfo
,
SColumnIndex
*
pIndex
);
static
int32_t
getColumnIndexByName
(
const
SStrToken
*
pToken
,
SQueryInfo
*
pQueryInfo
,
SColumnIndex
*
pIndex
,
char
*
msg
);
static
int32_t
getTableIndexByName
(
SStrToken
*
pToken
,
SQueryInfo
*
pQueryInfo
,
SColumnIndex
*
pIndex
);
static
int32_t
getTableIndexByName
(
SStrToken
*
pToken
,
SQueryInfo
*
pQueryInfo
,
SColumnIndex
*
pIndex
);
static
int32_t
getTableIndexImpl
(
SStrToken
*
pTableToken
,
SQueryInfo
*
pQueryInfo
,
SColumnIndex
*
pIndex
);
static
int32_t
getTableIndexImpl
(
SStrToken
*
pTableToken
,
SQueryInfo
*
pQueryInfo
,
SColumnIndex
*
pIndex
);
...
@@ -989,7 +989,7 @@ static int32_t validateStateWindowNode(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SS
...
@@ -989,7 +989,7 @@ static int32_t validateStateWindowNode(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SS
}
}
SColumnIndex
index
=
COLUMN_INDEX_INITIALIZER
;
SColumnIndex
index
=
COLUMN_INDEX_INITIALIZER
;
if
(
getColumnIndexByName
(
pCmd
,
col
,
pQueryInfo
,
&
index
)
!=
TSDB_CODE_SUCCESS
)
{
if
(
getColumnIndexByName
(
col
,
pQueryInfo
,
&
index
,
tscGetErrorMsgPayload
(
pCmd
)
)
!=
TSDB_CODE_SUCCESS
)
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg1
);
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg1
);
}
}
...
@@ -1055,7 +1055,7 @@ int32_t validateSessionNode(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SSqlNode * pS
...
@@ -1055,7 +1055,7 @@ int32_t validateSessionNode(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SSqlNode * pS
}
}
SColumnIndex
index
=
COLUMN_INDEX_INITIALIZER
;
SColumnIndex
index
=
COLUMN_INDEX_INITIALIZER
;
if
(
getColumnIndexByName
(
pCmd
,
col
,
pQueryInfo
,
&
index
)
!=
TSDB_CODE_SUCCESS
)
{
if
(
getColumnIndexByName
(
col
,
pQueryInfo
,
&
index
,
tscGetErrorMsgPayload
(
pCmd
)
)
!=
TSDB_CODE_SUCCESS
)
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg3
);
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg3
);
}
}
if
(
index
.
columnIndex
!=
PRIMARYKEY_TIMESTAMP_COL_INDEX
)
{
if
(
index
.
columnIndex
!=
PRIMARYKEY_TIMESTAMP_COL_INDEX
)
{
...
@@ -1197,16 +1197,17 @@ int32_t tscSetTableFullName(SName* pName, SStrToken* pTableName, SSqlObj* pSql)
...
@@ -1197,16 +1197,17 @@ int32_t tscSetTableFullName(SName* pName, SStrToken* pTableName, SSqlObj* pSql)
}
else
{
// get current DB name first, and then set it into path
}
else
{
// get current DB name first, and then set it into path
char
*
t
=
cloneCurrentDBName
(
pSql
);
char
*
t
=
cloneCurrentDBName
(
pSql
);
if
(
strlen
(
t
)
==
0
)
{
if
(
strlen
(
t
)
==
0
)
{
tfree
(
t
);
return
TSDB_CODE_TSC_DB_NOT_SELECTED
;
return
TSDB_CODE_TSC_DB_NOT_SELECTED
;
}
}
code
=
tNameFromString
(
pName
,
t
,
T_NAME_ACCT
|
T_NAME_DB
);
code
=
tNameFromString
(
pName
,
t
,
T_NAME_ACCT
|
T_NAME_DB
);
if
(
code
!=
0
)
{
if
(
code
!=
0
)
{
free
(
t
);
t
free
(
t
);
return
TSDB_CODE_TSC_DB_NOT_SELECTED
;
return
TSDB_CODE_TSC_DB_NOT_SELECTED
;
}
}
free
(
t
);
t
free
(
t
);
if
(
pTableName
->
n
>=
TSDB_TABLE_NAME_LEN
)
{
if
(
pTableName
->
n
>=
TSDB_TABLE_NAME_LEN
)
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg1
);
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg1
);
...
@@ -2024,7 +2025,7 @@ int32_t addProjectionExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, t
...
@@ -2024,7 +2025,7 @@ int32_t addProjectionExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, t
}
else
if
(
optr
==
TK_ID
)
{
}
else
if
(
optr
==
TK_ID
)
{
SColumnIndex
index
=
COLUMN_INDEX_INITIALIZER
;
SColumnIndex
index
=
COLUMN_INDEX_INITIALIZER
;
if
(
getColumnIndexByName
(
pCmd
,
&
pItem
->
pNode
->
colInfo
,
pQueryInfo
,
&
index
)
!=
TSDB_CODE_SUCCESS
)
{
if
(
getColumnIndexByName
(
&
pItem
->
pNode
->
colInfo
,
pQueryInfo
,
&
index
,
tscGetErrorMsgPayload
(
pCmd
)
)
!=
TSDB_CODE_SUCCESS
)
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg0
);
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg0
);
}
}
...
@@ -2209,7 +2210,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
...
@@ -2209,7 +2210,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
pExpr
=
tscExprAppend
(
pQueryInfo
,
functionId
,
&
index
,
TSDB_DATA_TYPE_BIGINT
,
size
,
getNewResColId
(
pCmd
),
size
,
false
);
pExpr
=
tscExprAppend
(
pQueryInfo
,
functionId
,
&
index
,
TSDB_DATA_TYPE_BIGINT
,
size
,
getNewResColId
(
pCmd
),
size
,
false
);
}
else
{
}
else
{
// count the number of table created according to the super table
// count the number of table created according to the super table
if
(
getColumnIndexByName
(
p
Cmd
,
pToken
,
pQueryInfo
,
&
index
)
!=
TSDB_CODE_SUCCESS
)
{
if
(
getColumnIndexByName
(
p
Token
,
pQueryInfo
,
&
index
,
tscGetErrorMsgPayload
(
pCmd
)
)
!=
TSDB_CODE_SUCCESS
)
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg3
);
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg3
);
}
}
...
@@ -2282,7 +2283,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
...
@@ -2282,7 +2283,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
}
}
SColumnIndex
index
=
COLUMN_INDEX_INITIALIZER
;
SColumnIndex
index
=
COLUMN_INDEX_INITIALIZER
;
if
((
getColumnIndexByName
(
pCmd
,
&
pParamElem
->
pNode
->
colInfo
,
pQueryInfo
,
&
index
)
!=
TSDB_CODE_SUCCESS
))
{
if
((
getColumnIndexByName
(
&
pParamElem
->
pNode
->
colInfo
,
pQueryInfo
,
&
index
,
tscGetErrorMsgPayload
(
pCmd
)
)
!=
TSDB_CODE_SUCCESS
))
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg3
);
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg3
);
}
}
...
@@ -2447,7 +2448,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
...
@@ -2447,7 +2448,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
}
}
}
else
{
}
else
{
if
(
getColumnIndexByName
(
pCmd
,
&
pParamElem
->
pNode
->
colInfo
,
pQueryInfo
,
&
index
)
!=
TSDB_CODE_SUCCESS
)
{
if
(
getColumnIndexByName
(
&
pParamElem
->
pNode
->
colInfo
,
pQueryInfo
,
&
index
,
tscGetErrorMsgPayload
(
pCmd
)
)
!=
TSDB_CODE_SUCCESS
)
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg3
);
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg3
);
}
}
...
@@ -2519,7 +2520,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
...
@@ -2519,7 +2520,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
}
}
SColumnIndex
index
=
COLUMN_INDEX_INITIALIZER
;
SColumnIndex
index
=
COLUMN_INDEX_INITIALIZER
;
if
(
getColumnIndexByName
(
pCmd
,
&
pParamElem
->
pNode
->
colInfo
,
pQueryInfo
,
&
index
)
!=
TSDB_CODE_SUCCESS
)
{
if
(
getColumnIndexByName
(
&
pParamElem
->
pNode
->
colInfo
,
pQueryInfo
,
&
index
,
tscGetErrorMsgPayload
(
pCmd
)
)
!=
TSDB_CODE_SUCCESS
)
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg3
);
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg3
);
}
}
...
@@ -2631,7 +2632,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
...
@@ -2631,7 +2632,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
tSqlExpr
*
pParam
=
pParamItem
->
pNode
;
tSqlExpr
*
pParam
=
pParamItem
->
pNode
;
SColumnIndex
index
=
COLUMN_INDEX_INITIALIZER
;
SColumnIndex
index
=
COLUMN_INDEX_INITIALIZER
;
if
(
getColumnIndexByName
(
pCmd
,
&
pParam
->
colInfo
,
pQueryInfo
,
&
index
)
!=
TSDB_CODE_SUCCESS
)
{
if
(
getColumnIndexByName
(
&
pParam
->
colInfo
,
pQueryInfo
,
&
index
,
tscGetErrorMsgPayload
(
pCmd
)
)
!=
TSDB_CODE_SUCCESS
)
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg3
);
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg3
);
}
}
...
@@ -2781,7 +2782,7 @@ static int16_t doGetColumnIndex(SQueryInfo* pQueryInfo, int32_t index, SStrToken
...
@@ -2781,7 +2782,7 @@ static int16_t doGetColumnIndex(SQueryInfo* pQueryInfo, int32_t index, SStrToken
return
columnIndex
;
return
columnIndex
;
}
}
int32_t
doGetColumnIndexByName
(
SS
qlCmd
*
pCmd
,
SStrToken
*
pToken
,
SQueryInfo
*
pQueryInfo
,
SColumnIndex
*
pIndex
)
{
int32_t
doGetColumnIndexByName
(
SS
trToken
*
pToken
,
SQueryInfo
*
pQueryInfo
,
SColumnIndex
*
pIndex
,
char
*
msg
)
{
const
char
*
msg0
=
"ambiguous column name"
;
const
char
*
msg0
=
"ambiguous column name"
;
const
char
*
msg1
=
"invalid column name"
;
const
char
*
msg1
=
"invalid column name"
;
...
@@ -2797,7 +2798,7 @@ int32_t doGetColumnIndexByName(SSqlCmd* pCmd, SStrToken* pToken, SQueryInfo* pQu
...
@@ -2797,7 +2798,7 @@ int32_t doGetColumnIndexByName(SSqlCmd* pCmd, SStrToken* pToken, SQueryInfo* pQu
if
(
colIndex
!=
COLUMN_INDEX_INITIAL_VAL
)
{
if
(
colIndex
!=
COLUMN_INDEX_INITIAL_VAL
)
{
if
(
pIndex
->
columnIndex
!=
COLUMN_INDEX_INITIAL_VAL
)
{
if
(
pIndex
->
columnIndex
!=
COLUMN_INDEX_INITIAL_VAL
)
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
)
,
msg0
);
return
invalidOperationMsg
(
msg
,
msg0
);
}
else
{
}
else
{
pIndex
->
tableIndex
=
i
;
pIndex
->
tableIndex
=
i
;
pIndex
->
columnIndex
=
colIndex
;
pIndex
->
columnIndex
=
colIndex
;
...
@@ -2812,7 +2813,7 @@ int32_t doGetColumnIndexByName(SSqlCmd* pCmd, SStrToken* pToken, SQueryInfo* pQu
...
@@ -2812,7 +2813,7 @@ int32_t doGetColumnIndexByName(SSqlCmd* pCmd, SStrToken* pToken, SQueryInfo* pQu
}
}
if
(
pIndex
->
columnIndex
==
COLUMN_INDEX_INITIAL_VAL
)
{
if
(
pIndex
->
columnIndex
==
COLUMN_INDEX_INITIAL_VAL
)
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
)
,
msg1
);
return
invalidOperationMsg
(
msg
,
msg1
);
}
}
}
}
...
@@ -2862,7 +2863,7 @@ int32_t getTableIndexByName(SStrToken* pToken, SQueryInfo* pQueryInfo, SColumnIn
...
@@ -2862,7 +2863,7 @@ int32_t getTableIndexByName(SStrToken* pToken, SQueryInfo* pQueryInfo, SColumnIn
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
int32_t
getColumnIndexByName
(
SSqlCmd
*
pCmd
,
const
SStrToken
*
pToken
,
SQueryInfo
*
pQueryInfo
,
SColumnIndex
*
pIndex
)
{
int32_t
getColumnIndexByName
(
const
SStrToken
*
pToken
,
SQueryInfo
*
pQueryInfo
,
SColumnIndex
*
pIndex
,
char
*
msg
)
{
if
(
pQueryInfo
->
pTableMetaInfo
==
NULL
||
pQueryInfo
->
numOfTables
==
0
)
{
if
(
pQueryInfo
->
pTableMetaInfo
==
NULL
||
pQueryInfo
->
numOfTables
==
0
)
{
return
TSDB_CODE_TSC_INVALID_OPERATION
;
return
TSDB_CODE_TSC_INVALID_OPERATION
;
}
}
...
@@ -2873,7 +2874,7 @@ int32_t getColumnIndexByName(SSqlCmd* pCmd, const SStrToken* pToken, SQueryInfo*
...
@@ -2873,7 +2874,7 @@ int32_t getColumnIndexByName(SSqlCmd* pCmd, const SStrToken* pToken, SQueryInfo*
return
TSDB_CODE_TSC_INVALID_OPERATION
;
return
TSDB_CODE_TSC_INVALID_OPERATION
;
}
}
return
doGetColumnIndexByName
(
pCmd
,
&
tmpToken
,
pQueryInfo
,
pIndex
);
return
doGetColumnIndexByName
(
&
tmpToken
,
pQueryInfo
,
pIndex
,
msg
);
}
}
int32_t
setShowInfo
(
SSqlObj
*
pSql
,
struct
SSqlInfo
*
pInfo
)
{
int32_t
setShowInfo
(
SSqlObj
*
pSql
,
struct
SSqlInfo
*
pInfo
)
{
...
@@ -3233,7 +3234,7 @@ int32_t validateGroupbyNode(SQueryInfo* pQueryInfo, SArray* pList, SSqlCmd* pCmd
...
@@ -3233,7 +3234,7 @@ int32_t validateGroupbyNode(SQueryInfo* pQueryInfo, SArray* pList, SSqlCmd* pCmd
SStrToken
token
=
{
pVar
->
nLen
,
pVar
->
nType
,
pVar
->
pz
};
SStrToken
token
=
{
pVar
->
nLen
,
pVar
->
nType
,
pVar
->
pz
};
SColumnIndex
index
=
COLUMN_INDEX_INITIALIZER
;
SColumnIndex
index
=
COLUMN_INDEX_INITIALIZER
;
if
(
getColumnIndexByName
(
pCmd
,
&
token
,
pQueryInfo
,
&
index
)
!=
TSDB_CODE_SUCCESS
)
{
if
(
getColumnIndexByName
(
&
token
,
pQueryInfo
,
&
index
,
tscGetErrorMsgPayload
(
pCmd
)
)
!=
TSDB_CODE_SUCCESS
)
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg2
);
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg2
);
}
}
...
@@ -3614,7 +3615,7 @@ static int32_t getColumnQueryCondInfo(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, tSq
...
@@ -3614,7 +3615,7 @@ static int32_t getColumnQueryCondInfo(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, tSq
return
getColumnQueryCondInfo
(
pCmd
,
pQueryInfo
,
pExpr
->
pRight
,
pExpr
->
tokenId
);
return
getColumnQueryCondInfo
(
pCmd
,
pQueryInfo
,
pExpr
->
pRight
,
pExpr
->
tokenId
);
}
else
{
// handle leaf node
}
else
{
// handle leaf node
SColumnIndex
index
=
COLUMN_INDEX_INITIALIZER
;
SColumnIndex
index
=
COLUMN_INDEX_INITIALIZER
;
if
(
getColumnIndexByName
(
pCmd
,
&
pExpr
->
pLeft
->
colInfo
,
pQueryInfo
,
&
index
)
!=
TSDB_CODE_SUCCESS
)
{
if
(
getColumnIndexByName
(
&
pExpr
->
pLeft
->
colInfo
,
pQueryInfo
,
&
index
,
tscGetErrorMsgPayload
(
pCmd
)
)
!=
TSDB_CODE_SUCCESS
)
{
return
TSDB_CODE_TSC_INVALID_OPERATION
;
return
TSDB_CODE_TSC_INVALID_OPERATION
;
}
}
...
@@ -3643,7 +3644,7 @@ static int32_t checkAndSetJoinCondInfo(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, tS
...
@@ -3643,7 +3644,7 @@ static int32_t checkAndSetJoinCondInfo(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, tS
}
}
SColumnIndex
index
=
COLUMN_INDEX_INITIALIZER
;
SColumnIndex
index
=
COLUMN_INDEX_INITIALIZER
;
if
(
getColumnIndexByName
(
pCmd
,
&
pExpr
->
pLeft
->
colInfo
,
pQueryInfo
,
&
index
)
!=
TSDB_CODE_SUCCESS
)
{
if
(
getColumnIndexByName
(
&
pExpr
->
pLeft
->
colInfo
,
pQueryInfo
,
&
index
,
tscGetErrorMsgPayload
(
pCmd
)
)
!=
TSDB_CODE_SUCCESS
)
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg4
);
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg4
);
}
}
...
@@ -3676,7 +3677,7 @@ static int32_t checkAndSetJoinCondInfo(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, tS
...
@@ -3676,7 +3677,7 @@ static int32_t checkAndSetJoinCondInfo(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, tS
int16_t
leftIdx
=
index
.
tableIndex
;
int16_t
leftIdx
=
index
.
tableIndex
;
index
=
(
SColumnIndex
)
COLUMN_INDEX_INITIALIZER
;
index
=
(
SColumnIndex
)
COLUMN_INDEX_INITIALIZER
;
if
(
getColumnIndexByName
(
pCmd
,
&
pExpr
->
pRight
->
colInfo
,
pQueryInfo
,
&
index
)
!=
TSDB_CODE_SUCCESS
)
{
if
(
getColumnIndexByName
(
&
pExpr
->
pRight
->
colInfo
,
pQueryInfo
,
&
index
,
tscGetErrorMsgPayload
(
pCmd
)
)
!=
TSDB_CODE_SUCCESS
)
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg4
);
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg4
);
}
}
...
@@ -3746,7 +3747,7 @@ static int32_t validateSQLExpr(SSqlCmd* pCmd, tSqlExpr* pExpr, SQueryInfo* pQuer
...
@@ -3746,7 +3747,7 @@ static int32_t validateSQLExpr(SSqlCmd* pCmd, tSqlExpr* pExpr, SQueryInfo* pQuer
}
}
SColumnIndex
index
=
COLUMN_INDEX_INITIALIZER
;
SColumnIndex
index
=
COLUMN_INDEX_INITIALIZER
;
if
(
getColumnIndexByName
(
pCmd
,
&
pExpr
->
colInfo
,
pQueryInfo
,
&
index
)
!=
TSDB_CODE_SUCCESS
)
{
if
(
getColumnIndexByName
(
&
pExpr
->
colInfo
,
pQueryInfo
,
&
index
,
tscGetErrorMsgPayload
(
pCmd
)
)
!=
TSDB_CODE_SUCCESS
)
{
return
TSDB_CODE_TSC_INVALID_OPERATION
;
return
TSDB_CODE_TSC_INVALID_OPERATION
;
}
}
...
@@ -3795,6 +3796,7 @@ static int32_t validateSQLExpr(SSqlCmd* pCmd, tSqlExpr* pExpr, SQueryInfo* pQuer
...
@@ -3795,6 +3796,7 @@ static int32_t validateSQLExpr(SSqlCmd* pCmd, tSqlExpr* pExpr, SQueryInfo* pQuer
uint64_t
id
=
-
1
;
uint64_t
id
=
-
1
;
for
(
int32_t
i
=
0
;
i
<
inc
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
inc
;
++
i
)
{
SExprInfo
*
p1
=
tscExprGet
(
pQueryInfo
,
i
+
outputIndex
);
SExprInfo
*
p1
=
tscExprGet
(
pQueryInfo
,
i
+
outputIndex
);
int16_t
t
=
p1
->
base
.
resType
;
int16_t
t
=
p1
->
base
.
resType
;
if
(
t
==
TSDB_DATA_TYPE_BINARY
||
t
==
TSDB_DATA_TYPE_NCHAR
||
t
==
TSDB_DATA_TYPE_BOOL
||
t
==
TSDB_DATA_TYPE_TIMESTAMP
)
{
if
(
t
==
TSDB_DATA_TYPE_BINARY
||
t
==
TSDB_DATA_TYPE_NCHAR
||
t
==
TSDB_DATA_TYPE_BOOL
||
t
==
TSDB_DATA_TYPE_TIMESTAMP
)
{
return
TSDB_CODE_TSC_INVALID_OPERATION
;
return
TSDB_CODE_TSC_INVALID_OPERATION
;
...
@@ -3802,7 +3804,10 @@ static int32_t validateSQLExpr(SSqlCmd* pCmd, tSqlExpr* pExpr, SQueryInfo* pQuer
...
@@ -3802,7 +3804,10 @@ static int32_t validateSQLExpr(SSqlCmd* pCmd, tSqlExpr* pExpr, SQueryInfo* pQuer
if
(
i
==
0
)
{
if
(
i
==
0
)
{
id
=
p1
->
base
.
uid
;
id
=
p1
->
base
.
uid
;
}
else
if
(
id
!=
p1
->
base
.
uid
)
{
continue
;
}
if
(
id
!=
p1
->
base
.
uid
)
{
return
TSDB_CODE_TSC_INVALID_OPERATION
;
return
TSDB_CODE_TSC_INVALID_OPERATION
;
}
}
}
}
...
@@ -3938,7 +3943,7 @@ static bool validateJoinExprNode(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, tSqlExpr
...
@@ -3938,7 +3943,7 @@ static bool validateJoinExprNode(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, tSqlExpr
SColumnIndex
rightIndex
=
COLUMN_INDEX_INITIALIZER
;
SColumnIndex
rightIndex
=
COLUMN_INDEX_INITIALIZER
;
if
(
getColumnIndexByName
(
pCmd
,
&
pRight
->
colInfo
,
pQueryInfo
,
&
rightIndex
)
!=
TSDB_CODE_SUCCESS
)
{
if
(
getColumnIndexByName
(
&
pRight
->
colInfo
,
pQueryInfo
,
&
rightIndex
,
tscGetErrorMsgPayload
(
pCmd
)
)
!=
TSDB_CODE_SUCCESS
)
{
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg1
);
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg1
);
return
false
;
return
false
;
}
}
...
@@ -4048,7 +4053,7 @@ static int32_t handleExprInQueryCond(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, tSql
...
@@ -4048,7 +4053,7 @@ static int32_t handleExprInQueryCond(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, tSql
int32_t
ret
=
TSDB_CODE_SUCCESS
;
int32_t
ret
=
TSDB_CODE_SUCCESS
;
SColumnIndex
index
=
COLUMN_INDEX_INITIALIZER
;
SColumnIndex
index
=
COLUMN_INDEX_INITIALIZER
;
if
(
getColumnIndexByName
(
pCmd
,
&
pLeft
->
colInfo
,
pQueryInfo
,
&
index
)
!=
TSDB_CODE_SUCCESS
)
{
if
(
getColumnIndexByName
(
&
pLeft
->
colInfo
,
pQueryInfo
,
&
index
,
tscGetErrorMsgPayload
(
pCmd
)
)
!=
TSDB_CODE_SUCCESS
)
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg2
);
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg2
);
}
}
...
@@ -4091,7 +4096,7 @@ static int32_t handleExprInQueryCond(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, tSql
...
@@ -4091,7 +4096,7 @@ static int32_t handleExprInQueryCond(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, tSql
int16_t
leftIdx
=
index
.
tableIndex
;
int16_t
leftIdx
=
index
.
tableIndex
;
if
(
getColumnIndexByName
(
pCmd
,
&
pRight
->
colInfo
,
pQueryInfo
,
&
index
)
!=
TSDB_CODE_SUCCESS
)
{
if
(
getColumnIndexByName
(
&
pRight
->
colInfo
,
pQueryInfo
,
&
index
,
tscGetErrorMsgPayload
(
pCmd
)
)
!=
TSDB_CODE_SUCCESS
)
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg2
);
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg2
);
}
}
...
@@ -4254,7 +4259,7 @@ static void doExtractExprForSTable(SSqlCmd* pCmd, tSqlExpr** pExpr, SQueryInfo*
...
@@ -4254,7 +4259,7 @@ static void doExtractExprForSTable(SSqlCmd* pCmd, tSqlExpr** pExpr, SQueryInfo*
tSqlExpr
*
pLeft
=
(
*
pExpr
)
->
pLeft
;
tSqlExpr
*
pLeft
=
(
*
pExpr
)
->
pLeft
;
SColumnIndex
index
=
COLUMN_INDEX_INITIALIZER
;
SColumnIndex
index
=
COLUMN_INDEX_INITIALIZER
;
if
(
getColumnIndexByName
(
pCmd
,
&
pLeft
->
colInfo
,
pQueryInfo
,
&
index
)
!=
TSDB_CODE_SUCCESS
)
{
if
(
getColumnIndexByName
(
&
pLeft
->
colInfo
,
pQueryInfo
,
&
index
,
tscGetErrorMsgPayload
(
pCmd
)
)
!=
TSDB_CODE_SUCCESS
)
{
return
;
return
;
}
}
...
@@ -4421,7 +4426,7 @@ static int32_t getTimeRangeFromExpr(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, tSqlE
...
@@ -4421,7 +4426,7 @@ static int32_t getTimeRangeFromExpr(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, tSqlE
return
getTimeRangeFromExpr
(
pCmd
,
pQueryInfo
,
pExpr
->
pRight
);
return
getTimeRangeFromExpr
(
pCmd
,
pQueryInfo
,
pExpr
->
pRight
);
}
else
{
}
else
{
SColumnIndex
index
=
COLUMN_INDEX_INITIALIZER
;
SColumnIndex
index
=
COLUMN_INDEX_INITIALIZER
;
if
(
getColumnIndexByName
(
pCmd
,
&
pExpr
->
pLeft
->
colInfo
,
pQueryInfo
,
&
index
)
!=
TSDB_CODE_SUCCESS
)
{
if
(
getColumnIndexByName
(
&
pExpr
->
pLeft
->
colInfo
,
pQueryInfo
,
&
index
,
tscGetErrorMsgPayload
(
pCmd
)
)
!=
TSDB_CODE_SUCCESS
)
{
return
TSDB_CODE_TSC_INVALID_OPERATION
;
return
TSDB_CODE_TSC_INVALID_OPERATION
;
}
}
...
@@ -5153,7 +5158,7 @@ int32_t validateOrderbyNode(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SSqlNode* pSq
...
@@ -5153,7 +5158,7 @@ int32_t validateOrderbyNode(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SSqlNode* pSq
SColumnIndex
index
=
COLUMN_INDEX_INITIALIZER
;
SColumnIndex
index
=
COLUMN_INDEX_INITIALIZER
;
if
(
UTIL_TABLE_IS_SUPER_TABLE
(
pTableMetaInfo
))
{
// super table query
if
(
UTIL_TABLE_IS_SUPER_TABLE
(
pTableMetaInfo
))
{
// super table query
if
(
getColumnIndexByName
(
pCmd
,
&
columnName
,
pQueryInfo
,
&
index
)
!=
TSDB_CODE_SUCCESS
)
{
if
(
getColumnIndexByName
(
&
columnName
,
pQueryInfo
,
&
index
,
tscGetErrorMsgPayload
(
pCmd
)
)
!=
TSDB_CODE_SUCCESS
)
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg1
);
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg1
);
}
}
...
@@ -5248,7 +5253,7 @@ int32_t validateOrderbyNode(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SSqlNode* pSq
...
@@ -5248,7 +5253,7 @@ int32_t validateOrderbyNode(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SSqlNode* pSq
pItem
=
taosArrayGet
(
pSqlNode
->
pSortOrder
,
1
);
pItem
=
taosArrayGet
(
pSqlNode
->
pSortOrder
,
1
);
tVariant
*
pVar2
=
&
pItem
->
pVar
;
tVariant
*
pVar2
=
&
pItem
->
pVar
;
SStrToken
cname
=
{
pVar2
->
nLen
,
pVar2
->
nType
,
pVar2
->
pz
};
SStrToken
cname
=
{
pVar2
->
nLen
,
pVar2
->
nType
,
pVar2
->
pz
};
if
(
getColumnIndexByName
(
pCmd
,
&
cname
,
pQueryInfo
,
&
index
)
!=
TSDB_CODE_SUCCESS
)
{
if
(
getColumnIndexByName
(
&
cname
,
pQueryInfo
,
&
index
,
tscGetErrorMsgPayload
(
pCmd
)
)
!=
TSDB_CODE_SUCCESS
)
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg1
);
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg1
);
}
}
...
@@ -5262,7 +5267,7 @@ int32_t validateOrderbyNode(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SSqlNode* pSq
...
@@ -5262,7 +5267,7 @@ int32_t validateOrderbyNode(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SSqlNode* pSq
}
}
}
else
{
// meter query
}
else
{
// meter query
if
(
getColumnIndexByName
(
pCmd
,
&
columnName
,
pQueryInfo
,
&
index
)
!=
TSDB_CODE_SUCCESS
)
{
if
(
getColumnIndexByName
(
&
columnName
,
pQueryInfo
,
&
index
,
tscGetErrorMsgPayload
(
pCmd
)
)
!=
TSDB_CODE_SUCCESS
)
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg1
);
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg1
);
}
}
if
(
index
.
columnIndex
!=
PRIMARYKEY_TIMESTAMP_COL_INDEX
&&
!
isTopBottomQuery
(
pQueryInfo
))
{
if
(
index
.
columnIndex
!=
PRIMARYKEY_TIMESTAMP_COL_INDEX
&&
!
isTopBottomQuery
(
pQueryInfo
))
{
...
@@ -5357,28 +5362,29 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
...
@@ -5357,28 +5362,29 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
return
code
;
return
code
;
}
}
char
*
pMsg
=
tscGetErrorMsgPayload
(
pCmd
);
STableMeta
*
pTableMeta
=
pTableMetaInfo
->
pTableMeta
;
STableMeta
*
pTableMeta
=
pTableMetaInfo
->
pTableMeta
;
if
(
pAlterSQL
->
tableType
==
TSDB_SUPER_TABLE
&&
!
(
UTIL_TABLE_IS_SUPER_TABLE
(
pTableMetaInfo
)))
{
if
(
pAlterSQL
->
tableType
==
TSDB_SUPER_TABLE
&&
!
(
UTIL_TABLE_IS_SUPER_TABLE
(
pTableMetaInfo
)))
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
)
,
msg20
);
return
invalidOperationMsg
(
pMsg
,
msg20
);
}
}
if
(
pAlterSQL
->
type
==
TSDB_ALTER_TABLE_ADD_TAG_COLUMN
||
pAlterSQL
->
type
==
TSDB_ALTER_TABLE_DROP_TAG_COLUMN
||
if
(
pAlterSQL
->
type
==
TSDB_ALTER_TABLE_ADD_TAG_COLUMN
||
pAlterSQL
->
type
==
TSDB_ALTER_TABLE_DROP_TAG_COLUMN
||
pAlterSQL
->
type
==
TSDB_ALTER_TABLE_CHANGE_TAG_COLUMN
||
pAlterSQL
->
type
==
TSDB_ALTER_TABLE_MODIFY_TAG_COLUMN
)
{
pAlterSQL
->
type
==
TSDB_ALTER_TABLE_CHANGE_TAG_COLUMN
||
pAlterSQL
->
type
==
TSDB_ALTER_TABLE_MODIFY_TAG_COLUMN
)
{
if
(
!
UTIL_TABLE_IS_SUPER_TABLE
(
pTableMetaInfo
))
{
if
(
!
UTIL_TABLE_IS_SUPER_TABLE
(
pTableMetaInfo
))
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
)
,
msg3
);
return
invalidOperationMsg
(
pMsg
,
msg3
);
}
}
}
else
if
((
pAlterSQL
->
type
==
TSDB_ALTER_TABLE_UPDATE_TAG_VAL
)
&&
(
UTIL_TABLE_IS_SUPER_TABLE
(
pTableMetaInfo
)))
{
}
else
if
((
pAlterSQL
->
type
==
TSDB_ALTER_TABLE_UPDATE_TAG_VAL
)
&&
(
UTIL_TABLE_IS_SUPER_TABLE
(
pTableMetaInfo
)))
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
)
,
msg4
);
return
invalidOperationMsg
(
pMsg
,
msg4
);
}
else
if
((
pAlterSQL
->
type
==
TSDB_ALTER_TABLE_ADD_COLUMN
||
pAlterSQL
->
type
==
TSDB_ALTER_TABLE_DROP_COLUMN
||
pAlterSQL
->
type
==
TSDB_ALTER_TABLE_CHANGE_COLUMN
)
&&
}
else
if
((
pAlterSQL
->
type
==
TSDB_ALTER_TABLE_ADD_COLUMN
||
pAlterSQL
->
type
==
TSDB_ALTER_TABLE_DROP_COLUMN
||
pAlterSQL
->
type
==
TSDB_ALTER_TABLE_CHANGE_COLUMN
)
&&
UTIL_TABLE_IS_CHILD_TABLE
(
pTableMetaInfo
))
{
UTIL_TABLE_IS_CHILD_TABLE
(
pTableMetaInfo
))
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
)
,
msg6
);
return
invalidOperationMsg
(
pMsg
,
msg6
);
}
}
if
(
pAlterSQL
->
type
==
TSDB_ALTER_TABLE_ADD_TAG_COLUMN
)
{
if
(
pAlterSQL
->
type
==
TSDB_ALTER_TABLE_ADD_TAG_COLUMN
)
{
SArray
*
pFieldList
=
pAlterSQL
->
pAddColumns
;
SArray
*
pFieldList
=
pAlterSQL
->
pAddColumns
;
if
(
taosArrayGetSize
(
pFieldList
)
>
1
)
{
if
(
taosArrayGetSize
(
pFieldList
)
>
1
)
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
)
,
msg5
);
return
invalidOperationMsg
(
pMsg
,
msg5
);
}
}
TAOS_FIELD
*
p
=
taosArrayGet
(
pFieldList
,
0
);
TAOS_FIELD
*
p
=
taosArrayGet
(
pFieldList
,
0
);
...
@@ -5389,31 +5395,31 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
...
@@ -5389,31 +5395,31 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
tscFieldInfoAppend
(
&
pQueryInfo
->
fieldsInfo
,
p
);
tscFieldInfoAppend
(
&
pQueryInfo
->
fieldsInfo
,
p
);
}
else
if
(
pAlterSQL
->
type
==
TSDB_ALTER_TABLE_DROP_TAG_COLUMN
)
{
}
else
if
(
pAlterSQL
->
type
==
TSDB_ALTER_TABLE_DROP_TAG_COLUMN
)
{
if
(
tscGetNumOfTags
(
pTableMeta
)
==
1
)
{
if
(
tscGetNumOfTags
(
pTableMeta
)
==
1
)
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
)
,
msg7
);
return
invalidOperationMsg
(
pMsg
,
msg7
);
}
}
// numOfTags == 1
// numOfTags == 1
if
(
taosArrayGetSize
(
pAlterSQL
->
varList
)
>
1
)
{
if
(
taosArrayGetSize
(
pAlterSQL
->
varList
)
>
1
)
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
)
,
msg8
);
return
invalidOperationMsg
(
pMsg
,
msg8
);
}
}
tVariantListItem
*
pItem
=
taosArrayGet
(
pAlterSQL
->
varList
,
0
);
tVariantListItem
*
pItem
=
taosArrayGet
(
pAlterSQL
->
varList
,
0
);
if
(
pItem
->
pVar
.
nLen
>=
TSDB_COL_NAME_LEN
)
{
if
(
pItem
->
pVar
.
nLen
>=
TSDB_COL_NAME_LEN
)
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
)
,
msg9
);
return
invalidOperationMsg
(
pMsg
,
msg9
);
}
}
SColumnIndex
index
=
COLUMN_INDEX_INITIALIZER
;
SColumnIndex
index
=
COLUMN_INDEX_INITIALIZER
;
SStrToken
name
=
{.
z
=
pItem
->
pVar
.
pz
,
.
n
=
pItem
->
pVar
.
nLen
,
.
type
=
TK_STRING
};
SStrToken
name
=
{.
z
=
pItem
->
pVar
.
pz
,
.
n
=
pItem
->
pVar
.
nLen
,
.
type
=
TK_STRING
};
if
(
getColumnIndexByName
(
pCmd
,
&
name
,
pQueryInfo
,
&
index
)
!=
TSDB_CODE_SUCCESS
)
{
if
(
getColumnIndexByName
(
&
name
,
pQueryInfo
,
&
index
,
tscGetErrorMsgPayload
(
pCmd
)
)
!=
TSDB_CODE_SUCCESS
)
{
return
TSDB_CODE_TSC_INVALID_OPERATION
;
return
TSDB_CODE_TSC_INVALID_OPERATION
;
}
}
int32_t
numOfCols
=
tscGetNumOfColumns
(
pTableMeta
);
int32_t
numOfCols
=
tscGetNumOfColumns
(
pTableMeta
);
if
(
index
.
columnIndex
<
numOfCols
)
{
if
(
index
.
columnIndex
<
numOfCols
)
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
)
,
msg10
);
return
invalidOperationMsg
(
pMsg
,
msg10
);
}
else
if
(
index
.
columnIndex
==
numOfCols
)
{
}
else
if
(
index
.
columnIndex
==
numOfCols
)
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
)
,
msg11
);
return
invalidOperationMsg
(
pMsg
,
msg11
);
}
}
char
name1
[
128
]
=
{
0
};
char
name1
[
128
]
=
{
0
};
...
@@ -5431,24 +5437,24 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
...
@@ -5431,24 +5437,24 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
tVariantListItem
*
pDstItem
=
taosArrayGet
(
pAlterSQL
->
varList
,
1
);
tVariantListItem
*
pDstItem
=
taosArrayGet
(
pAlterSQL
->
varList
,
1
);
if
(
pSrcItem
->
pVar
.
nLen
>=
TSDB_COL_NAME_LEN
||
pDstItem
->
pVar
.
nLen
>=
TSDB_COL_NAME_LEN
)
{
if
(
pSrcItem
->
pVar
.
nLen
>=
TSDB_COL_NAME_LEN
||
pDstItem
->
pVar
.
nLen
>=
TSDB_COL_NAME_LEN
)
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
)
,
msg9
);
return
invalidOperationMsg
(
pMsg
,
msg9
);
}
}
if
(
pSrcItem
->
pVar
.
nType
!=
TSDB_DATA_TYPE_BINARY
||
pDstItem
->
pVar
.
nType
!=
TSDB_DATA_TYPE_BINARY
)
{
if
(
pSrcItem
->
pVar
.
nType
!=
TSDB_DATA_TYPE_BINARY
||
pDstItem
->
pVar
.
nType
!=
TSDB_DATA_TYPE_BINARY
)
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
)
,
msg10
);
return
invalidOperationMsg
(
pMsg
,
msg10
);
}
}
SColumnIndex
srcIndex
=
COLUMN_INDEX_INITIALIZER
;
SColumnIndex
srcIndex
=
COLUMN_INDEX_INITIALIZER
;
SColumnIndex
destIndex
=
COLUMN_INDEX_INITIALIZER
;
SColumnIndex
destIndex
=
COLUMN_INDEX_INITIALIZER
;
SStrToken
srcToken
=
{.
z
=
pSrcItem
->
pVar
.
pz
,
.
n
=
pSrcItem
->
pVar
.
nLen
,
.
type
=
TK_STRING
};
SStrToken
srcToken
=
{.
z
=
pSrcItem
->
pVar
.
pz
,
.
n
=
pSrcItem
->
pVar
.
nLen
,
.
type
=
TK_STRING
};
if
(
getColumnIndexByName
(
pCmd
,
&
srcToken
,
pQueryInfo
,
&
srcIndex
)
!=
TSDB_CODE_SUCCESS
)
{
if
(
getColumnIndexByName
(
&
srcToken
,
pQueryInfo
,
&
srcIndex
,
tscGetErrorMsgPayload
(
pCmd
)
)
!=
TSDB_CODE_SUCCESS
)
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
)
,
msg17
);
return
invalidOperationMsg
(
pMsg
,
msg17
);
}
}
SStrToken
destToken
=
{.
z
=
pDstItem
->
pVar
.
pz
,
.
n
=
pDstItem
->
pVar
.
nLen
,
.
type
=
TK_STRING
};
SStrToken
destToken
=
{.
z
=
pDstItem
->
pVar
.
pz
,
.
n
=
pDstItem
->
pVar
.
nLen
,
.
type
=
TK_STRING
};
if
(
getColumnIndexByName
(
pCmd
,
&
destToken
,
pQueryInfo
,
&
destIndex
)
==
TSDB_CODE_SUCCESS
)
{
if
(
getColumnIndexByName
(
&
destToken
,
pQueryInfo
,
&
destIndex
,
tscGetErrorMsgPayload
(
pCmd
)
)
==
TSDB_CODE_SUCCESS
)
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
)
,
msg19
);
return
invalidOperationMsg
(
pMsg
,
msg19
);
}
}
tVariantListItem
*
pItem
=
taosArrayGet
(
pVarList
,
0
);
tVariantListItem
*
pItem
=
taosArrayGet
(
pVarList
,
0
);
...
@@ -5475,12 +5481,12 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
...
@@ -5475,12 +5481,12 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
SColumnIndex
columnIndex
=
COLUMN_INDEX_INITIALIZER
;
SColumnIndex
columnIndex
=
COLUMN_INDEX_INITIALIZER
;
SStrToken
name
=
{.
type
=
TK_STRING
,
.
z
=
item
->
pVar
.
pz
,
.
n
=
item
->
pVar
.
nLen
};
SStrToken
name
=
{.
type
=
TK_STRING
,
.
z
=
item
->
pVar
.
pz
,
.
n
=
item
->
pVar
.
nLen
};
if
(
getColumnIndexByName
(
pCmd
,
&
name
,
pQueryInfo
,
&
columnIndex
)
!=
TSDB_CODE_SUCCESS
)
{
if
(
getColumnIndexByName
(
&
name
,
pQueryInfo
,
&
columnIndex
,
tscGetErrorMsgPayload
(
pCmd
)
)
!=
TSDB_CODE_SUCCESS
)
{
return
TSDB_CODE_TSC_INVALID_OPERATION
;
return
TSDB_CODE_TSC_INVALID_OPERATION
;
}
}
if
(
columnIndex
.
columnIndex
<
tscGetNumOfColumns
(
pTableMeta
))
{
if
(
columnIndex
.
columnIndex
<
tscGetNumOfColumns
(
pTableMeta
))
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
)
,
msg12
);
return
invalidOperationMsg
(
pMsg
,
msg12
);
}
}
tVariantListItem
*
pItem
=
taosArrayGet
(
pVarList
,
1
);
tVariantListItem
*
pItem
=
taosArrayGet
(
pVarList
,
1
);
...
@@ -5488,7 +5494,7 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
...
@@ -5488,7 +5494,7 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
pAlterSQL
->
tagData
.
data
=
calloc
(
1
,
pTagsSchema
->
bytes
*
TSDB_NCHAR_SIZE
+
VARSTR_HEADER_SIZE
);
pAlterSQL
->
tagData
.
data
=
calloc
(
1
,
pTagsSchema
->
bytes
*
TSDB_NCHAR_SIZE
+
VARSTR_HEADER_SIZE
);
if
(
tVariantDump
(
&
pItem
->
pVar
,
pAlterSQL
->
tagData
.
data
,
pTagsSchema
->
type
,
true
)
!=
TSDB_CODE_SUCCESS
)
{
if
(
tVariantDump
(
&
pItem
->
pVar
,
pAlterSQL
->
tagData
.
data
,
pTagsSchema
->
type
,
true
)
!=
TSDB_CODE_SUCCESS
)
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
)
,
msg13
);
return
invalidOperationMsg
(
pMsg
,
msg13
);
}
}
pAlterSQL
->
tagData
.
dataLen
=
pTagsSchema
->
bytes
;
pAlterSQL
->
tagData
.
dataLen
=
pTagsSchema
->
bytes
;
...
@@ -5496,14 +5502,14 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
...
@@ -5496,14 +5502,14 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
// validate the length of binary
// validate the length of binary
if
((
pTagsSchema
->
type
==
TSDB_DATA_TYPE_BINARY
||
pTagsSchema
->
type
==
TSDB_DATA_TYPE_NCHAR
)
&&
if
((
pTagsSchema
->
type
==
TSDB_DATA_TYPE_BINARY
||
pTagsSchema
->
type
==
TSDB_DATA_TYPE_NCHAR
)
&&
varDataTLen
(
pAlterSQL
->
tagData
.
data
)
>
pTagsSchema
->
bytes
)
{
varDataTLen
(
pAlterSQL
->
tagData
.
data
)
>
pTagsSchema
->
bytes
)
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
)
,
msg14
);
return
invalidOperationMsg
(
pMsg
,
msg14
);
}
}
int32_t
schemaLen
=
sizeof
(
STColumn
)
*
numOfTags
;
int32_t
schemaLen
=
sizeof
(
STColumn
)
*
numOfTags
;
int32_t
size
=
sizeof
(
SUpdateTableTagValMsg
)
+
pTagsSchema
->
bytes
+
schemaLen
+
TSDB_EXTRA_PAYLOAD_SIZE
;
int32_t
size
=
sizeof
(
SUpdateTableTagValMsg
)
+
pTagsSchema
->
bytes
+
schemaLen
+
TSDB_EXTRA_PAYLOAD_SIZE
;
if
(
TSDB_CODE_SUCCESS
!=
tscAllocPayload
(
pCmd
,
size
))
{
if
(
TSDB_CODE_SUCCESS
!=
tscAllocPayload
(
pCmd
,
size
))
{
tscError
(
"0x%"
PRIx64
" failed to malloc for alter table
m
sg"
,
pSql
->
self
);
tscError
(
"0x%"
PRIx64
" failed to malloc for alter table
pM
sg"
,
pSql
->
self
);
return
TSDB_CODE_TSC_OUT_OF_MEMORY
;
return
TSDB_CODE_TSC_OUT_OF_MEMORY
;
}
}
...
@@ -5518,7 +5524,7 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
...
@@ -5518,7 +5524,7 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
pUpdateMsg
->
numOfTags
=
htons
(
numOfTags
);
pUpdateMsg
->
numOfTags
=
htons
(
numOfTags
);
pUpdateMsg
->
schemaLen
=
htonl
(
schemaLen
);
pUpdateMsg
->
schemaLen
=
htonl
(
schemaLen
);
// the schema is located after the
m
sg body, then followed by true tag value
// the schema is located after the
pM
sg body, then followed by true tag value
char
*
d
=
pUpdateMsg
->
data
;
char
*
d
=
pUpdateMsg
->
data
;
SSchema
*
pTagCols
=
tscGetTableTagSchema
(
pTableMeta
);
SSchema
*
pTagCols
=
tscGetTableTagSchema
(
pTableMeta
);
for
(
int
i
=
0
;
i
<
numOfTags
;
++
i
)
{
for
(
int
i
=
0
;
i
<
numOfTags
;
++
i
)
{
...
@@ -5531,7 +5537,7 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
...
@@ -5531,7 +5537,7 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
d
+=
sizeof
(
STColumn
);
d
+=
sizeof
(
STColumn
);
}
}
// copy the tag value to
m
sg body
// copy the tag value to
pM
sg body
pItem
=
taosArrayGet
(
pVarList
,
1
);
pItem
=
taosArrayGet
(
pVarList
,
1
);
tVariantDump
(
&
pItem
->
pVar
,
pUpdateMsg
->
data
+
schemaLen
,
pTagsSchema
->
type
,
true
);
tVariantDump
(
&
pItem
->
pVar
,
pUpdateMsg
->
data
+
schemaLen
,
pTagsSchema
->
type
,
true
);
...
@@ -5550,8 +5556,8 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
...
@@ -5550,8 +5556,8 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
}
else
if
(
pAlterSQL
->
type
==
TSDB_ALTER_TABLE_ADD_COLUMN
)
{
}
else
if
(
pAlterSQL
->
type
==
TSDB_ALTER_TABLE_ADD_COLUMN
)
{
SArray
*
pFieldList
=
pAlterSQL
->
pAddColumns
;
SArray
*
pFieldList
=
pAlterSQL
->
pAddColumns
;
if
(
taosArrayGetSize
(
pFieldList
)
>
1
)
{
if
(
taosArrayGetSize
(
pFieldList
)
>
1
)
{
const
char
*
msg
=
"only support add one column"
;
const
char
*
msg
x
=
"only support add one column"
;
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg
);
return
invalidOperationMsg
(
pMsg
,
msgx
);
}
}
TAOS_FIELD
*
p
=
taosArrayGet
(
pFieldList
,
0
);
TAOS_FIELD
*
p
=
taosArrayGet
(
pFieldList
,
0
);
...
@@ -5562,24 +5568,24 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
...
@@ -5562,24 +5568,24 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
tscFieldInfoAppend
(
&
pQueryInfo
->
fieldsInfo
,
p
);
tscFieldInfoAppend
(
&
pQueryInfo
->
fieldsInfo
,
p
);
}
else
if
(
pAlterSQL
->
type
==
TSDB_ALTER_TABLE_DROP_COLUMN
)
{
}
else
if
(
pAlterSQL
->
type
==
TSDB_ALTER_TABLE_DROP_COLUMN
)
{
if
(
tscGetNumOfColumns
(
pTableMeta
)
==
TSDB_MIN_COLUMNS
)
{
//
if
(
tscGetNumOfColumns
(
pTableMeta
)
==
TSDB_MIN_COLUMNS
)
{
//
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
)
,
msg15
);
return
invalidOperationMsg
(
pMsg
,
msg15
);
}
}
size_t
size
=
taosArrayGetSize
(
pAlterSQL
->
varList
);
size_t
size
=
taosArrayGetSize
(
pAlterSQL
->
varList
);
if
(
size
>
1
)
{
if
(
size
>
1
)
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
)
,
msg16
);
return
invalidOperationMsg
(
pMsg
,
msg16
);
}
}
tVariantListItem
*
pItem
=
taosArrayGet
(
pAlterSQL
->
varList
,
0
);
tVariantListItem
*
pItem
=
taosArrayGet
(
pAlterSQL
->
varList
,
0
);
SColumnIndex
columnIndex
=
COLUMN_INDEX_INITIALIZER
;
SColumnIndex
columnIndex
=
COLUMN_INDEX_INITIALIZER
;
SStrToken
name
=
{.
type
=
TK_STRING
,
.
z
=
pItem
->
pVar
.
pz
,
.
n
=
pItem
->
pVar
.
nLen
};
SStrToken
name
=
{.
type
=
TK_STRING
,
.
z
=
pItem
->
pVar
.
pz
,
.
n
=
pItem
->
pVar
.
nLen
};
if
(
getColumnIndexByName
(
pCmd
,
&
name
,
pQueryInfo
,
&
columnIndex
)
!=
TSDB_CODE_SUCCESS
)
{
if
(
getColumnIndexByName
(
&
name
,
pQueryInfo
,
&
columnIndex
,
tscGetErrorMsgPayload
(
pCmd
)
)
!=
TSDB_CODE_SUCCESS
)
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
)
,
msg17
);
return
invalidOperationMsg
(
pMsg
,
msg17
);
}
}
if
(
columnIndex
.
columnIndex
==
PRIMARYKEY_TIMESTAMP_COL_INDEX
)
{
if
(
columnIndex
.
columnIndex
==
PRIMARYKEY_TIMESTAMP_COL_INDEX
)
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
)
,
msg18
);
return
invalidOperationMsg
(
pMsg
,
msg18
);
}
}
char
name1
[
TSDB_COL_NAME_LEN
]
=
{
0
};
char
name1
[
TSDB_COL_NAME_LEN
]
=
{
0
};
...
@@ -5588,79 +5594,79 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
...
@@ -5588,79 +5594,79 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
tscFieldInfoAppend
(
&
pQueryInfo
->
fieldsInfo
,
&
f
);
tscFieldInfoAppend
(
&
pQueryInfo
->
fieldsInfo
,
&
f
);
}
else
if
(
pAlterSQL
->
type
==
TSDB_ALTER_TABLE_CHANGE_COLUMN
)
{
}
else
if
(
pAlterSQL
->
type
==
TSDB_ALTER_TABLE_CHANGE_COLUMN
)
{
if
(
taosArrayGetSize
(
pAlterSQL
->
pAddColumns
)
>=
2
)
{
if
(
taosArrayGetSize
(
pAlterSQL
->
pAddColumns
)
>=
2
)
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
)
,
msg16
);
return
invalidOperationMsg
(
pMsg
,
msg16
);
}
}
TAOS_FIELD
*
pItem
=
taosArrayGet
(
pAlterSQL
->
pAddColumns
,
0
);
TAOS_FIELD
*
pItem
=
taosArrayGet
(
pAlterSQL
->
pAddColumns
,
0
);
if
(
pItem
->
type
!=
TSDB_DATA_TYPE_BINARY
&&
pItem
->
type
!=
TSDB_DATA_TYPE_NCHAR
)
{
if
(
pItem
->
type
!=
TSDB_DATA_TYPE_BINARY
&&
pItem
->
type
!=
TSDB_DATA_TYPE_NCHAR
)
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
)
,
msg21
);
return
invalidOperationMsg
(
pMsg
,
msg21
);
}
}
SColumnIndex
columnIndex
=
COLUMN_INDEX_INITIALIZER
;
SColumnIndex
columnIndex
=
COLUMN_INDEX_INITIALIZER
;
SStrToken
name
=
{.
type
=
TK_STRING
,
.
z
=
pItem
->
name
,
.
n
=
(
uint32_t
)
strlen
(
pItem
->
name
)};
SStrToken
name
=
{.
type
=
TK_STRING
,
.
z
=
pItem
->
name
,
.
n
=
(
uint32_t
)
strlen
(
pItem
->
name
)};
if
(
getColumnIndexByName
(
pCmd
,
&
name
,
pQueryInfo
,
&
columnIndex
)
!=
TSDB_CODE_SUCCESS
)
{
if
(
getColumnIndexByName
(
&
name
,
pQueryInfo
,
&
columnIndex
,
tscGetErrorMsgPayload
(
pCmd
)
)
!=
TSDB_CODE_SUCCESS
)
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
)
,
msg17
);
return
invalidOperationMsg
(
pMsg
,
msg17
);
}
}
SSchema
*
pColSchema
=
tscGetTableColumnSchema
(
pTableMetaInfo
->
pTableMeta
,
columnIndex
.
columnIndex
);
SSchema
*
pColSchema
=
tscGetTableColumnSchema
(
pTableMetaInfo
->
pTableMeta
,
columnIndex
.
columnIndex
);
if
(
pColSchema
->
type
!=
TSDB_DATA_TYPE_BINARY
&&
pColSchema
->
type
!=
TSDB_DATA_TYPE_NCHAR
)
{
if
(
pColSchema
->
type
!=
TSDB_DATA_TYPE_BINARY
&&
pColSchema
->
type
!=
TSDB_DATA_TYPE_NCHAR
)
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
)
,
msg21
);
return
invalidOperationMsg
(
pMsg
,
msg21
);
}
}
if
(
pItem
->
type
!=
pColSchema
->
type
)
{
if
(
pItem
->
type
!=
pColSchema
->
type
)
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
)
,
msg23
);
return
invalidOperationMsg
(
pMsg
,
msg23
);
}
}
if
((
pItem
->
type
==
TSDB_DATA_TYPE_BINARY
&&
(
pItem
->
bytes
<=
0
||
pItem
->
bytes
>
TSDB_MAX_BINARY_LEN
))
||
if
((
pItem
->
type
==
TSDB_DATA_TYPE_BINARY
&&
(
pItem
->
bytes
<=
0
||
pItem
->
bytes
>
TSDB_MAX_BINARY_LEN
))
||
(
pItem
->
type
==
TSDB_DATA_TYPE_NCHAR
&&
(
pItem
->
bytes
<=
0
||
pItem
->
bytes
>
TSDB_MAX_NCHAR_LEN
)))
{
(
pItem
->
type
==
TSDB_DATA_TYPE_NCHAR
&&
(
pItem
->
bytes
<=
0
||
pItem
->
bytes
>
TSDB_MAX_NCHAR_LEN
)))
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
)
,
msg24
);
return
invalidOperationMsg
(
pMsg
,
msg24
);
}
}
if
(
pItem
->
bytes
<=
pColSchema
->
bytes
)
{
if
(
pItem
->
bytes
<=
pColSchema
->
bytes
)
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
)
,
msg22
);
return
invalidOperationMsg
(
pMsg
,
msg22
);
}
}
TAOS_FIELD
f
=
tscCreateField
(
pColSchema
->
type
,
name
.
z
,
pItem
->
bytes
);
TAOS_FIELD
f
=
tscCreateField
(
pColSchema
->
type
,
name
.
z
,
pItem
->
bytes
);
tscFieldInfoAppend
(
&
pQueryInfo
->
fieldsInfo
,
&
f
);
tscFieldInfoAppend
(
&
pQueryInfo
->
fieldsInfo
,
&
f
);
}
else
if
(
pAlterSQL
->
type
==
TSDB_ALTER_TABLE_MODIFY_TAG_COLUMN
)
{
}
else
if
(
pAlterSQL
->
type
==
TSDB_ALTER_TABLE_MODIFY_TAG_COLUMN
)
{
if
(
taosArrayGetSize
(
pAlterSQL
->
pAddColumns
)
>=
2
)
{
if
(
taosArrayGetSize
(
pAlterSQL
->
pAddColumns
)
>=
2
)
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
)
,
msg16
);
return
invalidOperationMsg
(
pMsg
,
msg16
);
}
}
TAOS_FIELD
*
pItem
=
taosArrayGet
(
pAlterSQL
->
pAddColumns
,
0
);
TAOS_FIELD
*
pItem
=
taosArrayGet
(
pAlterSQL
->
pAddColumns
,
0
);
if
(
pItem
->
type
!=
TSDB_DATA_TYPE_BINARY
&&
pItem
->
type
!=
TSDB_DATA_TYPE_NCHAR
)
{
if
(
pItem
->
type
!=
TSDB_DATA_TYPE_BINARY
&&
pItem
->
type
!=
TSDB_DATA_TYPE_NCHAR
)
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
)
,
msg21
);
return
invalidOperationMsg
(
pMsg
,
msg21
);
}
}
SColumnIndex
columnIndex
=
COLUMN_INDEX_INITIALIZER
;
SColumnIndex
columnIndex
=
COLUMN_INDEX_INITIALIZER
;
SStrToken
name
=
{.
type
=
TK_STRING
,
.
z
=
pItem
->
name
,
.
n
=
(
uint32_t
)
strlen
(
pItem
->
name
)};
SStrToken
name
=
{.
type
=
TK_STRING
,
.
z
=
pItem
->
name
,
.
n
=
(
uint32_t
)
strlen
(
pItem
->
name
)};
if
(
getColumnIndexByName
(
pCmd
,
&
name
,
pQueryInfo
,
&
columnIndex
)
!=
TSDB_CODE_SUCCESS
)
{
if
(
getColumnIndexByName
(
&
name
,
pQueryInfo
,
&
columnIndex
,
tscGetErrorMsgPayload
(
pCmd
)
)
!=
TSDB_CODE_SUCCESS
)
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
)
,
msg17
);
return
invalidOperationMsg
(
pMsg
,
msg17
);
}
}
SSchema
*
pColSchema
=
tscGetTableColumnSchema
(
pTableMetaInfo
->
pTableMeta
,
columnIndex
.
columnIndex
);
SSchema
*
pColSchema
=
tscGetTableColumnSchema
(
pTableMetaInfo
->
pTableMeta
,
columnIndex
.
columnIndex
);
if
(
columnIndex
.
columnIndex
<
tscGetNumOfColumns
(
pTableMetaInfo
->
pTableMeta
))
{
if
(
columnIndex
.
columnIndex
<
tscGetNumOfColumns
(
pTableMetaInfo
->
pTableMeta
))
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
)
,
msg10
);
return
invalidOperationMsg
(
pMsg
,
msg10
);
}
}
if
(
pColSchema
->
type
!=
TSDB_DATA_TYPE_BINARY
&&
pColSchema
->
type
!=
TSDB_DATA_TYPE_NCHAR
)
{
if
(
pColSchema
->
type
!=
TSDB_DATA_TYPE_BINARY
&&
pColSchema
->
type
!=
TSDB_DATA_TYPE_NCHAR
)
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
)
,
msg21
);
return
invalidOperationMsg
(
pMsg
,
msg21
);
}
}
if
(
pItem
->
type
!=
pColSchema
->
type
)
{
if
(
pItem
->
type
!=
pColSchema
->
type
)
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
)
,
msg23
);
return
invalidOperationMsg
(
pMsg
,
msg23
);
}
}
if
((
pItem
->
type
==
TSDB_DATA_TYPE_BINARY
&&
(
pItem
->
bytes
<=
0
||
pItem
->
bytes
>
TSDB_MAX_BINARY_LEN
))
||
if
((
pItem
->
type
==
TSDB_DATA_TYPE_BINARY
&&
(
pItem
->
bytes
<=
0
||
pItem
->
bytes
>
TSDB_MAX_BINARY_LEN
))
||
(
pItem
->
type
==
TSDB_DATA_TYPE_NCHAR
&&
(
pItem
->
bytes
<=
0
||
pItem
->
bytes
>
TSDB_MAX_NCHAR_LEN
)))
{
(
pItem
->
type
==
TSDB_DATA_TYPE_NCHAR
&&
(
pItem
->
bytes
<=
0
||
pItem
->
bytes
>
TSDB_MAX_NCHAR_LEN
)))
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
)
,
msg24
);
return
invalidOperationMsg
(
pMsg
,
msg24
);
}
}
if
(
pItem
->
bytes
<=
pColSchema
->
bytes
)
{
if
(
pItem
->
bytes
<=
pColSchema
->
bytes
)
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
)
,
msg22
);
return
invalidOperationMsg
(
pMsg
,
msg22
);
}
}
TAOS_FIELD
f
=
tscCreateField
(
pColSchema
->
type
,
name
.
z
,
pItem
->
bytes
);
TAOS_FIELD
f
=
tscCreateField
(
pColSchema
->
type
,
name
.
z
,
pItem
->
bytes
);
...
@@ -6938,7 +6944,7 @@ int32_t doCheckForCreateFromStable(SSqlObj* pSql, SSqlInfo* pInfo) {
...
@@ -6938,7 +6944,7 @@ int32_t doCheckForCreateFromStable(SSqlObj* pSql, SSqlInfo* pInfo) {
if
(
strncmp
(
sToken
->
z
,
pTagSchema
[
t
].
name
,
sToken
->
n
)
==
0
&&
strlen
(
pTagSchema
[
t
].
name
)
==
sToken
->
n
)
{
if
(
strncmp
(
sToken
->
z
,
pTagSchema
[
t
].
name
,
sToken
->
n
)
==
0
&&
strlen
(
pTagSchema
[
t
].
name
)
==
sToken
->
n
)
{
SSchema
*
pSchema
=
&
pTagSchema
[
t
];
SSchema
*
pSchema
=
&
pTagSchema
[
t
];
char
tagVal
[
TSDB_MAX_TAGS_LEN
];
char
tagVal
[
TSDB_MAX_TAGS_LEN
]
=
{
0
}
;
if
(
pSchema
->
type
==
TSDB_DATA_TYPE_BINARY
||
pSchema
->
type
==
TSDB_DATA_TYPE_NCHAR
)
{
if
(
pSchema
->
type
==
TSDB_DATA_TYPE_BINARY
||
pSchema
->
type
==
TSDB_DATA_TYPE_NCHAR
)
{
if
(
pItem
->
pVar
.
nLen
>
pSchema
->
bytes
)
{
if
(
pItem
->
pVar
.
nLen
>
pSchema
->
bytes
)
{
tdDestroyKVRowBuilder
(
&
kvRowBuilder
);
tdDestroyKVRowBuilder
(
&
kvRowBuilder
);
...
@@ -7241,7 +7247,7 @@ int32_t tscGetExprFilters(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SArray* pSelect
...
@@ -7241,7 +7247,7 @@ int32_t tscGetExprFilters(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SArray* pSelect
}
else
{
}
else
{
tSqlExprItem
*
pParamElem
=
taosArrayGet
(
pSqlExpr
->
pParam
,
0
);
tSqlExprItem
*
pParamElem
=
taosArrayGet
(
pSqlExpr
->
pParam
,
0
);
SStrToken
*
pToken
=
&
pParamElem
->
pNode
->
colInfo
;
SStrToken
*
pToken
=
&
pParamElem
->
pNode
->
colInfo
;
getColumnIndexByName
(
p
Cmd
,
pToken
,
pQueryInfo
,
&
index
);
getColumnIndexByName
(
p
Token
,
pQueryInfo
,
&
index
,
tscGetErrorMsgPayload
(
pCmd
)
);
}
}
size_t
numOfNodeInSel
=
tscNumOfExprs
(
pQueryInfo
);
size_t
numOfNodeInSel
=
tscNumOfExprs
(
pQueryInfo
);
...
@@ -7429,7 +7435,7 @@ int32_t getHavingExpr(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SArray* pSelectNode
...
@@ -7429,7 +7435,7 @@ int32_t getHavingExpr(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SArray* pSelectNode
if
(
pExpr1
->
tokenId
==
TK_ID
)
{
if
(
pExpr1
->
tokenId
==
TK_ID
)
{
SColumnIndex
index
=
COLUMN_INDEX_INITIALIZER
;
SColumnIndex
index
=
COLUMN_INDEX_INITIALIZER
;
if
((
getColumnIndexByName
(
pCmd
,
&
pExpr1
->
colInfo
,
pQueryInfo
,
&
index
)
!=
TSDB_CODE_SUCCESS
))
{
if
((
getColumnIndexByName
(
&
pExpr1
->
colInfo
,
pQueryInfo
,
&
index
,
tscGetErrorMsgPayload
(
pCmd
)
)
!=
TSDB_CODE_SUCCESS
))
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg1
);
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg1
);
}
}
...
@@ -7855,6 +7861,12 @@ int32_t validateSqlNode(SSqlObj* pSql, SSqlNode* pSqlNode, SQueryInfo* pQueryInf
...
@@ -7855,6 +7861,12 @@ int32_t validateSqlNode(SSqlObj* pSql, SSqlNode* pSqlNode, SQueryInfo* pQueryInf
int32_t
timeWindowQuery
=
int32_t
timeWindowQuery
=
(
TPARSER_HAS_TOKEN
(
pSqlNode
->
interval
.
interval
)
||
TPARSER_HAS_TOKEN
(
pSqlNode
->
sessionVal
.
gap
));
(
TPARSER_HAS_TOKEN
(
pSqlNode
->
interval
.
interval
)
||
TPARSER_HAS_TOKEN
(
pSqlNode
->
sessionVal
.
gap
));
TSDB_QUERY_SET_TYPE
(
pQueryInfo
->
type
,
TSDB_QUERY_TYPE_TABLE_QUERY
);
// parse the group by clause in the first place
if
(
validateGroupbyNode
(
pQueryInfo
,
pSqlNode
->
pGroupby
,
pCmd
)
!=
TSDB_CODE_SUCCESS
)
{
return
TSDB_CODE_TSC_INVALID_OPERATION
;
}
if
(
validateSelectNodeList
(
pCmd
,
pQueryInfo
,
pSqlNode
->
pSelNodeList
,
false
,
false
,
timeWindowQuery
)
!=
if
(
validateSelectNodeList
(
pCmd
,
pQueryInfo
,
pSqlNode
->
pSelNodeList
,
false
,
false
,
timeWindowQuery
)
!=
TSDB_CODE_SUCCESS
)
{
TSDB_CODE_SUCCESS
)
{
...
@@ -8184,7 +8196,7 @@ int32_t exprTreeFromSqlExpr(SSqlCmd* pCmd, tExprNode **pExpr, const tSqlExpr* pS
...
@@ -8184,7 +8196,7 @@ int32_t exprTreeFromSqlExpr(SSqlCmd* pCmd, tExprNode **pExpr, const tSqlExpr* pS
}
}
}
else
if
(
pSqlExpr
->
type
==
SQL_NODE_TABLE_COLUMN
)
{
// column name, normal column arithmetic expression
}
else
if
(
pSqlExpr
->
type
==
SQL_NODE_TABLE_COLUMN
)
{
// column name, normal column arithmetic expression
SColumnIndex
index
=
COLUMN_INDEX_INITIALIZER
;
SColumnIndex
index
=
COLUMN_INDEX_INITIALIZER
;
int32_t
ret
=
getColumnIndexByName
(
pCmd
,
&
pSqlExpr
->
colInfo
,
pQueryInfo
,
&
index
);
int32_t
ret
=
getColumnIndexByName
(
&
pSqlExpr
->
colInfo
,
pQueryInfo
,
&
index
,
tscGetErrorMsgPayload
(
pCmd
)
);
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
return
ret
;
return
ret
;
}
}
...
...
src/client/src/tscServer.c
浏览文件 @
c4f96ffc
...
@@ -2398,11 +2398,12 @@ int tscProcessRetrieveRspFromNode(SSqlObj *pSql) {
...
@@ -2398,11 +2398,12 @@ int tscProcessRetrieveRspFromNode(SSqlObj *pSql) {
}
}
STableMetaInfo
*
pTableMetaInfo
=
tscGetMetaInfo
(
pQueryInfo
,
0
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMetaInfo
(
pQueryInfo
,
0
);
if
(
pCmd
->
command
==
TSDB_SQL_RETRIEVE
)
{
if
((
pCmd
->
command
==
TSDB_SQL_RETRIEVE
)
||
tscSetResRawPtr
(
pRes
,
pQueryInfo
);
((
UTIL_TABLE_IS_CHILD_TABLE
(
pTableMetaInfo
)
||
UTIL_TABLE_IS_NORMAL_TABLE
(
pTableMetaInfo
))
&&
}
else
if
((
UTIL_TABLE_IS_CHILD_TABLE
(
pTableMetaInfo
)
||
UTIL_TABLE_IS_NORMAL_TABLE
(
pTableMetaInfo
))
&&
!
TSDB_QUERY_HAS_TYPE
(
pQueryInfo
->
type
,
TSDB_QUERY_TYPE_SUBQUERY
))
{
!
TSDB_QUERY_HAS_TYPE
(
pQueryInfo
->
type
,
TSDB_QUERY_TYPE_SUBQUERY
))
||
tscSetResRawPtr
(
pRes
,
pQueryInfo
);
(
tscNonOrderedProjectionQueryOnSTable
(
pQueryInfo
,
0
)
&&
}
else
if
(
tscNonOrderedProjectionQueryOnSTable
(
pQueryInfo
,
0
)
&&
!
TSDB_QUERY_HAS_TYPE
(
pQueryInfo
->
type
,
TSDB_QUERY_TYPE_JOIN_QUERY
)
&&
!
TSDB_QUERY_HAS_TYPE
(
pQueryInfo
->
type
,
TSDB_QUERY_TYPE_JOIN_SEC_STAGE
))
{
!
TSDB_QUERY_HAS_TYPE
(
pQueryInfo
->
type
,
TSDB_QUERY_TYPE_JOIN_QUERY
)
&&
!
TSDB_QUERY_HAS_TYPE
(
pQueryInfo
->
type
,
TSDB_QUERY_TYPE_JOIN_SEC_STAGE
)))
{
tscSetResRawPtr
(
pRes
,
pQueryInfo
);
tscSetResRawPtr
(
pRes
,
pQueryInfo
);
}
}
...
...
src/client/src/tscSubquery.c
浏览文件 @
c4f96ffc
...
@@ -2450,6 +2450,7 @@ int32_t tscHandleMasterSTableQuery(SSqlObj *pSql) {
...
@@ -2450,6 +2450,7 @@ int32_t tscHandleMasterSTableQuery(SSqlObj *pSql) {
if
(
ret
!=
0
)
{
if
(
ret
!=
0
)
{
pRes
->
code
=
ret
;
pRes
->
code
=
ret
;
tscAsyncResultOnError
(
pSql
);
tscAsyncResultOnError
(
pSql
);
tfree
(
pDesc
);
tfree
(
pMemoryBuf
);
tfree
(
pMemoryBuf
);
return
ret
;
return
ret
;
}
}
...
...
src/client/src/tscUtil.c
浏览文件 @
c4f96ffc
...
@@ -578,19 +578,7 @@ int32_t tscCreateResPointerInfo(SSqlRes* pRes, SQueryInfo* pQueryInfo) {
...
@@ -578,19 +578,7 @@ int32_t tscCreateResPointerInfo(SSqlRes* pRes, SQueryInfo* pQueryInfo) {
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
void
tscSetResRawPtr
(
SSqlRes
*
pRes
,
SQueryInfo
*
pQueryInfo
)
{
static
void
setResRawPtrImpl
(
SSqlRes
*
pRes
,
SInternalField
*
pInfo
,
int32_t
i
,
bool
convertNchar
)
{
assert
(
pRes
->
numOfCols
>
0
);
int32_t
offset
=
0
;
for
(
int32_t
i
=
0
;
i
<
pQueryInfo
->
fieldsInfo
.
numOfOutput
;
++
i
)
{
SInternalField
*
pInfo
=
(
SInternalField
*
)
TARRAY_GET_ELEM
(
pQueryInfo
->
fieldsInfo
.
internalField
,
i
);
pRes
->
urow
[
i
]
=
pRes
->
data
+
offset
*
pRes
->
numOfRows
;
pRes
->
length
[
i
]
=
pInfo
->
field
.
bytes
;
offset
+=
pInfo
->
field
.
bytes
;
// generated the user-defined column result
// generated the user-defined column result
if
(
pInfo
->
pExpr
->
pExpr
==
NULL
&&
TSDB_COL_IS_UD_COL
(
pInfo
->
pExpr
->
base
.
colInfo
.
flag
))
{
if
(
pInfo
->
pExpr
->
pExpr
==
NULL
&&
TSDB_COL_IS_UD_COL
(
pInfo
->
pExpr
->
base
.
colInfo
.
flag
))
{
if
(
pInfo
->
pExpr
->
base
.
param
[
1
].
nType
==
TSDB_DATA_TYPE_NULL
)
{
if
(
pInfo
->
pExpr
->
base
.
param
[
1
].
nType
==
TSDB_DATA_TYPE_NULL
)
{
...
@@ -613,7 +601,7 @@ void tscSetResRawPtr(SSqlRes* pRes, SQueryInfo* pQueryInfo) {
...
@@ -613,7 +601,7 @@ void tscSetResRawPtr(SSqlRes* pRes, SQueryInfo* pQueryInfo) {
}
}
}
}
}
else
if
(
pInfo
->
field
.
type
==
TSDB_DATA_TYPE_NCHAR
)
{
}
else
if
(
convertNchar
&&
pInfo
->
field
.
type
==
TSDB_DATA_TYPE_NCHAR
)
{
// convert unicode to native code in a temporary buffer extra one byte for terminated symbol
// convert unicode to native code in a temporary buffer extra one byte for terminated symbol
pRes
->
buffer
[
i
]
=
realloc
(
pRes
->
buffer
[
i
],
pInfo
->
field
.
bytes
*
pRes
->
numOfRows
);
pRes
->
buffer
[
i
]
=
realloc
(
pRes
->
buffer
[
i
],
pInfo
->
field
.
bytes
*
pRes
->
numOfRows
);
...
@@ -642,6 +630,20 @@ void tscSetResRawPtr(SSqlRes* pRes, SQueryInfo* pQueryInfo) {
...
@@ -642,6 +630,20 @@ void tscSetResRawPtr(SSqlRes* pRes, SQueryInfo* pQueryInfo) {
memcpy
(
pRes
->
urow
[
i
],
pRes
->
buffer
[
i
],
pInfo
->
field
.
bytes
*
pRes
->
numOfRows
);
memcpy
(
pRes
->
urow
[
i
],
pRes
->
buffer
[
i
],
pInfo
->
field
.
bytes
*
pRes
->
numOfRows
);
}
}
}
void
tscSetResRawPtr
(
SSqlRes
*
pRes
,
SQueryInfo
*
pQueryInfo
)
{
assert
(
pRes
->
numOfCols
>
0
);
int32_t
offset
=
0
;
for
(
int32_t
i
=
0
;
i
<
pQueryInfo
->
fieldsInfo
.
numOfOutput
;
++
i
)
{
SInternalField
*
pInfo
=
(
SInternalField
*
)
TARRAY_GET_ELEM
(
pQueryInfo
->
fieldsInfo
.
internalField
,
i
);
pRes
->
urow
[
i
]
=
pRes
->
data
+
offset
*
pRes
->
numOfRows
;
pRes
->
length
[
i
]
=
pInfo
->
field
.
bytes
;
offset
+=
pInfo
->
field
.
bytes
;
setResRawPtrImpl
(
pRes
,
pInfo
,
i
,
true
);
}
}
}
}
...
@@ -656,6 +658,8 @@ void tscSetResRawPtrRv(SSqlRes* pRes, SQueryInfo* pQueryInfo, SSDataBlock* pBloc
...
@@ -656,6 +658,8 @@ void tscSetResRawPtrRv(SSqlRes* pRes, SQueryInfo* pQueryInfo, SSDataBlock* pBloc
pRes
->
urow
[
i
]
=
pColData
->
pData
;
pRes
->
urow
[
i
]
=
pColData
->
pData
;
pRes
->
length
[
i
]
=
pInfo
->
field
.
bytes
;
pRes
->
length
[
i
]
=
pInfo
->
field
.
bytes
;
setResRawPtrImpl
(
pRes
,
pInfo
,
i
,
convertNchar
);
/*
// generated the user-defined column result
// generated the user-defined column result
if (pInfo->pExpr->pExpr == NULL && TSDB_COL_IS_UD_COL(pInfo->pExpr->base.colInfo.flag)) {
if (pInfo->pExpr->pExpr == NULL && TSDB_COL_IS_UD_COL(pInfo->pExpr->base.colInfo.flag)) {
if (pInfo->pExpr->base.param[1].nType == TSDB_DATA_TYPE_NULL) {
if (pInfo->pExpr->base.param[1].nType == TSDB_DATA_TYPE_NULL) {
...
@@ -706,7 +710,7 @@ void tscSetResRawPtrRv(SSqlRes* pRes, SQueryInfo* pQueryInfo, SSDataBlock* pBloc
...
@@ -706,7 +710,7 @@ void tscSetResRawPtrRv(SSqlRes* pRes, SQueryInfo* pQueryInfo, SSDataBlock* pBloc
}
}
memcpy(pRes->urow[i], pRes->buffer[i], pInfo->field.bytes * pRes->numOfRows);
memcpy(pRes->urow[i], pRes->buffer[i], pInfo->field.bytes * pRes->numOfRows);
}
}
*/
}
}
}
}
...
@@ -989,6 +993,8 @@ static void destroyDummyInputOperator(void* param, int32_t numOfOutput) {
...
@@ -989,6 +993,8 @@ static void destroyDummyInputOperator(void* param, int32_t numOfOutput) {
pInfo
->
block
=
destroyOutputBuf
(
pInfo
->
block
);
pInfo
->
block
=
destroyOutputBuf
(
pInfo
->
block
);
pInfo
->
pSql
=
NULL
;
pInfo
->
pSql
=
NULL
;
doDestroyFilterInfo
(
pInfo
->
pFilterInfo
,
pInfo
->
numOfFilterCols
);
cleanupResultRowInfo
(
&
pInfo
->
pTableQueryInfo
->
resInfo
);
cleanupResultRowInfo
(
&
pInfo
->
pTableQueryInfo
->
resInfo
);
tfree
(
pInfo
->
pTableQueryInfo
);
tfree
(
pInfo
->
pTableQueryInfo
);
}
}
...
...
src/common/src/tname.c
浏览文件 @
c4f96ffc
...
@@ -256,7 +256,7 @@ int32_t tNameExtractFullName(const SName* name, char* dst) {
...
@@ -256,7 +256,7 @@ int32_t tNameExtractFullName(const SName* name, char* dst) {
return
-
1
;
return
-
1
;
}
}
int32_t
len
=
snprintf
(
dst
,
TSDB_ACCT_ID_LEN
+
1
+
TSDB_DB_NAME_LEN
,
"%s.%s"
,
name
->
acctId
,
name
->
dbname
);
int32_t
len
=
snprintf
(
dst
,
TSDB_ACCT_ID_LEN
+
TSDB_DB_NAME_LEN
,
"%s.%s"
,
name
->
acctId
,
name
->
dbname
);
size_t
tnameLen
=
strlen
(
name
->
tname
);
size_t
tnameLen
=
strlen
(
name
->
tname
);
if
(
tnameLen
>
0
)
{
if
(
tnameLen
>
0
)
{
...
...
src/common/src/tvariant.c
浏览文件 @
c4f96ffc
...
@@ -407,6 +407,7 @@ static int32_t toNchar(tVariant *pVariant, char **pDest, int32_t *pDestSize) {
...
@@ -407,6 +407,7 @@ static int32_t toNchar(tVariant *pVariant, char **pDest, int32_t *pDestSize) {
wchar_t
*
pWStr
=
calloc
(
1
,
(
nLen
+
1
)
*
TSDB_NCHAR_SIZE
);
wchar_t
*
pWStr
=
calloc
(
1
,
(
nLen
+
1
)
*
TSDB_NCHAR_SIZE
);
bool
ret
=
taosMbsToUcs4
(
pDst
,
nLen
,
(
char
*
)
pWStr
,
(
nLen
+
1
)
*
TSDB_NCHAR_SIZE
,
NULL
);
bool
ret
=
taosMbsToUcs4
(
pDst
,
nLen
,
(
char
*
)
pWStr
,
(
nLen
+
1
)
*
TSDB_NCHAR_SIZE
,
NULL
);
if
(
!
ret
)
{
if
(
!
ret
)
{
tfree
(
pWStr
);
return
-
1
;
return
-
1
;
}
}
...
@@ -606,7 +607,7 @@ int32_t tVariantDump(tVariant *pVariant, char *payload, int16_t type, bool inclu
...
@@ -606,7 +607,7 @@ int32_t tVariantDump(tVariant *pVariant, char *payload, int16_t type, bool inclu
}
}
errno
=
0
;
// reset global error code
errno
=
0
;
// reset global error code
int64_t
result
;
int64_t
result
=
0
;
switch
(
type
)
{
switch
(
type
)
{
case
TSDB_DATA_TYPE_BOOL
:
{
case
TSDB_DATA_TYPE_BOOL
:
{
...
@@ -874,7 +875,8 @@ int32_t tVariantTypeSetType(tVariant *pVariant, char type) {
...
@@ -874,7 +875,8 @@ int32_t tVariantTypeSetType(tVariant *pVariant, char type) {
free
(
pVariant
->
pz
);
free
(
pVariant
->
pz
);
pVariant
->
dKey
=
v
;
pVariant
->
dKey
=
v
;
}
else
if
(
pVariant
->
nType
>=
TSDB_DATA_TYPE_BOOL
&&
pVariant
->
nType
<=
TSDB_DATA_TYPE_BIGINT
)
{
}
else
if
(
pVariant
->
nType
>=
TSDB_DATA_TYPE_BOOL
&&
pVariant
->
nType
<=
TSDB_DATA_TYPE_BIGINT
)
{
pVariant
->
dKey
=
(
double
)(
pVariant
->
i64
);
double
tmp
=
(
double
)
pVariant
->
i64
;
pVariant
->
dKey
=
tmp
;
}
}
pVariant
->
nType
=
TSDB_DATA_TYPE_DOUBLE
;
pVariant
->
nType
=
TSDB_DATA_TYPE_DOUBLE
;
...
...
src/mnode/src/mnodeTable.c
浏览文件 @
c4f96ffc
...
@@ -1058,7 +1058,7 @@ static int32_t mnodeProcessCreateSuperTableMsg(SMnodeMsg *pMsg) {
...
@@ -1058,7 +1058,7 @@ static int32_t mnodeProcessCreateSuperTableMsg(SMnodeMsg *pMsg) {
return
TSDB_CODE_MND_TOO_MANY_COLUMNS
;
return
TSDB_CODE_MND_TOO_MANY_COLUMNS
;
}
}
SSTableObj
*
pStable
=
calloc
(
1
,
sizeof
(
SSTableObj
));
SSTableObj
*
pStable
=
calloc
(
1
,
sizeof
(
SSTableObj
));
if
(
pStable
==
NULL
)
{
if
(
pStable
==
NULL
)
{
mError
(
"msg:%p, app:%p table:%s, failed to create, no enough memory"
,
pMsg
,
pMsg
->
rpcMsg
.
ahandle
,
pCreate
->
tableName
);
mError
(
"msg:%p, app:%p table:%s, failed to create, no enough memory"
,
pMsg
,
pMsg
->
rpcMsg
.
ahandle
,
pCreate
->
tableName
);
return
TSDB_CODE_MND_OUT_OF_MEMORY
;
return
TSDB_CODE_MND_OUT_OF_MEMORY
;
...
@@ -1068,8 +1068,10 @@ static int32_t mnodeProcessCreateSuperTableMsg(SMnodeMsg *pMsg) {
...
@@ -1068,8 +1068,10 @@ static int32_t mnodeProcessCreateSuperTableMsg(SMnodeMsg *pMsg) {
pStable
->
info
.
tableId
=
strdup
(
pCreate
->
tableName
);
pStable
->
info
.
tableId
=
strdup
(
pCreate
->
tableName
);
pStable
->
info
.
type
=
TSDB_SUPER_TABLE
;
pStable
->
info
.
type
=
TSDB_SUPER_TABLE
;
pStable
->
createdTime
=
taosGetTimestampMs
();
pStable
->
createdTime
=
taosGetTimestampMs
();
uint64_t
x
=
(
us
&
0x000000FFFFFFFFFF
);
x
=
x
<<
24
;
uint64_t
x
=
(
us
&
((((
uint64_t
)
1
)
<<
40
)
-
1
));
// todo refactor
x
=
x
<<
24
;
pStable
->
uid
=
x
+
((
sdbGetVersion
()
&
((
1ul
<<
16
)
-
1ul
))
<<
8
)
+
(
taosRand
()
&
((
1ul
<<
8
)
-
1ul
));
pStable
->
uid
=
x
+
((
sdbGetVersion
()
&
((
1ul
<<
16
)
-
1ul
))
<<
8
)
+
(
taosRand
()
&
((
1ul
<<
8
)
-
1ul
));
pStable
->
sversion
=
0
;
pStable
->
sversion
=
0
;
pStable
->
tversion
=
0
;
pStable
->
tversion
=
0
;
...
@@ -1079,7 +1081,8 @@ static int32_t mnodeProcessCreateSuperTableMsg(SMnodeMsg *pMsg) {
...
@@ -1079,7 +1081,8 @@ static int32_t mnodeProcessCreateSuperTableMsg(SMnodeMsg *pMsg) {
int32_t
schemaSize
=
numOfCols
*
sizeof
(
SSchema
);
int32_t
schemaSize
=
numOfCols
*
sizeof
(
SSchema
);
pStable
->
schema
=
(
SSchema
*
)
calloc
(
1
,
schemaSize
);
pStable
->
schema
=
(
SSchema
*
)
calloc
(
1
,
schemaSize
);
if
(
pStable
->
schema
==
NULL
)
{
if
(
pStable
->
schema
==
NULL
)
{
free
(
pStable
);
tfree
(
pStable
->
info
.
tableId
);
tfree
(
pStable
);
mError
(
"msg:%p, app:%p table:%s, failed to create, no schema input"
,
pMsg
,
pMsg
->
rpcMsg
.
ahandle
,
pCreate
->
tableName
);
mError
(
"msg:%p, app:%p table:%s, failed to create, no schema input"
,
pMsg
,
pMsg
->
rpcMsg
.
ahandle
,
pCreate
->
tableName
);
return
TSDB_CODE_MND_INVALID_TABLE_NAME
;
return
TSDB_CODE_MND_INVALID_TABLE_NAME
;
}
}
...
@@ -1096,6 +1099,9 @@ static int32_t mnodeProcessCreateSuperTableMsg(SMnodeMsg *pMsg) {
...
@@ -1096,6 +1099,9 @@ static int32_t mnodeProcessCreateSuperTableMsg(SMnodeMsg *pMsg) {
if
(
!
tIsValidSchema
(
pStable
->
schema
,
pStable
->
numOfColumns
,
pStable
->
numOfTags
))
{
if
(
!
tIsValidSchema
(
pStable
->
schema
,
pStable
->
numOfColumns
,
pStable
->
numOfTags
))
{
mError
(
"msg:%p, app:%p table:%s, failed to create table, invalid schema"
,
pMsg
,
pMsg
->
rpcMsg
.
ahandle
,
pCreate
->
tableName
);
mError
(
"msg:%p, app:%p table:%s, failed to create table, invalid schema"
,
pMsg
,
pMsg
->
rpcMsg
.
ahandle
,
pCreate
->
tableName
);
tfree
(
pStable
->
info
.
tableId
);
tfree
(
pStable
->
schema
);
tfree
(
pStable
);
return
TSDB_CODE_MND_INVALID_CREATE_TABLE_MSG
;
return
TSDB_CODE_MND_INVALID_CREATE_TABLE_MSG
;
}
}
...
@@ -2074,9 +2080,11 @@ static int32_t mnodeDoCreateChildTable(SMnodeMsg *pMsg, int32_t tid) {
...
@@ -2074,9 +2080,11 @@ static int32_t mnodeDoCreateChildTable(SMnodeMsg *pMsg, int32_t tid) {
pTable
->
superTable
=
pMsg
->
pSTable
;
pTable
->
superTable
=
pMsg
->
pSTable
;
}
else
{
}
else
{
if
(
pTable
->
info
.
type
==
TSDB_SUPER_TABLE
)
{
if
(
pTable
->
info
.
type
==
TSDB_SUPER_TABLE
)
{
int64_t
us
=
taosGetTimestampUs
();
uint64_t
us
=
(
uint64_t
)
taosGetTimestampUs
();
uint64_t
x
=
(
us
&
0x000000FFFFFFFFFF
);
x
=
x
<<
24
;
uint64_t
x
=
(
us
&
((((
uint64_t
)
1
)
<<
40
)
-
1
));
x
=
x
<<
24
;
pTable
->
uid
=
x
+
((
sdbGetVersion
()
&
((
1ul
<<
16
)
-
1ul
))
<<
8
)
+
(
taosRand
()
&
((
1ul
<<
8
)
-
1ul
));
pTable
->
uid
=
x
+
((
sdbGetVersion
()
&
((
1ul
<<
16
)
-
1ul
))
<<
8
)
+
(
taosRand
()
&
((
1ul
<<
8
)
-
1ul
));
}
else
{
}
else
{
pTable
->
uid
=
(((
uint64_t
)
pTable
->
vgId
)
<<
48
)
+
((((
uint64_t
)
pTable
->
tid
)
&
((
1ul
<<
24
)
-
1ul
))
<<
24
)
+
pTable
->
uid
=
(((
uint64_t
)
pTable
->
vgId
)
<<
48
)
+
((((
uint64_t
)
pTable
->
tid
)
&
((
1ul
<<
24
)
-
1ul
))
<<
24
)
+
...
...
src/query/inc/qExecutor.h
浏览文件 @
c4f96ffc
...
@@ -571,6 +571,7 @@ void doCompactSDataBlock(SSDataBlock* pBlock, int32_t numOfRows, int8_t* p);
...
@@ -571,6 +571,7 @@ void doCompactSDataBlock(SSDataBlock* pBlock, int32_t numOfRows, int8_t* p);
SSDataBlock
*
createOutputBuf
(
SExprInfo
*
pExpr
,
int32_t
numOfOutput
,
int32_t
numOfRows
);
SSDataBlock
*
createOutputBuf
(
SExprInfo
*
pExpr
,
int32_t
numOfOutput
,
int32_t
numOfRows
);
void
*
destroyOutputBuf
(
SSDataBlock
*
pBlock
);
void
*
destroyOutputBuf
(
SSDataBlock
*
pBlock
);
void
*
doDestroyFilterInfo
(
SSingleColumnFilterInfo
*
pFilterInfo
,
int32_t
numOfFilterCols
);
void
setInputDataBlock
(
SOperatorInfo
*
pOperator
,
SQLFunctionCtx
*
pCtx
,
SSDataBlock
*
pBlock
,
int32_t
order
);
void
setInputDataBlock
(
SOperatorInfo
*
pOperator
,
SQLFunctionCtx
*
pCtx
,
SSDataBlock
*
pBlock
,
int32_t
order
);
int32_t
getNumOfResult
(
SQueryRuntimeEnv
*
pRuntimeEnv
,
SQLFunctionCtx
*
pCtx
,
int32_t
numOfOutput
);
int32_t
getNumOfResult
(
SQueryRuntimeEnv
*
pRuntimeEnv
,
SQLFunctionCtx
*
pCtx
,
int32_t
numOfOutput
);
...
...
src/query/src/qExecutor.c
浏览文件 @
c4f96ffc
...
@@ -179,7 +179,6 @@ static STsdbQueryCond createTsdbQueryCond(SQueryAttr* pQueryAttr, STimeWindow* w
...
@@ -179,7 +179,6 @@ static STsdbQueryCond createTsdbQueryCond(SQueryAttr* pQueryAttr, STimeWindow* w
static
STableIdInfo
createTableIdInfo
(
STableQueryInfo
*
pTableQueryInfo
);
static
STableIdInfo
createTableIdInfo
(
STableQueryInfo
*
pTableQueryInfo
);
static
void
setTableScanFilterOperatorInfo
(
STableScanInfo
*
pTableScanInfo
,
SOperatorInfo
*
pDownstream
);
static
void
setTableScanFilterOperatorInfo
(
STableScanInfo
*
pTableScanInfo
,
SOperatorInfo
*
pDownstream
);
static
void
*
doDestroyFilterInfo
(
SSingleColumnFilterInfo
*
pFilterInfo
,
int32_t
numOfFilterCols
);
static
int32_t
getNumOfScanTimes
(
SQueryAttr
*
pQueryAttr
);
static
int32_t
getNumOfScanTimes
(
SQueryAttr
*
pQueryAttr
);
...
@@ -237,37 +236,41 @@ static int compareRowData(const void *a, const void *b, const void *userData) {
...
@@ -237,37 +236,41 @@ static int compareRowData(const void *a, const void *b, const void *userData) {
static
void
sortGroupResByOrderList
(
SGroupResInfo
*
pGroupResInfo
,
SQueryRuntimeEnv
*
pRuntimeEnv
,
SSDataBlock
*
pDataBlock
)
{
static
void
sortGroupResByOrderList
(
SGroupResInfo
*
pGroupResInfo
,
SQueryRuntimeEnv
*
pRuntimeEnv
,
SSDataBlock
*
pDataBlock
)
{
SArray
*
columnOrderList
=
getOrderCheckColumns
(
pRuntimeEnv
->
pQueryAttr
);
SArray
*
columnOrderList
=
getOrderCheckColumns
(
pRuntimeEnv
->
pQueryAttr
);
if
(
taosArrayGetSize
(
columnOrderList
)
<=
0
)
{
size_t
size
=
taosArrayGetSize
(
columnOrderList
);
taosArrayDestroy
(
columnOrderList
);
if
(
size
<=
0
)
{
return
;
return
;
}
}
int32_t
orderId
=
pRuntimeEnv
->
pQueryAttr
->
order
.
orderColId
;
int32_t
orderId
=
pRuntimeEnv
->
pQueryAttr
->
order
.
orderColId
;
if
(
orderId
<=
0
)
{
if
(
orderId
<=
0
)
{
return
;
return
;
}
}
bool
found
=
false
;
bool
found
=
false
;
int16_t
dataOffset
=
0
;
int16_t
dataOffset
=
0
;
//SColIndex *index = taosArrayGet(columnOrderList, 0);
for
(
int32_t
j
=
0
;
j
<
pDataBlock
->
info
.
numOfCols
;
++
j
)
{
for
(
int32_t
j
=
0
;
j
<
pDataBlock
->
info
.
numOfCols
;
++
j
)
{
SColumnInfoData
*
pColInfoData
=
(
SColumnInfoData
*
)
taosArrayGet
(
pDataBlock
->
pDataBlock
,
j
);
SColumnInfoData
*
pColInfoData
=
(
SColumnInfoData
*
)
taosArrayGet
(
pDataBlock
->
pDataBlock
,
j
);
if
(
orderId
==
j
)
{
if
(
orderId
==
j
)
{
found
=
true
;
found
=
true
;
break
;
break
;
}
}
dataOffset
+=
pColInfoData
->
info
.
bytes
;
dataOffset
+=
pColInfoData
->
info
.
bytes
;
}
}
if
(
found
==
false
)
{
if
(
found
==
false
)
{
return
;
return
;
}
}
int16_t
type
=
pRuntimeEnv
->
pQueryAttr
->
pExpr1
[
orderId
].
base
.
resType
;
int16_t
type
=
pRuntimeEnv
->
pQueryAttr
->
pExpr1
[
orderId
].
base
.
resType
;
SRowCompSupporter
support
=
{.
pRuntimeEnv
=
pRuntimeEnv
,
.
dataOffset
=
dataOffset
,
.
comFunc
=
getComparFunc
(
type
,
0
)};
SRowCompSupporter
support
=
{.
pRuntimeEnv
=
pRuntimeEnv
,
.
dataOffset
=
dataOffset
,
.
comFunc
=
getComparFunc
(
type
,
0
)};
taosArraySortPWithExt
(
pGroupResInfo
->
pRows
,
compareRowData
,
&
support
);
taosArraySortPWithExt
(
pGroupResInfo
->
pRows
,
compareRowData
,
&
support
);
return
;
}
}
//setup the output buffer for each operator
//setup the output buffer for each operator
SSDataBlock
*
createOutputBuf
(
SExprInfo
*
pExpr
,
int32_t
numOfOutput
,
int32_t
numOfRows
)
{
SSDataBlock
*
createOutputBuf
(
SExprInfo
*
pExpr
,
int32_t
numOfOutput
,
int32_t
numOfRows
)
{
const
static
int32_t
minSize
=
8
;
const
static
int32_t
minSize
=
8
;
...
@@ -1798,8 +1801,10 @@ static int32_t setupQueryRuntimeEnv(SQueryRuntimeEnv *pRuntimeEnv, int32_t numOf
...
@@ -1798,8 +1801,10 @@ static int32_t setupQueryRuntimeEnv(SQueryRuntimeEnv *pRuntimeEnv, int32_t numOf
pRuntimeEnv
->
prevRow
[
i
]
=
pRuntimeEnv
->
prevRow
[
i
-
1
]
+
pQueryAttr
->
tableCols
[
i
-
1
].
bytes
;
pRuntimeEnv
->
prevRow
[
i
]
=
pRuntimeEnv
->
prevRow
[
i
-
1
]
+
pQueryAttr
->
tableCols
[
i
-
1
].
bytes
;
}
}
if
(
pQueryAttr
->
tableCols
[
0
].
type
==
TSDB_DATA_TYPE_TIMESTAMP
)
{
*
(
int64_t
*
)
pRuntimeEnv
->
prevRow
[
0
]
=
INT64_MIN
;
*
(
int64_t
*
)
pRuntimeEnv
->
prevRow
[
0
]
=
INT64_MIN
;
}
}
}
qDebug
(
"QInfo:0x%"
PRIx64
" init runtime environment completed"
,
GET_QID
(
pRuntimeEnv
));
qDebug
(
"QInfo:0x%"
PRIx64
" init runtime environment completed"
,
GET_QID
(
pRuntimeEnv
));
...
@@ -1832,7 +1837,11 @@ static int32_t setupQueryRuntimeEnv(SQueryRuntimeEnv *pRuntimeEnv, int32_t numOf
...
@@ -1832,7 +1837,11 @@ static int32_t setupQueryRuntimeEnv(SQueryRuntimeEnv *pRuntimeEnv, int32_t numOf
case
OP_Groupby
:
{
case
OP_Groupby
:
{
pRuntimeEnv
->
proot
=
pRuntimeEnv
->
proot
=
createGroupbyOperatorInfo
(
pRuntimeEnv
,
pRuntimeEnv
->
proot
,
pQueryAttr
->
pExpr1
,
pQueryAttr
->
numOfOutput
);
createGroupbyOperatorInfo
(
pRuntimeEnv
,
pRuntimeEnv
->
proot
,
pQueryAttr
->
pExpr1
,
pQueryAttr
->
numOfOutput
);
int32_t
opType
=
pRuntimeEnv
->
proot
->
upstream
[
0
]
->
operatorType
;
if
(
opType
!=
OP_DummyInput
)
{
setTableScanFilterOperatorInfo
(
pRuntimeEnv
->
proot
->
upstream
[
0
]
->
info
,
pRuntimeEnv
->
proot
);
setTableScanFilterOperatorInfo
(
pRuntimeEnv
->
proot
->
upstream
[
0
]
->
info
,
pRuntimeEnv
->
proot
);
}
break
;
break
;
}
}
case
OP_SessionWindow
:
{
case
OP_SessionWindow
:
{
...
@@ -2683,10 +2692,6 @@ static uint32_t doFilterByBlockTimeWindow(STableScanInfo* pTableScanInfo, SSData
...
@@ -2683,10 +2692,6 @@ static uint32_t doFilterByBlockTimeWindow(STableScanInfo* pTableScanInfo, SSData
}
}
void
doSetFilterColumnInfo
(
SSingleColumnFilterInfo
*
pFilterInfo
,
int32_t
numOfFilterCols
,
SSDataBlock
*
pBlock
)
{
void
doSetFilterColumnInfo
(
SSingleColumnFilterInfo
*
pFilterInfo
,
int32_t
numOfFilterCols
,
SSDataBlock
*
pBlock
)
{
if
(
numOfFilterCols
>
0
&&
pFilterInfo
[
0
].
pData
!=
NULL
)
{
return
;
}
// set the initial static data value filter expression
// set the initial static data value filter expression
for
(
int32_t
i
=
0
;
i
<
numOfFilterCols
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
numOfFilterCols
;
++
i
)
{
for
(
int32_t
j
=
0
;
j
<
pBlock
->
info
.
numOfCols
;
++
j
)
{
for
(
int32_t
j
=
0
;
j
<
pBlock
->
info
.
numOfCols
;
++
j
)
{
...
...
src/tsdb/src/tsdbRead.c
浏览文件 @
c4f96ffc
...
@@ -364,7 +364,7 @@ static int64_t getEarliestValidTimestamp(STsdbRepo* pTsdb) {
...
@@ -364,7 +364,7 @@ static int64_t getEarliestValidTimestamp(STsdbRepo* pTsdb) {
STsdbCfg
*
pCfg
=
&
pTsdb
->
config
;
STsdbCfg
*
pCfg
=
&
pTsdb
->
config
;
int64_t
now
=
taosGetTimestamp
(
pCfg
->
precision
);
int64_t
now
=
taosGetTimestamp
(
pCfg
->
precision
);
return
now
-
(
tsTickPerDay
[
pCfg
->
precision
]
*
pCfg
->
keep
)
;
return
now
-
(
tsTickPerDay
[
pCfg
->
precision
]
*
pCfg
->
keep
)
+
1
;
// needs to add one tick
}
}
static
void
setQueryTimewindow
(
STsdbQueryHandle
*
pQueryHandle
,
STsdbQueryCond
*
pCond
)
{
static
void
setQueryTimewindow
(
STsdbQueryHandle
*
pQueryHandle
,
STsdbQueryCond
*
pCond
)
{
...
@@ -488,6 +488,7 @@ TsdbQueryHandleT* tsdbQueryTables(STsdbRepo* tsdb, STsdbQueryCond* pCond, STable
...
@@ -488,6 +488,7 @@ TsdbQueryHandleT* tsdbQueryTables(STsdbRepo* tsdb, STsdbQueryCond* pCond, STable
pQueryHandle
->
pTableCheckInfo
=
createCheckInfoFromTableGroup
(
pQueryHandle
,
groupList
,
pMeta
,
&
psTable
);
pQueryHandle
->
pTableCheckInfo
=
createCheckInfoFromTableGroup
(
pQueryHandle
,
groupList
,
pMeta
,
&
psTable
);
if
(
pQueryHandle
->
pTableCheckInfo
==
NULL
)
{
if
(
pQueryHandle
->
pTableCheckInfo
==
NULL
)
{
tsdbCleanupQueryHandle
(
pQueryHandle
);
tsdbCleanupQueryHandle
(
pQueryHandle
);
taosArrayDestroy
(
psTable
);
terrno
=
TSDB_CODE_TDB_OUT_OF_MEMORY
;
terrno
=
TSDB_CODE_TDB_OUT_OF_MEMORY
;
return
NULL
;
return
NULL
;
}
}
...
@@ -575,8 +576,6 @@ void tsdbResetQueryHandleForNewTable(TsdbQueryHandleT queryHandle, STsdbQueryCon
...
@@ -575,8 +576,6 @@ void tsdbResetQueryHandleForNewTable(TsdbQueryHandleT queryHandle, STsdbQueryCon
pQueryHandle
->
next
=
doFreeColumnInfoData
(
pQueryHandle
->
next
);
pQueryHandle
->
next
=
doFreeColumnInfoData
(
pQueryHandle
->
next
);
}
}
TsdbQueryHandleT
tsdbQueryLastRow
(
STsdbRepo
*
tsdb
,
STsdbQueryCond
*
pCond
,
STableGroupInfo
*
groupList
,
uint64_t
qId
,
SMemRef
*
pMemRef
)
{
TsdbQueryHandleT
tsdbQueryLastRow
(
STsdbRepo
*
tsdb
,
STsdbQueryCond
*
pCond
,
STableGroupInfo
*
groupList
,
uint64_t
qId
,
SMemRef
*
pMemRef
)
{
pCond
->
twindow
=
updateLastrowForEachGroup
(
groupList
);
pCond
->
twindow
=
updateLastrowForEachGroup
(
groupList
);
...
@@ -2874,6 +2873,7 @@ static int32_t doGetExternalRow(STsdbQueryHandle* pQueryHandle, int16_t type, SM
...
@@ -2874,6 +2873,7 @@ static int32_t doGetExternalRow(STsdbQueryHandle* pQueryHandle, int16_t type, SM
SArray
*
psTable
=
NULL
;
SArray
*
psTable
=
NULL
;
pSecQueryHandle
->
pTableCheckInfo
=
createCheckInfoFromCheckInfo
(
pCurrent
,
pSecQueryHandle
->
window
.
skey
,
&
psTable
);
pSecQueryHandle
->
pTableCheckInfo
=
createCheckInfoFromCheckInfo
(
pCurrent
,
pSecQueryHandle
->
window
.
skey
,
&
psTable
);
if
(
pSecQueryHandle
->
pTableCheckInfo
==
NULL
)
{
if
(
pSecQueryHandle
->
pTableCheckInfo
==
NULL
)
{
taosArrayDestroy
(
psTable
);
terrno
=
TSDB_CODE_QRY_OUT_OF_MEMORY
;
terrno
=
TSDB_CODE_QRY_OUT_OF_MEMORY
;
goto
out_of_memory
;
goto
out_of_memory
;
}
}
...
...
tests/script/general/parser/nestquery.sim
浏览文件 @
c4f96ffc
...
@@ -426,4 +426,28 @@ endi
...
@@ -426,4 +426,28 @@ endi
sql_error select last_row(*) from (select * from nest_tb0) having c1 > 0
sql_error select last_row(*) from (select * from nest_tb0) having c1 > 0
print ===========>td-4805
sql_error select tbname, i from (select * from nest_tb0) group by i;
sql select count(*),c1 from (select * from nest_tb0) where c1 < 2 group by c1;
if $rows != 2 then
return -1
endi
if $data00 != 100 then
return -1
endi
if $data01 != 0 then
return -1
endi
if $data10 != 100 then
return -1
endi
if $data11 != 1 then
return -1
endi
system sh/exec.sh -n dnode1 -s stop -x SIGINT
system sh/exec.sh -n dnode1 -s stop -x SIGINT
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录