Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
b7f8ee37
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
b7f8ee37
编写于
11月 15, 2021
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[td-10564] Refactor.
上级
52f952f9
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
13 addition
and
13 deletion
+13
-13
source/libs/parser/src/astValidate.c
source/libs/parser/src/astValidate.c
+9
-9
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+4
-4
未找到文件。
source/libs/parser/src/astValidate.c
浏览文件 @
b7f8ee37
...
...
@@ -2652,19 +2652,19 @@ static int32_t validateScalarFunctionParamNum(tSqlExpr* pSqlExpr, int32_t functi
return
code
;
}
int32_t
doAddProjectCol
(
SQueryStmtInfo
*
pQueryInfo
,
int32_t
outputColIndex
,
SSchema
*
pSchema
,
const
char
*
aliasName
,
int32_t
doAdd
One
ProjectCol
(
SQueryStmtInfo
*
pQueryInfo
,
int32_t
outputColIndex
,
SSchema
*
pSchema
,
const
char
*
aliasName
,
int32_t
colId
,
SMsgBuf
*
pMsgBuf
)
{
const
char
*
name
=
(
aliasName
==
NULL
)
?
pSchema
->
name
:
aliasName
;
SSchema
s
=
createSchema
(
pSchema
->
type
,
pSchema
->
bytes
,
colId
,
name
);
tExprNode
*
pNode
=
NULL
;
bool
keepTableCols
=
true
;
SArray
*
pColumnList
=
taosArrayInit
(
4
,
sizeof
(
SColumn
));
SToken
colNameToken
=
{.
z
=
pSchema
->
name
,
.
n
=
strlen
(
pSchema
->
name
)};
tSqlExpr
sqlNode
=
{
0
};
sqlNode
.
type
=
SQL_NODE_TABLE_COLUMN
;
SToken
colNameToken
=
{.
z
=
pSchema
->
name
,
.
n
=
strlen
(
pSchema
->
name
)};
sqlNode
.
columnName
=
colNameToken
;
int32_t
ret
=
sqlExprToExprNode
(
&
pNode
,
&
sqlNode
,
pQueryInfo
,
pColumnList
,
&
keepTableCols
,
pMsgBuf
);
...
...
@@ -2692,7 +2692,7 @@ int32_t doAddProjectCol(SQueryStmtInfo* pQueryInfo, int32_t outputColIndex, SSch
return
TSDB_CODE_SUCCESS
;
}
static
int32_t
doAdd
ProjectionExprAndResColumn
(
SQueryStmtInfo
*
pQueryInfo
,
SColumnIndex
*
pIndex
,
int32_t
startPos
,
SMsgBuf
*
pMsgBuf
)
{
static
int32_t
doAdd
MultipleProjectExprAndResColumns
(
SQueryStmtInfo
*
pQueryInfo
,
SColumnIndex
*
pIndex
,
int32_t
startPos
,
SMsgBuf
*
pMsgBuf
)
{
STableMetaInfo
*
pTableMetaInfo
=
getMetaInfo
(
pQueryInfo
,
pIndex
->
tableIndex
);
STableMeta
*
pTableMeta
=
pTableMetaInfo
->
pTableMeta
;
...
...
@@ -2705,7 +2705,7 @@ static int32_t doAddProjectionExprAndResColumn(SQueryStmtInfo* pQueryInfo, SColu
for
(
int32_t
j
=
0
;
j
<
numOfTotalColumns
;
++
j
)
{
SSchema
*
pSchema
=
getOneColumnSchema
(
pTableMetaInfo
->
pTableMeta
,
j
);
doAddProjectCol
(
pQueryInfo
,
startPos
+
j
,
pSchema
,
NULL
,
getNewResColId
(),
pMsgBuf
);
doAdd
One
ProjectCol
(
pQueryInfo
,
startPos
+
j
,
pSchema
,
NULL
,
getNewResColId
(),
pMsgBuf
);
}
return
numOfTotalColumns
;
...
...
@@ -2771,7 +2771,7 @@ static int32_t handleTbnameProjection(SQueryStmtInfo* pQueryInfo, tSqlExprItem*
colSchema
=
*
getTbnameColumnSchema
();
}
return
doAddProjectCol
(
pQueryInfo
,
startPos
,
&
colSchema
,
pItem
->
aliasName
,
getNewResColId
(),
pMsgBuf
);
return
doAdd
One
ProjectCol
(
pQueryInfo
,
startPos
,
&
colSchema
,
pItem
->
aliasName
,
getNewResColId
(),
pMsgBuf
);
}
int32_t
addProjectionExprAndResColumn
(
SQueryStmtInfo
*
pQueryInfo
,
tSqlExprItem
*
pItem
,
bool
outerQuery
,
SMsgBuf
*
pMsgBuf
)
{
...
...
@@ -2796,11 +2796,11 @@ int32_t addProjectionExprAndResColumn(SQueryStmtInfo* pQueryInfo, tSqlExprItem*
if
(
index
.
tableIndex
==
COLUMN_INDEX_INITIAL_VAL
)
{
// all table columns are required.
for
(
int32_t
i
=
0
;
i
<
pQueryInfo
->
numOfTables
;
++
i
)
{
index
.
tableIndex
=
i
;
int32_t
inc
=
doAdd
ProjectionExprAndResColumn
(
pQueryInfo
,
&
index
,
startPos
,
pMsgBuf
);
int32_t
inc
=
doAdd
MultipleProjectExprAndResColumns
(
pQueryInfo
,
&
index
,
startPos
,
pMsgBuf
);
startPos
+=
inc
;
}
}
else
{
doAdd
ProjectionExprAndResColumn
(
pQueryInfo
,
&
index
,
startPos
,
pMsgBuf
);
doAdd
MultipleProjectExprAndResColumns
(
pQueryInfo
,
&
index
,
startPos
,
pMsgBuf
);
}
// add the primary timestamp column even though it is not required by user
...
...
@@ -2840,7 +2840,7 @@ int32_t addProjectionExprAndResColumn(SQueryStmtInfo* pQueryInfo, tSqlExprItem*
}
SSchema
*
pSchema
=
getOneColumnSchema
(
pTableMetaInfo
->
pTableMeta
,
index
.
columnIndex
);
doAddProjectCol
(
pQueryInfo
,
startPos
,
pSchema
,
pItem
->
aliasName
,
getNewResColId
(),
pMsgBuf
);
doAdd
One
ProjectCol
(
pQueryInfo
,
startPos
,
pSchema
,
pItem
->
aliasName
,
getNewResColId
(),
pMsgBuf
);
}
// add the primary timestamp column even though it is not required by user
...
...
src/client/src/tscSQLParser.c
浏览文件 @
b7f8ee37
...
...
@@ -63,7 +63,7 @@ typedef struct SConvertFunc {
int32_t
execFuncId
;
}
SConvertFunc
;
static
SExprInfo
*
doAddProjectCol
(
SQueryInfo
*
pQueryInfo
,
int32_t
colIndex
,
int32_t
tableIndex
,
int32_t
colId
);
static
SExprInfo
*
doAdd
One
ProjectCol
(
SQueryInfo
*
pQueryInfo
,
int32_t
colIndex
,
int32_t
tableIndex
,
int32_t
colId
);
static
int32_t
setShowInfo
(
SSqlObj
*
pSql
,
SSqlInfo
*
pInfo
);
static
char
*
getAccountId
(
SSqlObj
*
pSql
);
...
...
@@ -1890,7 +1890,7 @@ static int32_t handleArithmeticExpr(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32
}
static
void
addProjectQueryCol
(
SQueryInfo
*
pQueryInfo
,
int32_t
startPos
,
SColumnIndex
*
pIndex
,
tSqlExprItem
*
pItem
,
int32_t
colId
)
{
SExprInfo
*
pExpr
=
doAddProjectCol
(
pQueryInfo
,
pIndex
->
columnIndex
,
pIndex
->
tableIndex
,
colId
);
SExprInfo
*
pExpr
=
doAdd
One
ProjectCol
(
pQueryInfo
,
pIndex
->
columnIndex
,
pIndex
->
tableIndex
,
colId
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMetaInfo
(
pQueryInfo
,
pIndex
->
tableIndex
);
STableMeta
*
pTableMeta
=
pTableMetaInfo
->
pTableMeta
;
...
...
@@ -2157,7 +2157,7 @@ int32_t insertResultField(SQueryInfo* pQueryInfo, int32_t outputIndex, SColumnLi
return
TSDB_CODE_SUCCESS
;
}
SExprInfo
*
doAddProjectCol
(
SQueryInfo
*
pQueryInfo
,
int32_t
colIndex
,
int32_t
tableIndex
,
int32_t
colId
)
{
SExprInfo
*
doAdd
One
ProjectCol
(
SQueryInfo
*
pQueryInfo
,
int32_t
colIndex
,
int32_t
tableIndex
,
int32_t
colId
)
{
STableMetaInfo
*
pTableMetaInfo
=
tscGetMetaInfo
(
pQueryInfo
,
tableIndex
);
STableMeta
*
pTableMeta
=
pTableMetaInfo
->
pTableMeta
;
int32_t
numOfCols
=
tscGetNumOfColumns
(
pTableMeta
);
...
...
@@ -2218,7 +2218,7 @@ static int32_t doAddProjectionExprAndResultFields(SQueryInfo* pQueryInfo, SColum
}
for
(
int32_t
j
=
0
;
j
<
numOfTotalColumns
;
++
j
)
{
SExprInfo
*
pExpr
=
doAddProjectCol
(
pQueryInfo
,
j
,
pIndex
->
tableIndex
,
getNewResColId
(
pCmd
));
SExprInfo
*
pExpr
=
doAdd
One
ProjectCol
(
pQueryInfo
,
j
,
pIndex
->
tableIndex
,
getNewResColId
(
pCmd
));
tstrncpy
(
pExpr
->
base
.
aliasName
,
pSchema
[
j
].
name
,
sizeof
(
pExpr
->
base
.
aliasName
));
pIndex
->
columnIndex
=
j
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录