Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
d54ea3c2
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
Star
22015
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
d54ea3c2
编写于
4月 16, 2021
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[td-225]refactor code.
上级
bc39673c
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
31 addition
and
13 deletion
+31
-13
src/client/src/tscLocalMerge.c
src/client/src/tscLocalMerge.c
+0
-1
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+7
-4
src/client/src/tscSubquery.c
src/client/src/tscSubquery.c
+20
-4
src/client/src/tscUtil.c
src/client/src/tscUtil.c
+4
-4
未找到文件。
src/client/src/tscLocalMerge.c
浏览文件 @
d54ea3c2
...
...
@@ -327,7 +327,6 @@ void tscCreateLocalMerger(tExtMemBuffer **pMemBuffer, int32_t numOfBuffer, tOrde
pMerger
->
pCtx
=
(
SQLFunctionCtx
*
)
calloc
(
tscSqlExprNumOfExprs
(
pQueryInfo
),
sizeof
(
SQLFunctionCtx
));
pMerger
->
rowSize
=
pMemBuffer
[
0
]
->
nElemSize
;
// tscRestoreFuncForSTableQuery(pQueryInfo);
tscFieldInfoUpdateOffset
(
pQueryInfo
);
if
(
pMerger
->
rowSize
>
pMemBuffer
[
0
]
->
pageSize
)
{
...
...
src/client/src/tscSQLParser.c
浏览文件 @
d54ea3c2
...
...
@@ -3379,9 +3379,9 @@ static int32_t getColumnQueryCondInfo(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, tSq
static
int32_t
checkAndSetJoinCondInfo
(
SSqlCmd
*
pCmd
,
SQueryInfo
*
pQueryInfo
,
tSqlExpr
*
pExpr
)
{
int32_t
code
=
0
;
const
char
*
msg1
=
"timestamp required for join tables"
;
const
char
*
msg2
=
"only support one join tag for each table"
;
const
char
*
msg3
=
"type of join columns must be identical"
;
const
char
*
msg4
=
"invalid column name in join condition"
;
const
char
*
msg5
=
"only support one join tag for each table"
;
if
(
pExpr
==
NULL
)
{
return
TSDB_CODE_SUCCESS
;
...
...
@@ -3415,11 +3415,14 @@ static int32_t checkAndSetJoinCondInfo(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, tS
(
*
leftNode
)
->
tagColId
=
pTagSchema1
->
colId
;
if
(
UTIL_TABLE_IS_SUPER_TABLE
(
pTableMetaInfo
))
{
STableMeta
*
pTableMeta
=
pTableMetaInfo
->
pTableMeta
;
index
.
columnIndex
=
index
.
columnIndex
-
tscGetNumOfColumns
(
pTableMetaInfo
->
pTableMeta
);
if
(
!
tscColumnExists
(
pTableMetaInfo
->
tagColList
,
index
.
columnIndex
,
pTableMetaInfo
->
pTableMeta
->
id
.
uid
))
{
// tscColumnListInsert(pTableMetaInfo->tagColList, &index, );
tscColumnListInsert
(
pTableMetaInfo
->
tagColList
,
index
.
columnIndex
,
pTableMeta
->
id
.
uid
,
pTagSchema1
);
if
(
taosArrayGetSize
(
pTableMetaInfo
->
tagColList
)
>
1
)
{
return
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg
5
);
return
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg
2
);
}
}
}
...
...
@@ -3451,7 +3454,7 @@ static int32_t checkAndSetJoinCondInfo(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, tS
tscColumnListInsert
(
pTableMetaInfo
->
tagColList
,
index
.
columnIndex
,
pTableMeta
->
id
.
uid
,
pTagSchema2
);
if
(
taosArrayGetSize
(
pTableMetaInfo
->
tagColList
)
>
1
)
{
return
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg
5
);
return
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg
2
);
}
}
}
...
...
src/client/src/tscSubquery.c
浏览文件 @
d54ea3c2
...
...
@@ -604,7 +604,7 @@ static int32_t tscLaunchRealSubqueries(SSqlObj* pSql) {
* during the timestamp intersection.
*/
pSupporter
->
limit
=
pQueryInfo
->
limit
;
pQueryInfo
->
limit
=
pSupporter
->
limit
;
//
pQueryInfo->limit = pSupporter->limit;
SColumnIndex
index
=
{.
tableIndex
=
0
,
.
columnIndex
=
PRIMARYKEY_TIMESTAMP_COL_INDEX
};
SSchema
*
s
=
tscGetTableColumnSchema
(
pTableMetaInfo
->
pTableMeta
,
0
);
...
...
@@ -3239,9 +3239,11 @@ static char* getResultBlockPosition(SSqlCmd* pCmd, SSqlRes* pRes, int32_t column
assert
(
pInfo
->
pExpr
->
pExpr
==
NULL
);
*
bytes
=
pInfo
->
pExpr
->
base
.
resBytes
;
char
*
pData
=
pRes
->
data
+
pInfo
->
pExpr
->
base
.
offset
*
pRes
->
numOfRows
+
pRes
->
row
*
(
*
bytes
);
return
pData
;
if
(
pRes
->
data
!=
NULL
)
{
return
pRes
->
data
+
pInfo
->
pExpr
->
base
.
offset
*
pRes
->
numOfRows
+
pRes
->
row
*
(
*
bytes
);
}
else
{
return
pRes
->
urow
[
columnIndex
]
+
pRes
->
row
*
(
*
bytes
);
}
}
static
void
doBuildResFromSubqueries
(
SSqlObj
*
pSql
)
{
...
...
@@ -3265,6 +3267,7 @@ static void doBuildResFromSubqueries(SSqlObj* pSql) {
return
;
}
tscRestoreFuncForSTableQuery
(
pQueryInfo
);
int32_t
rowSize
=
tscGetResRowLength
(
pQueryInfo
->
exprList
);
assert
(
numOfRes
*
rowSize
>
0
);
...
...
@@ -3284,6 +3287,19 @@ static void doBuildResFromSubqueries(SSqlObj* pSql) {
int16_t
bytes
=
0
;
tscRestoreFuncForSTableQuery
(
pQueryInfo
);
tscFieldInfoUpdateOffset
(
pQueryInfo
);
for
(
int32_t
i
=
0
;
i
<
pSql
->
subState
.
numOfSub
;
++
i
)
{
SSqlObj
*
pSub
=
pSql
->
pSubs
[
i
];
if
(
pSub
==
NULL
)
{
continue
;
}
SQueryInfo
*
pSubQueryInfo
=
pSub
->
cmd
.
pQueryInfo
[
0
];
tscRestoreFuncForSTableQuery
(
pSubQueryInfo
);
tscFieldInfoUpdateOffset
(
pSubQueryInfo
);
}
size_t
numOfExprs
=
tscSqlExprNumOfExprs
(
pQueryInfo
);
for
(
int32_t
i
=
0
;
i
<
numOfExprs
;
++
i
)
{
SColumnIndex
*
pIndex
=
&
pRes
->
pColumnIndex
[
i
];
...
...
src/client/src/tscUtil.c
浏览文件 @
d54ea3c2
...
...
@@ -2353,7 +2353,7 @@ STableMetaInfo* tscAddTableMetaInfo(SQueryInfo* pQueryInfo, SName* name, STableM
}
if
(
pTagCols
!=
NULL
)
{
tscColumnListCopy
(
pTableMetaInfo
->
tagColList
,
pTagCols
,
-
1
);
tscColumnListCopy
(
pTableMetaInfo
->
tagColList
,
pTagCols
,
pTableMetaInfo
->
pTableMeta
->
id
.
uid
);
}
pTableMetaInfo
->
pVgroupTables
=
tscVgroupTableInfoDup
(
pVgroupTables
);
...
...
@@ -2584,8 +2584,9 @@ SSqlObj* createSubqueryObj(SSqlObj* pSql, int16_t tableIndex, __async_cb_func_t
terrno
=
TSDB_CODE_TSC_OUT_OF_MEMORY
;
goto
_error
;
}
tscColumnListCopy
(
pNewQueryInfo
->
colList
,
pQueryInfo
->
colList
,
(
int16_t
)
tableIndex
);
uint64_t
uid
=
pTableMetaInfo
->
pTableMeta
->
id
.
uid
;
tscColumnListCopy
(
pNewQueryInfo
->
colList
,
pQueryInfo
->
colList
,
uid
);
// set the correct query type
if
(
pPrevSql
!=
NULL
)
{
...
...
@@ -2595,7 +2596,6 @@ SSqlObj* createSubqueryObj(SSqlObj* pSql, int16_t tableIndex, __async_cb_func_t
TSDB_QUERY_SET_TYPE
(
pNewQueryInfo
->
type
,
TSDB_QUERY_TYPE_SUBQUERY
);
// it must be the subquery
}
uint64_t
uid
=
pTableMetaInfo
->
pTableMeta
->
id
.
uid
;
if
(
tscSqlExprCopy
(
pNewQueryInfo
->
exprList
,
pQueryInfo
->
exprList
,
uid
,
true
)
!=
0
)
{
terrno
=
TSDB_CODE_TSC_OUT_OF_MEMORY
;
goto
_error
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录