Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
aea35d6b
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看板
提交
aea35d6b
编写于
8月 08, 2020
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[td-225] fix bugs.
上级
9f3c8150
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
32 addition
and
48 deletion
+32
-48
src/client/inc/tsclient.h
src/client/inc/tsclient.h
+1
-0
src/client/src/tscLocalMerge.c
src/client/src/tscLocalMerge.c
+28
-45
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+3
-3
未找到文件。
src/client/inc/tsclient.h
浏览文件 @
aea35d6b
...
...
@@ -256,6 +256,7 @@ typedef struct SResRec {
typedef
struct
{
int64_t
numOfRows
;
// num of results in current retrieved
int64_t
numOfRowsGroup
;
// num of results of current group
int64_t
numOfTotal
;
// num of total results
int64_t
numOfClauseTotal
;
// num of total result in current subclause
char
*
pRsp
;
...
...
src/client/src/tscLocalMerge.c
浏览文件 @
aea35d6b
...
...
@@ -856,24 +856,6 @@ void savePrevRecordAndSetupInterpoInfo(SLocalReducer *pLocalReducer, SQueryInfo
tColModelAppend
(
pModel
,
pLocalReducer
->
discardData
,
pLocalReducer
->
prevRowOfInput
,
0
,
1
,
1
);
}
// todo merge with following function
// static void reversedCopyResultToDstBuf(SQueryInfo* pQueryInfo, SSqlRes *pRes, tFilePage *pFinalDataPage) {
//
// for (int32_t i = 0; i < pQueryInfo->exprList.numOfExprs; ++i) {
// TAOS_FIELD *pField = tscFieldInfoGetField(&pQueryInfo->fieldsInfo, i);
//
// int32_t offset = tscFieldInfoGetOffset(pQueryInfo, i);
// char * src = pFinalDataPage->data + (pRes->numOfRows - 1) * pField->bytes + pRes->numOfRows * offset;
// char * dst = pRes->data + pRes->numOfRows * offset;
//
// for (int32_t j = 0; j < pRes->numOfRows; ++j) {
// memcpy(dst, src, (size_t)pField->bytes);
// dst += pField->bytes;
// src -= pField->bytes;
// }
// }
//}
static
void
reversedCopyFromInterpolationToDstBuf
(
SQueryInfo
*
pQueryInfo
,
SSqlRes
*
pRes
,
tFilePage
**
pResPages
,
SLocalReducer
*
pLocalReducer
)
{
assert
(
0
);
...
...
@@ -907,20 +889,10 @@ static void doFillResult(SSqlObj *pSql, SLocalReducer *pLocalReducer, bool doneO
tFilePage
*
pFinalDataPage
=
pLocalReducer
->
pResultBuf
;
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
pCmd
,
pCmd
->
clauseIndex
);
// if (pRes->pLocalReducer != pLocalReducer) {
// /*
// * Release the SSqlObj is called, and it is int destroying function invoked by other thread.
// * However, the other thread will WAIT until current process fully completes.
// * Since the flag of release struct is set by doLocalReduce function
// */
// assert(pRes->pLocalReducer == NULL);
// }
// no interval query, no fill operation
if
(
pQueryInfo
->
intervalTime
==
0
||
pQueryInfo
->
fillType
==
TSDB_FILL_NONE
)
{
pRes
->
data
=
pLocalReducer
->
pFinalRes
;
pRes
->
numOfRows
=
pFinalDataPage
->
num
;
pRes
->
numOfClauseTotal
+=
pRes
->
numOfRows
;
if
(
pQueryInfo
->
limit
.
offset
>
0
)
{
if
(
pQueryInfo
->
limit
.
offset
<
pRes
->
numOfRows
)
{
...
...
@@ -931,22 +903,22 @@ static void doFillResult(SSqlObj *pSql, SLocalReducer *pLocalReducer, bool doneO
tColModelCompact
(
pLocalReducer
->
resColModel
,
pFinalDataPage
,
prevSize
);
pRes
->
numOfRows
-=
pQueryInfo
->
limit
.
offset
;
pRes
->
numOfClauseTotal
-=
pQueryInfo
->
limit
.
offset
;
pQueryInfo
->
limit
.
offset
=
0
;
}
else
{
pQueryInfo
->
limit
.
offset
-=
pRes
->
numOfRows
;
pRes
->
numOfRows
=
0
;
pRes
->
numOfClauseTotal
=
0
;
}
}
if
(
pQueryInfo
->
limit
.
limit
>=
0
&&
pRes
->
numOfClauseTotal
>
pQueryInfo
->
limit
.
limit
)
{
pRes
->
numOfRowsGroup
+=
pRes
->
numOfRows
;
if
(
pQueryInfo
->
limit
.
limit
>=
0
&&
pRes
->
numOfRowsGroup
>
pQueryInfo
->
limit
.
limit
)
{
/* impose the limitation of output rows on the final result */
int32_t
prevSize
=
pFinalDataPage
->
num
;
int32_t
overflow
=
pRes
->
numOf
ClauseTotal
-
pQueryInfo
->
limit
.
limit
;
int32_t
overflow
=
pRes
->
numOf
RowsGroup
-
pQueryInfo
->
limit
.
limit
;
assert
(
overflow
<
pRes
->
numOfRows
);
pRes
->
numOf
ClauseTotal
=
pQueryInfo
->
limit
.
limit
;
pRes
->
numOf
RowsGroup
=
pQueryInfo
->
limit
.
limit
;
pRes
->
numOfRows
-=
overflow
;
pFinalDataPage
->
num
-=
overflow
;
...
...
@@ -957,6 +929,8 @@ static void doFillResult(SSqlObj *pSql, SLocalReducer *pLocalReducer, bool doneO
}
memcpy
(
pRes
->
data
,
pFinalDataPage
->
data
,
pRes
->
numOfRows
*
pLocalReducer
->
finalRowSize
);
pRes
->
numOfClauseTotal
+=
pRes
->
numOfRows
;
pFinalDataPage
->
num
=
0
;
return
;
}
...
...
@@ -969,7 +943,7 @@ static void doFillResult(SSqlObj *pSql, SLocalReducer *pLocalReducer, bool doneO
TAOS_FIELD
*
pField
=
tscFieldInfoGetField
(
&
pQueryInfo
->
fieldsInfo
,
i
);
pResPages
[
i
]
=
calloc
(
1
,
sizeof
(
tFilePage
)
+
pField
->
bytes
*
pLocalReducer
->
resColModel
->
capacity
);
}
while
(
1
)
{
int64_t
newRows
=
taosGenerateDataBlock
(
pFillInfo
,
pResPages
,
pLocalReducer
->
resColModel
->
capacity
);
...
...
@@ -986,7 +960,6 @@ static void doFillResult(SSqlObj *pSql, SLocalReducer *pLocalReducer, bool doneO
pRes
->
data
=
pLocalReducer
->
pFinalRes
;
pRes
->
numOfRows
=
newRows
;
pRes
->
numOfClauseTotal
+=
newRows
;
pQueryInfo
->
limit
.
offset
=
0
;
break
;
...
...
@@ -1010,15 +983,13 @@ static void doFillResult(SSqlObj *pSql, SLocalReducer *pLocalReducer, bool doneO
}
if
(
pRes
->
numOfRows
>
0
)
{
if
(
pQueryInfo
->
limit
.
limit
>=
0
&&
pRes
->
numOf
ClauseTotal
>
pQueryInfo
->
limit
.
limit
)
{
int32_t
overflow
=
pRes
->
numOf
ClauseTotal
-
pQueryInfo
->
limit
.
limit
;
if
(
pQueryInfo
->
limit
.
limit
>=
0
&&
pRes
->
numOf
Rows
>
pQueryInfo
->
limit
.
limit
)
{
int32_t
overflow
=
pRes
->
numOf
Rows
-
pQueryInfo
->
limit
.
limit
;
pRes
->
numOfRows
-=
overflow
;
assert
(
pRes
->
numOfRows
>=
0
);
pRes
->
numOfClauseTotal
=
pQueryInfo
->
limit
.
limit
;
pFinalDataPage
->
num
-=
overflow
;
assert
(
pRes
->
numOfRows
>=
0
&&
pFinalDataPage
->
num
>
0
);
/* set remain data to be discarded, and reset the interpolation information */
savePrevRecordAndSetupInterpoInfo
(
pLocalReducer
,
pQueryInfo
,
pFillInfo
);
}
...
...
@@ -1032,6 +1003,9 @@ static void doFillResult(SSqlObj *pSql, SLocalReducer *pLocalReducer, bool doneO
}
else
{
// todo bug??
reversedCopyFromInterpolationToDstBuf
(
pQueryInfo
,
pRes
,
pResPages
,
pLocalReducer
);
}
pRes
->
numOfRowsGroup
+=
pRes
->
numOfRows
;
pRes
->
numOfClauseTotal
+=
pRes
->
numOfRows
;
}
pFinalDataPage
->
num
=
0
;
...
...
@@ -1227,7 +1201,10 @@ static bool saveGroupResultInfo(SSqlObj *pSql) {
SSqlRes
*
pRes
=
&
pSql
->
res
;
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
pCmd
,
pCmd
->
clauseIndex
);
pRes
->
numOfGroups
+=
1
;
if
(
pRes
->
numOfRowsGroup
>
0
)
{
pRes
->
numOfGroups
+=
1
;
}
// the output group is limited by the slimit clause
if
(
reachGroupResultLimit
(
pQueryInfo
,
pRes
))
{
...
...
@@ -1266,7 +1243,12 @@ bool doGenerateFinalResults(SSqlObj *pSql, SLocalReducer *pLocalReducer, bool no
pRes
->
numOfRows
=
0
;
pQueryInfo
->
slimit
.
offset
-=
1
;
pLocalReducer
->
discard
=
!
noMoreCurrentGroupRes
;
if
(
pLocalReducer
->
discard
)
{
SColumnModel
*
pInternModel
=
pLocalReducer
->
pDesc
->
pColumnModel
;
tColModelAppend
(
pInternModel
,
pLocalReducer
->
discardData
,
pLocalReducer
->
pTempBuffer
->
data
,
0
,
1
,
1
);
}
return
false
;
}
...
...
@@ -1299,7 +1281,7 @@ void resetOutputBuf(SQueryInfo *pQueryInfo, SLocalReducer *pLocalReducer) { //
static
void
resetEnvForNewResultset
(
SSqlRes
*
pRes
,
SSqlCmd
*
pCmd
,
SLocalReducer
*
pLocalReducer
)
{
// In handling data in other groups, we need to reset the interpolation information for a new group data
pRes
->
numOfRows
=
0
;
pRes
->
numOf
ClauseTotal
=
0
;
pRes
->
numOf
RowsGroup
=
0
;
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
pCmd
,
pCmd
->
clauseIndex
);
...
...
@@ -1363,7 +1345,8 @@ static bool doHandleLastRemainData(SSqlObj *pSql) {
if
((
isAllSourcesCompleted
(
pLocalReducer
)
&&
!
pLocalReducer
->
hasPrevRow
)
||
pLocalReducer
->
pLocalDataSrc
[
0
]
==
NULL
||
prevGroupCompleted
)
{
// if fillType == TSDB_FILL_NONE, return directly
if
(
pQueryInfo
->
fillType
!=
TSDB_FILL_NONE
)
{
if
(
pQueryInfo
->
fillType
!=
TSDB_FILL_NONE
&&
((
pRes
->
numOfRowsGroup
<
pQueryInfo
->
limit
.
limit
&&
pQueryInfo
->
limit
.
limit
>
0
)
||
(
pQueryInfo
->
limit
.
limit
<
0
)))
{
int64_t
etime
=
(
pQueryInfo
->
window
.
skey
<
pQueryInfo
->
window
.
ekey
)
?
pQueryInfo
->
window
.
ekey
:
pQueryInfo
->
window
.
skey
;
assert
(
pFillInfo
->
numOfRows
==
0
);
...
...
src/client/src/tscSQLParser.c
浏览文件 @
aea35d6b
...
...
@@ -5954,13 +5954,13 @@ int32_t doCheckForQuery(SSqlObj* pSql, SQuerySQL* pQuerySql, int32_t index) {
return
doLocalQueryProcess
(
pCmd
,
pQueryInfo
,
pQuerySql
);
}
if
(
pQuerySql
->
from
->
nExpr
>
TSDB_MAX_JOIN_TABLE_NUM
)
{
if
(
pQuerySql
->
from
->
nExpr
>
TSDB_MAX_JOIN_TABLE_NUM
*
2
)
{
return
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg7
);
}
pQueryInfo
->
command
=
TSDB_SQL_SELECT
;
if
(
pQuerySql
->
from
->
nExpr
>
2
)
{
if
(
pQuerySql
->
from
->
nExpr
>
4
)
{
return
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg10
);
}
...
...
@@ -5983,7 +5983,7 @@ int32_t doCheckForQuery(SSqlObj* pSql, SQuerySQL* pQuerySql, int32_t index) {
tscAddEmptyMetaInfo
(
pQueryInfo
);
}
STableMetaInfo
*
pTableMetaInfo1
=
tscGetMetaInfo
(
pQueryInfo
,
i
);
STableMetaInfo
*
pTableMetaInfo1
=
tscGetMetaInfo
(
pQueryInfo
,
i
/
2
);
SSQLToken
t
=
{.
type
=
TSDB_DATA_TYPE_BINARY
,
.
n
=
pTableItem
->
nLen
,
.
z
=
pTableItem
->
pz
};
if
(
tscSetTableFullName
(
pTableMetaInfo1
,
&
t
,
pSql
)
!=
TSDB_CODE_SUCCESS
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录