Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小楼昨夜-听风雨
TDengine
提交
e7cad3db
T
TDengine
项目概览
小楼昨夜-听风雨
/
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
e7cad3db
编写于
7月 07, 2021
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[td-225]refactor.
上级
14927e45
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
29 addition
and
36 deletion
+29
-36
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+26
-29
src/query/inc/qSqlparser.h
src/query/inc/qSqlparser.h
+1
-5
src/query/src/qSqlParser.c
src/query/src/qSqlParser.c
+2
-2
未找到文件。
src/client/src/tscSQLParser.c
浏览文件 @
e7cad3db
...
...
@@ -1994,7 +1994,7 @@ int32_t addProjectionExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, t
TSDB_QUERY_SET_TYPE
(
pQueryInfo
->
type
,
TSDB_QUERY_TYPE_PROJECTION_QUERY
);
SColumnIndex
index
=
COLUMN_INDEX_INITIALIZER
;
if
(
getTableIndexByName
(
&
pItem
->
pNode
->
ColumnName
.
n
ame
,
pQueryInfo
,
&
index
)
!=
TSDB_CODE_SUCCESS
)
{
if
(
getTableIndexByName
(
&
pItem
->
pNode
->
columnN
ame
,
pQueryInfo
,
&
index
)
!=
TSDB_CODE_SUCCESS
)
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg2
);
}
...
...
@@ -2031,7 +2031,7 @@ int32_t addProjectionExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, t
}
else
if
(
optr
==
TK_ID
)
{
SColumnIndex
index
=
COLUMN_INDEX_INITIALIZER
;
if
(
getColumnIndexByName
(
&
pItem
->
pNode
->
ColumnName
.
n
ame
,
pQueryInfo
,
&
index
,
tscGetErrorMsgPayload
(
pCmd
))
!=
TSDB_CODE_SUCCESS
)
{
if
(
getColumnIndexByName
(
&
pItem
->
pNode
->
columnN
ame
,
pQueryInfo
,
&
index
,
tscGetErrorMsgPayload
(
pCmd
))
!=
TSDB_CODE_SUCCESS
)
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg2
);
}
...
...
@@ -2195,7 +2195,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
if
(
pItem
->
pNode
->
Expr
.
paramList
!=
NULL
)
{
tSqlExprItem
*
pParamElem
=
taosArrayGet
(
pItem
->
pNode
->
Expr
.
paramList
,
0
);
SStrToken
*
pToken
=
&
pParamElem
->
pNode
->
ColumnName
.
n
ame
;
SStrToken
*
pToken
=
&
pParamElem
->
pNode
->
columnN
ame
;
int16_t
tokenId
=
pParamElem
->
pNode
->
tokenId
;
if
((
pToken
->
z
==
NULL
||
pToken
->
n
==
0
)
&&
(
TK_INTEGER
!=
tokenId
))
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg3
);
...
...
@@ -2204,7 +2204,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
// select count(table.*), select count(1), count(2)
if
(
tokenId
==
TK_ALL
||
tokenId
==
TK_INTEGER
)
{
// check if the table name is valid or not
SStrToken
tmpToken
=
pParamElem
->
pNode
->
ColumnName
.
n
ame
;
SStrToken
tmpToken
=
pParamElem
->
pNode
->
columnN
ame
;
if
(
getTableIndexByName
(
&
tmpToken
,
pQueryInfo
,
&
index
)
!=
TSDB_CODE_SUCCESS
)
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg4
);
...
...
@@ -2259,7 +2259,6 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
tscInsertPrimaryTsSourceColumn
(
pQueryInfo
,
pTableMetaInfo
->
pTableMeta
->
id
.
uid
);
}
pItem
->
pNode
->
ColumnName
.
stdName
.
z
=
strndup
(
pExpr
->
base
.
colInfo
.
name
,
tListLen
(
pExpr
->
base
.
colInfo
.
name
));
return
TSDB_CODE_SUCCESS
;
}
...
...
@@ -2290,7 +2289,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
}
SColumnIndex
index
=
COLUMN_INDEX_INITIALIZER
;
if
((
getColumnIndexByName
(
&
pParamElem
->
pNode
->
ColumnName
.
n
ame
,
pQueryInfo
,
&
index
,
tscGetErrorMsgPayload
(
pCmd
))
!=
TSDB_CODE_SUCCESS
))
{
if
((
getColumnIndexByName
(
&
pParamElem
->
pNode
->
columnN
ame
,
pQueryInfo
,
&
index
,
tscGetErrorMsgPayload
(
pCmd
))
!=
TSDB_CODE_SUCCESS
))
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg3
);
}
...
...
@@ -2398,7 +2397,6 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
}
tscInsertPrimaryTsSourceColumn
(
pQueryInfo
,
pExpr
->
base
.
uid
);
pItem
->
pNode
->
ColumnName
.
stdName
.
z
=
strndup
(
pExpr
->
base
.
colInfo
.
name
,
tListLen
(
pExpr
->
base
.
colInfo
.
name
));
return
TSDB_CODE_SUCCESS
;
}
...
...
@@ -2436,7 +2434,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
SColumnIndex
index
=
COLUMN_INDEX_INITIALIZER
;
if
(
pParamElem
->
pNode
->
tokenId
==
TK_ALL
)
{
// select table.*
SStrToken
tmpToken
=
pParamElem
->
pNode
->
ColumnName
.
n
ame
;
SStrToken
tmpToken
=
pParamElem
->
pNode
->
columnN
ame
;
if
(
getTableIndexByName
(
&
tmpToken
,
pQueryInfo
,
&
index
)
!=
TSDB_CODE_SUCCESS
)
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg4
);
...
...
@@ -2457,7 +2455,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
}
}
else
{
if
(
getColumnIndexByName
(
&
pParamElem
->
pNode
->
ColumnName
.
n
ame
,
pQueryInfo
,
&
index
,
tscGetErrorMsgPayload
(
pCmd
))
!=
TSDB_CODE_SUCCESS
)
{
if
(
getColumnIndexByName
(
&
pParamElem
->
pNode
->
columnN
ame
,
pQueryInfo
,
&
index
,
tscGetErrorMsgPayload
(
pCmd
))
!=
TSDB_CODE_SUCCESS
)
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg3
);
}
...
...
@@ -2472,7 +2470,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
SSchema
*
pSchema
=
tscGetTableColumnSchema
(
pTableMetaInfo
->
pTableMeta
,
index
.
columnIndex
);
bool
multiColOutput
=
taosArrayGetSize
(
pItem
->
pNode
->
Expr
.
paramList
)
>
1
;
setResultColName
(
name
,
pItem
,
cvtFunc
.
originFuncId
,
&
pParamElem
->
pNode
->
ColumnName
.
n
ame
,
multiColOutput
);
setResultColName
(
name
,
pItem
,
cvtFunc
.
originFuncId
,
&
pParamElem
->
pNode
->
columnN
ame
,
multiColOutput
);
if
(
setExprInfoForFunctions
(
pCmd
,
pQueryInfo
,
pSchema
,
cvtFunc
,
name
,
colIndex
++
,
&
index
,
finalResult
)
!=
0
)
{
return
TSDB_CODE_TSC_INVALID_OPERATION
;
...
...
@@ -2527,7 +2525,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
}
SColumnIndex
index
=
COLUMN_INDEX_INITIALIZER
;
if
(
getColumnIndexByName
(
&
pParamElem
->
pNode
->
ColumnName
.
n
ame
,
pQueryInfo
,
&
index
,
tscGetErrorMsgPayload
(
pCmd
))
!=
TSDB_CODE_SUCCESS
)
{
if
(
getColumnIndexByName
(
&
pParamElem
->
pNode
->
columnN
ame
,
pQueryInfo
,
&
index
,
tscGetErrorMsgPayload
(
pCmd
))
!=
TSDB_CODE_SUCCESS
)
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg3
);
}
...
...
@@ -2621,7 +2619,6 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
tscColumnListInsert
(
pQueryInfo
->
colList
,
ids
.
ids
[
0
].
columnIndex
,
pExpr
->
base
.
uid
,
pSchema
);
}
pItem
->
pNode
->
ColumnName
.
stdName
.
z
=
strndup
(
pExpr
->
base
.
colInfo
.
name
,
tListLen
(
pExpr
->
base
.
colInfo
.
name
));
return
TSDB_CODE_SUCCESS
;
}
...
...
@@ -2640,7 +2637,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
tSqlExpr
*
pParam
=
pParamItem
->
pNode
;
SColumnIndex
index
=
COLUMN_INDEX_INITIALIZER
;
if
(
getColumnIndexByName
(
&
pParam
->
ColumnName
.
n
ame
,
pQueryInfo
,
&
index
,
tscGetErrorMsgPayload
(
pCmd
))
!=
TSDB_CODE_SUCCESS
)
{
if
(
getColumnIndexByName
(
&
pParam
->
columnN
ame
,
pQueryInfo
,
&
index
,
tscGetErrorMsgPayload
(
pCmd
))
!=
TSDB_CODE_SUCCESS
)
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg3
);
}
...
...
@@ -3586,7 +3583,7 @@ static int32_t getTablenameCond(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, tSqlExpr*
tSqlExpr
*
pLeft
=
pTableCond
->
pLeft
;
tSqlExpr
*
pRight
=
pTableCond
->
pRight
;
if
(
!
isTablenameToken
(
&
pLeft
->
ColumnName
.
n
ame
))
{
if
(
!
isTablenameToken
(
&
pLeft
->
columnN
ame
))
{
return
TSDB_CODE_TSC_INVALID_OPERATION
;
}
...
...
@@ -3623,7 +3620,7 @@ static int32_t getColumnQueryCondInfo(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, tSq
return
getColumnQueryCondInfo
(
pCmd
,
pQueryInfo
,
pExpr
->
pRight
,
pExpr
->
tokenId
);
}
else
{
// handle leaf node
SColumnIndex
index
=
COLUMN_INDEX_INITIALIZER
;
if
(
getColumnIndexByName
(
&
pExpr
->
pLeft
->
ColumnName
.
n
ame
,
pQueryInfo
,
&
index
,
tscGetErrorMsgPayload
(
pCmd
))
!=
TSDB_CODE_SUCCESS
)
{
if
(
getColumnIndexByName
(
&
pExpr
->
pLeft
->
columnN
ame
,
pQueryInfo
,
&
index
,
tscGetErrorMsgPayload
(
pCmd
))
!=
TSDB_CODE_SUCCESS
)
{
return
TSDB_CODE_TSC_INVALID_OPERATION
;
}
...
...
@@ -3652,7 +3649,7 @@ static int32_t checkAndSetJoinCondInfo(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, tS
}
SColumnIndex
index
=
COLUMN_INDEX_INITIALIZER
;
if
(
getColumnIndexByName
(
&
pExpr
->
pLeft
->
ColumnName
.
n
ame
,
pQueryInfo
,
&
index
,
tscGetErrorMsgPayload
(
pCmd
))
!=
TSDB_CODE_SUCCESS
)
{
if
(
getColumnIndexByName
(
&
pExpr
->
pLeft
->
columnN
ame
,
pQueryInfo
,
&
index
,
tscGetErrorMsgPayload
(
pCmd
))
!=
TSDB_CODE_SUCCESS
)
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg4
);
}
...
...
@@ -3685,7 +3682,7 @@ static int32_t checkAndSetJoinCondInfo(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, tS
int16_t
leftIdx
=
index
.
tableIndex
;
index
=
(
SColumnIndex
)
COLUMN_INDEX_INITIALIZER
;
if
(
getColumnIndexByName
(
&
pExpr
->
pRight
->
ColumnName
.
n
ame
,
pQueryInfo
,
&
index
,
tscGetErrorMsgPayload
(
pCmd
))
!=
TSDB_CODE_SUCCESS
)
{
if
(
getColumnIndexByName
(
&
pExpr
->
pRight
->
columnN
ame
,
pQueryInfo
,
&
index
,
tscGetErrorMsgPayload
(
pCmd
))
!=
TSDB_CODE_SUCCESS
)
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg4
);
}
...
...
@@ -3755,7 +3752,7 @@ static int32_t validateSQLExpr(SSqlCmd* pCmd, tSqlExpr* pExpr, SQueryInfo* pQuer
}
SColumnIndex
index
=
COLUMN_INDEX_INITIALIZER
;
if
(
getColumnIndexByName
(
&
pExpr
->
ColumnName
.
n
ame
,
pQueryInfo
,
&
index
,
tscGetErrorMsgPayload
(
pCmd
))
!=
TSDB_CODE_SUCCESS
)
{
if
(
getColumnIndexByName
(
&
pExpr
->
columnN
ame
,
pQueryInfo
,
&
index
,
tscGetErrorMsgPayload
(
pCmd
))
!=
TSDB_CODE_SUCCESS
)
{
return
TSDB_CODE_TSC_INVALID_OPERATION
;
}
...
...
@@ -3951,7 +3948,7 @@ static bool validateJoinExprNode(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, tSqlExpr
SColumnIndex
rightIndex
=
COLUMN_INDEX_INITIALIZER
;
if
(
getColumnIndexByName
(
&
pRight
->
ColumnName
.
n
ame
,
pQueryInfo
,
&
rightIndex
,
tscGetErrorMsgPayload
(
pCmd
))
!=
TSDB_CODE_SUCCESS
)
{
if
(
getColumnIndexByName
(
&
pRight
->
columnN
ame
,
pQueryInfo
,
&
rightIndex
,
tscGetErrorMsgPayload
(
pCmd
))
!=
TSDB_CODE_SUCCESS
)
{
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg1
);
return
false
;
}
...
...
@@ -4037,7 +4034,7 @@ static int32_t validateLikeExpr(tSqlExpr* pExpr, STableMeta* pTableMeta, int32_t
}
SSchema
*
pSchema
=
tscGetTableSchema
(
pTableMeta
);
if
((
!
isTablenameToken
(
&
pLeft
->
ColumnName
.
n
ame
))
&&
!
IS_VAR_DATA_TYPE
(
pSchema
[
index
].
type
))
{
if
((
!
isTablenameToken
(
&
pLeft
->
columnN
ame
))
&&
!
IS_VAR_DATA_TYPE
(
pSchema
[
index
].
type
))
{
return
invalidOperationMsg
(
msgBuf
,
msg2
);
}
}
...
...
@@ -4061,7 +4058,7 @@ static int32_t handleExprInQueryCond(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, tSql
int32_t
ret
=
TSDB_CODE_SUCCESS
;
SColumnIndex
index
=
COLUMN_INDEX_INITIALIZER
;
if
(
getColumnIndexByName
(
&
pLeft
->
ColumnName
.
n
ame
,
pQueryInfo
,
&
index
,
tscGetErrorMsgPayload
(
pCmd
))
!=
TSDB_CODE_SUCCESS
)
{
if
(
getColumnIndexByName
(
&
pLeft
->
columnN
ame
,
pQueryInfo
,
&
index
,
tscGetErrorMsgPayload
(
pCmd
))
!=
TSDB_CODE_SUCCESS
)
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg2
);
}
...
...
@@ -4104,7 +4101,7 @@ static int32_t handleExprInQueryCond(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, tSql
int16_t
leftIdx
=
index
.
tableIndex
;
if
(
getColumnIndexByName
(
&
pRight
->
ColumnName
.
n
ame
,
pQueryInfo
,
&
index
,
tscGetErrorMsgPayload
(
pCmd
))
!=
TSDB_CODE_SUCCESS
)
{
if
(
getColumnIndexByName
(
&
pRight
->
columnN
ame
,
pQueryInfo
,
&
index
,
tscGetErrorMsgPayload
(
pCmd
))
!=
TSDB_CODE_SUCCESS
)
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg2
);
}
...
...
@@ -4267,7 +4264,7 @@ static void doExtractExprForSTable(SSqlCmd* pCmd, tSqlExpr** pExpr, SQueryInfo*
tSqlExpr
*
pLeft
=
(
*
pExpr
)
->
pLeft
;
SColumnIndex
index
=
COLUMN_INDEX_INITIALIZER
;
if
(
getColumnIndexByName
(
&
pLeft
->
ColumnName
.
n
ame
,
pQueryInfo
,
&
index
,
tscGetErrorMsgPayload
(
pCmd
))
!=
TSDB_CODE_SUCCESS
)
{
if
(
getColumnIndexByName
(
&
pLeft
->
columnN
ame
,
pQueryInfo
,
&
index
,
tscGetErrorMsgPayload
(
pCmd
))
!=
TSDB_CODE_SUCCESS
)
{
return
;
}
...
...
@@ -4434,7 +4431,7 @@ static int32_t getTimeRangeFromExpr(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, tSqlE
return
getTimeRangeFromExpr
(
pCmd
,
pQueryInfo
,
pExpr
->
pRight
);
}
else
{
SColumnIndex
index
=
COLUMN_INDEX_INITIALIZER
;
if
(
getColumnIndexByName
(
&
pExpr
->
pLeft
->
ColumnName
.
n
ame
,
pQueryInfo
,
&
index
,
tscGetErrorMsgPayload
(
pCmd
))
!=
TSDB_CODE_SUCCESS
)
{
if
(
getColumnIndexByName
(
&
pExpr
->
pLeft
->
columnN
ame
,
pQueryInfo
,
&
index
,
tscGetErrorMsgPayload
(
pCmd
))
!=
TSDB_CODE_SUCCESS
)
{
return
TSDB_CODE_TSC_INVALID_OPERATION
;
}
...
...
@@ -7254,7 +7251,7 @@ int32_t tscGetExprFilters(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SArray* pSelect
if
(
pSqlExpr
->
Expr
.
paramList
!=
NULL
)
{
pParam
=
taosArrayGet
(
pSqlExpr
->
Expr
.
paramList
,
0
);
SStrToken
*
pToken
=
&
pParam
->
pNode
->
ColumnName
.
n
ame
;
SStrToken
*
pToken
=
&
pParam
->
pNode
->
columnN
ame
;
SColumnIndex
index
=
COLUMN_INDEX_INITIALIZER
;
getColumnIndexByName
(
pToken
,
pQueryInfo
,
&
index
,
tscGetErrorMsgPayload
(
pCmd
));
...
...
@@ -7286,7 +7283,7 @@ int32_t tscGetExprFilters(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SArray* pSelect
// index.tableIndex = 0;
// } else {
// tSqlExprItem* pParamElem = taosArrayGet(pSqlExpr->Expr.paramList, 0);
// SStrToken* pToken = &pParamElem->pNode->
ColumnName.n
ame;
// SStrToken* pToken = &pParamElem->pNode->
columnN
ame;
// getColumnIndexByName(pToken, pQueryInfo, &index, tscGetErrorMsgPayload(pCmd));
// }
//
...
...
@@ -7469,13 +7466,13 @@ int32_t getHavingExpr(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SArray* pSelectNode
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg1
);
}
if
(
pExpr1
->
tokenId
==
TK_ID
&&
(
pExpr1
->
ColumnName
.
name
.
z
==
NULL
&&
pExpr1
->
ColumnName
.
n
ame
.
n
==
0
))
{
if
(
pExpr1
->
tokenId
==
TK_ID
&&
(
pExpr1
->
columnName
.
z
==
NULL
&&
pExpr1
->
columnN
ame
.
n
==
0
))
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg1
);
}
if
(
pExpr1
->
tokenId
==
TK_ID
)
{
SColumnIndex
index
=
COLUMN_INDEX_INITIALIZER
;
if
((
getColumnIndexByName
(
&
pExpr1
->
ColumnName
.
n
ame
,
pQueryInfo
,
&
index
,
tscGetErrorMsgPayload
(
pCmd
))
!=
TSDB_CODE_SUCCESS
))
{
if
((
getColumnIndexByName
(
&
pExpr1
->
columnN
ame
,
pQueryInfo
,
&
index
,
tscGetErrorMsgPayload
(
pCmd
))
!=
TSDB_CODE_SUCCESS
))
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg1
);
}
...
...
@@ -8246,7 +8243,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
SColumnIndex
index
=
COLUMN_INDEX_INITIALIZER
;
int32_t
ret
=
getColumnIndexByName
(
&
pSqlExpr
->
ColumnName
.
n
ame
,
pQueryInfo
,
&
index
,
tscGetErrorMsgPayload
(
pCmd
));
int32_t
ret
=
getColumnIndexByName
(
&
pSqlExpr
->
columnN
ame
,
pQueryInfo
,
&
index
,
tscGetErrorMsgPayload
(
pCmd
));
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
return
ret
;
}
...
...
src/query/inc/qSqlparser.h
浏览文件 @
e7cad3db
...
...
@@ -244,11 +244,7 @@ typedef struct tSqlExpr {
}
Expr
;
uint32_t
functionId
;
// function id, todo remove it
struct
{
SStrToken
name
;
SStrToken
stdName
;
}
ColumnName
;
// SStrToken columnName; // table column info
SStrToken
columnName
;
// table column info
tVariant
value
;
// the use input value
SStrToken
exprToken
;
// original sql expr string
uint32_t
flags
;
// todo remove it
...
...
src/query/src/qSqlParser.c
浏览文件 @
e7cad3db
...
...
@@ -161,7 +161,7 @@ tSqlExpr *tSqlExprCreateIdValue(SStrToken *pToken, int32_t optrType) {
// Here it must be the column name (tk_id) if it is not a number or string.
assert
(
optrType
==
TK_ID
||
optrType
==
TK_ALL
);
if
(
pToken
!=
NULL
)
{
pSqlExpr
->
ColumnName
.
n
ame
=
*
pToken
;
pSqlExpr
->
columnN
ame
=
*
pToken
;
}
pSqlExpr
->
tokenId
=
optrType
;
...
...
@@ -355,7 +355,7 @@ int32_t tSqlExprCompare(tSqlExpr *left, tSqlExpr *right) {
return
1
;
}
if
(
tStrTokenCompare
(
&
left
->
ColumnName
.
name
,
&
right
->
ColumnName
.
n
ame
))
{
if
(
tStrTokenCompare
(
&
left
->
columnName
,
&
right
->
columnN
ame
))
{
return
1
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录