Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Mr、小李
TDengine
提交
29df3ea3
T
TDengine
项目概览
Mr、小李
/
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,发现更多精彩内容 >>
提交
29df3ea3
编写于
1月 21, 2020
作者:
H
hjxilinx
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
support order for super table projection query. #1166. [tbase-1477]
上级
44acd0ee
变更
10
显示空白变更内容
内联
并排
Showing
10 changed file
with
113 addition
and
73 deletion
+113
-73
src/client/inc/tscUtil.h
src/client/inc/tscUtil.h
+4
-0
src/client/inc/tsclient.h
src/client/inc/tsclient.h
+4
-1
src/client/src/tscFunctionImpl.c
src/client/src/tscFunctionImpl.c
+26
-18
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+28
-12
src/client/src/tscSecondaryMerge.c
src/client/src/tscSecondaryMerge.c
+19
-8
src/client/src/tscServer.c
src/client/src/tscServer.c
+0
-1
src/client/src/tscUtil.c
src/client/src/tscUtil.c
+22
-9
src/system/detail/src/vnodeQueryImpl.c
src/system/detail/src/vnodeQueryImpl.c
+7
-7
src/system/detail/src/vnodeQueryProcess.c
src/system/detail/src/vnodeQueryProcess.c
+3
-3
src/system/detail/src/vnodeRead.c
src/system/detail/src/vnodeRead.c
+0
-14
未找到文件。
src/client/inc/tscUtil.h
浏览文件 @
29df3ea3
...
@@ -97,7 +97,11 @@ SMeterSidExtInfo* tscGetMeterSidInfo(SVnodeSidList* pSidList, int32_t idx);
...
@@ -97,7 +97,11 @@ SMeterSidExtInfo* tscGetMeterSidInfo(SVnodeSidList* pSidList, int32_t idx);
*/
*/
bool
tscIsPointInterpQuery
(
SQueryInfo
*
pQueryInfo
);
bool
tscIsPointInterpQuery
(
SQueryInfo
*
pQueryInfo
);
bool
tscIsTWAQuery
(
SQueryInfo
*
pQueryInfo
);
bool
tscIsTWAQuery
(
SQueryInfo
*
pQueryInfo
);
bool
tscNonOrderedProjectionQueryOnSTable
(
SQueryInfo
*
pQueryInfo
,
int32_t
tableIndex
);
bool
tscNonOrderedProjectionQueryOnSTable
(
SQueryInfo
*
pQueryInfo
,
int32_t
tableIndex
);
bool
tscOrderedProjectionQueryOnSTable
(
SQueryInfo
*
pQueryInfo
,
int32_t
tableIndex
);
bool
tscIsProjectionQueryOnSTable
(
SQueryInfo
*
pQueryInfo
,
int32_t
tableIndex
);
bool
tscProjectionQueryOnTable
(
SQueryInfo
*
pQueryInfo
);
bool
tscProjectionQueryOnTable
(
SQueryInfo
*
pQueryInfo
);
bool
tscIsTwoStageMergeMetricQuery
(
SQueryInfo
*
pQueryInfo
,
int32_t
tableIndex
);
bool
tscIsTwoStageMergeMetricQuery
(
SQueryInfo
*
pQueryInfo
,
int32_t
tableIndex
);
...
...
src/client/inc/tsclient.h
浏览文件 @
29df3ea3
...
@@ -226,7 +226,10 @@ typedef struct SQueryInfo {
...
@@ -226,7 +226,10 @@ typedef struct SQueryInfo {
struct
STSBuf
*
tsBuf
;
struct
STSBuf
*
tsBuf
;
int64_t
*
defaultVal
;
// default value for interpolation
int64_t
*
defaultVal
;
// default value for interpolation
char
*
msg
;
// pointer to the pCmd->payload to keep error message temporarily
char
*
msg
;
// pointer to the pCmd->payload to keep error message temporarily
int64_t
clauseLimit
;
// limit for this sub clause
int64_t
clauseLimit
;
// limit for current sub clause
// offset value in the original sql expression, NOT sent to virtual node, only applied at client side
int64_t
prjOffset
;
}
SQueryInfo
;
}
SQueryInfo
;
// data source from sql string or from file
// data source from sql string or from file
...
...
src/client/src/tscFunctionImpl.c
浏览文件 @
29df3ea3
...
@@ -2020,11 +2020,11 @@ static void copyTopBotRes(SQLFunctionCtx *pCtx, int32_t type) {
...
@@ -2020,11 +2020,11 @@ static void copyTopBotRes(SQLFunctionCtx *pCtx, int32_t type) {
int32_t
step
=
0
;
int32_t
step
=
0
;
// in case of second stage merge, always use incremental output.
// in case of second stage merge, always use incremental output.
if
(
pCtx
->
currentStage
==
SECONDARY_STAGE_MERGE
)
{
//
if (pCtx->currentStage == SECONDARY_STAGE_MERGE) {
step
=
QUERY_ASC_FORWARD_STEP
;
step
=
QUERY_ASC_FORWARD_STEP
;
}
else
{
//
} else {
step
=
GET_FORWARD_DIRECTION_FACTOR
(
pCtx
->
order
);
//
step = GET_FORWARD_DIRECTION_FACTOR(pCtx->order);
}
//
}
int32_t
len
=
GET_RES_INFO
(
pCtx
)
->
numOfRes
;
int32_t
len
=
GET_RES_INFO
(
pCtx
)
->
numOfRes
;
...
@@ -2891,16 +2891,23 @@ static void col_project_function(SQLFunctionCtx *pCtx) {
...
@@ -2891,16 +2891,23 @@ static void col_project_function(SQLFunctionCtx *pCtx) {
INC_INIT_VAL
(
pCtx
,
pCtx
->
size
);
INC_INIT_VAL
(
pCtx
,
pCtx
->
size
);
char
*
pDest
=
0
;
char
*
pDest
=
0
;
if
(
pCtx
->
order
==
TSQL_SO_ASC
)
{
//
if (pCtx->order == TSQL_SO_ASC) {
pDest
=
pCtx
->
aOutputBuf
;
pDest
=
pCtx
->
aOutputBuf
;
}
else
{
//
} else {
pDest
=
pCtx
->
aOutputBuf
-
(
pCtx
->
size
-
1
)
*
pCtx
->
inputBytes
;
//
pDest = pCtx->aOutputBuf - (pCtx->size - 1) * pCtx->inputBytes;
}
//
}
char
*
pData
=
GET_INPUT_CHAR
(
pCtx
);
char
*
pData
=
GET_INPUT_CHAR
(
pCtx
);
if
(
pCtx
->
order
==
TSQL_SO_ASC
)
{
memcpy
(
pDest
,
pData
,
(
size_t
)
pCtx
->
size
*
pCtx
->
inputBytes
);
memcpy
(
pDest
,
pData
,
(
size_t
)
pCtx
->
size
*
pCtx
->
inputBytes
);
}
else
{
for
(
int32_t
i
=
0
;
i
<
pCtx
->
size
;
++
i
)
{
memcpy
(
pDest
+
(
pCtx
->
size
-
1
-
i
)
*
pCtx
->
inputBytes
,
pData
+
i
*
pCtx
->
inputBytes
,
pCtx
->
inputBytes
);
}
}
pCtx
->
aOutputBuf
+=
pCtx
->
size
*
pCtx
->
outputBytes
*
GET_FORWARD_DIRECTION_FACTOR
(
pCtx
->
order
)
;
pCtx
->
aOutputBuf
+=
pCtx
->
size
*
pCtx
->
outputBytes
/* * GET_FORWARD_DIRECTION_FACTOR(pCtx->order)*/
;
}
}
static
void
col_project_function_f
(
SQLFunctionCtx
*
pCtx
,
int32_t
index
)
{
static
void
col_project_function_f
(
SQLFunctionCtx
*
pCtx
,
int32_t
index
)
{
...
@@ -2915,7 +2922,7 @@ static void col_project_function_f(SQLFunctionCtx *pCtx, int32_t index) {
...
@@ -2915,7 +2922,7 @@ static void col_project_function_f(SQLFunctionCtx *pCtx, int32_t index) {
char
*
pData
=
GET_INPUT_CHAR_INDEX
(
pCtx
,
index
);
char
*
pData
=
GET_INPUT_CHAR_INDEX
(
pCtx
,
index
);
memcpy
(
pCtx
->
aOutputBuf
,
pData
,
pCtx
->
inputBytes
);
memcpy
(
pCtx
->
aOutputBuf
,
pData
,
pCtx
->
inputBytes
);
pCtx
->
aOutputBuf
+=
pCtx
->
inputBytes
*
GET_FORWARD_DIRECTION_FACTOR
(
pCtx
->
order
)
;
pCtx
->
aOutputBuf
+=
pCtx
->
inputBytes
/* * GET_FORWARD_DIRECTION_FACTOR(pCtx->order)*/
;
}
}
/**
/**
...
@@ -2927,18 +2934,18 @@ static void tag_project_function(SQLFunctionCtx *pCtx) {
...
@@ -2927,18 +2934,18 @@ static void tag_project_function(SQLFunctionCtx *pCtx) {
INC_INIT_VAL
(
pCtx
,
pCtx
->
size
);
INC_INIT_VAL
(
pCtx
,
pCtx
->
size
);
assert
(
pCtx
->
inputBytes
==
pCtx
->
outputBytes
);
assert
(
pCtx
->
inputBytes
==
pCtx
->
outputBytes
);
int32_t
factor
=
GET_FORWARD_DIRECTION_FACTOR
(
pCtx
->
order
);
//
int32_t factor = GET_FORWARD_DIRECTION_FACTOR(pCtx->order);
for
(
int32_t
i
=
0
;
i
<
pCtx
->
size
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
pCtx
->
size
;
++
i
)
{
tVariantDump
(
&
pCtx
->
tag
,
pCtx
->
aOutputBuf
,
pCtx
->
outputType
);
tVariantDump
(
&
pCtx
->
tag
,
pCtx
->
aOutputBuf
,
pCtx
->
outputType
);
pCtx
->
aOutputBuf
+=
pCtx
->
outputBytes
*
factor
;
pCtx
->
aOutputBuf
+=
pCtx
->
outputBytes
/* * factor*/
;
}
}
}
}
static
void
tag_project_function_f
(
SQLFunctionCtx
*
pCtx
,
int32_t
index
)
{
static
void
tag_project_function_f
(
SQLFunctionCtx
*
pCtx
,
int32_t
index
)
{
INC_INIT_VAL
(
pCtx
,
1
);
INC_INIT_VAL
(
pCtx
,
1
);
tVariantDump
(
&
pCtx
->
tag
,
pCtx
->
aOutputBuf
,
pCtx
->
tag
.
nType
);
tVariantDump
(
&
pCtx
->
tag
,
pCtx
->
aOutputBuf
,
pCtx
->
tag
.
nType
);
pCtx
->
aOutputBuf
+=
pCtx
->
outputBytes
*
GET_FORWARD_DIRECTION_FACTOR
(
pCtx
->
order
)
;
pCtx
->
aOutputBuf
+=
pCtx
->
outputBytes
/* * GET_FORWARD_DIRECTION_FACTOR(pCtx->order)*/
;
}
}
/**
/**
...
@@ -2986,9 +2993,10 @@ static void diff_function(SQLFunctionCtx *pCtx) {
...
@@ -2986,9 +2993,10 @@ static void diff_function(SQLFunctionCtx *pCtx) {
int32_t
notNullElems
=
0
;
int32_t
notNullElems
=
0
;
int32_t
step
=
GET_FORWARD_DIRECTION_FACTOR
(
pCtx
->
order
)
;
int32_t
step
=
1
/*GET_FORWARD_DIRECTION_FACTOR(pCtx->order)*/
;
int32_t
i
=
(
pCtx
->
order
==
TSQL_SO_ASC
)
?
0
:
pCtx
->
size
-
1
;
// int32_t i = (pCtx->order == TSQL_SO_ASC) ? 0 : pCtx->size - 1;
int32_t
i
=
0
;
TSKEY
*
pTimestamp
=
pCtx
->
ptsOutputBuf
;
TSKEY
*
pTimestamp
=
pCtx
->
ptsOutputBuf
;
switch
(
pCtx
->
inputType
)
{
switch
(
pCtx
->
inputType
)
{
...
@@ -3289,7 +3297,7 @@ static void arithmetic_function(SQLFunctionCtx *pCtx) {
...
@@ -3289,7 +3297,7 @@ static void arithmetic_function(SQLFunctionCtx *pCtx) {
tSQLBinaryExprCalcTraverse
(
sas
->
pExpr
->
pBinExprInfo
.
pBinExpr
,
pCtx
->
size
,
pCtx
->
aOutputBuf
,
sas
,
pCtx
->
order
,
tSQLBinaryExprCalcTraverse
(
sas
->
pExpr
->
pBinExprInfo
.
pBinExpr
,
pCtx
->
size
,
pCtx
->
aOutputBuf
,
sas
,
pCtx
->
order
,
arithmetic_callback_function
);
arithmetic_callback_function
);
pCtx
->
aOutputBuf
+=
pCtx
->
outputBytes
*
pCtx
->
size
*
GET_FORWARD_DIRECTION_FACTOR
(
pCtx
->
order
)
;
pCtx
->
aOutputBuf
+=
pCtx
->
outputBytes
*
pCtx
->
size
/* * GET_FORWARD_DIRECTION_FACTOR(pCtx->order)*/
;
pCtx
->
param
[
1
].
pz
=
NULL
;
pCtx
->
param
[
1
].
pz
=
NULL
;
}
}
...
@@ -3301,7 +3309,7 @@ static void arithmetic_function_f(SQLFunctionCtx *pCtx, int32_t index) {
...
@@ -3301,7 +3309,7 @@ static void arithmetic_function_f(SQLFunctionCtx *pCtx, int32_t index) {
tSQLBinaryExprCalcTraverse
(
sas
->
pExpr
->
pBinExprInfo
.
pBinExpr
,
1
,
pCtx
->
aOutputBuf
,
sas
,
pCtx
->
order
,
tSQLBinaryExprCalcTraverse
(
sas
->
pExpr
->
pBinExprInfo
.
pBinExpr
,
1
,
pCtx
->
aOutputBuf
,
sas
,
pCtx
->
order
,
arithmetic_callback_function
);
arithmetic_callback_function
);
pCtx
->
aOutputBuf
+=
pCtx
->
outputBytes
*
GET_FORWARD_DIRECTION_FACTOR
(
pCtx
->
order
)
;
pCtx
->
aOutputBuf
+=
pCtx
->
outputBytes
/* * GET_FORWARD_DIRECTION_FACTOR(pCtx->order)*/
;
}
}
#define LIST_MINMAX_N(ctx, minOutput, maxOutput, elemCnt, data, type, tsdbType, numOfNotNullElem) \
#define LIST_MINMAX_N(ctx, minOutput, maxOutput, elemCnt, data, type, tsdbType, numOfNotNullElem) \
...
...
src/client/src/tscSQLParser.c
浏览文件 @
29df3ea3
...
@@ -4460,23 +4460,25 @@ int32_t parseLimitClause(SQueryInfo* pQueryInfo, int32_t clauseIndex, SQuerySQL*
...
@@ -4460,23 +4460,25 @@ int32_t parseLimitClause(SQueryInfo* pQueryInfo, int32_t clauseIndex, SQuerySQL*
if
(
queryOnTags
==
true
)
{
// local handle the metric tag query
if
(
queryOnTags
==
true
)
{
// local handle the metric tag query
pQueryInfo
->
command
=
TSDB_SQL_RETRIEVE_TAGS
;
pQueryInfo
->
command
=
TSDB_SQL_RETRIEVE_TAGS
;
}
else
{
}
else
{
if
(
tscNonOrderedProjectionQueryOnSTable
(
pQueryInfo
,
0
))
{
if
(
tscIsProjectionQueryOnSTable
(
pQueryInfo
,
0
))
{
if
(
pQueryInfo
->
order
.
orderColId
>=
0
)
{
if
(
pQueryInfo
->
limit
.
limit
==
-
1
)
{
return
invalidSqlErrMsg
(
pQueryInfo
->
msg
,
msg4
);
}
else
if
(
pQueryInfo
->
limit
.
limit
>
10000
)
{
// the result set can not be larger than 10000
//todo use global config parameter
return
invalidSqlErrMsg
(
pQueryInfo
->
msg
,
msg5
);
}
}
if
(
pQueryInfo
->
slimit
.
limit
>
0
||
pQueryInfo
->
slimit
.
offset
>
0
)
{
if
(
pQueryInfo
->
slimit
.
limit
>
0
||
pQueryInfo
->
slimit
.
offset
>
0
)
{
return
invalidSqlErrMsg
(
pQueryInfo
->
msg
,
msg3
);
return
invalidSqlErrMsg
(
pQueryInfo
->
msg
,
msg3
);
}
}
if
(
tscNonOrderedProjectionQueryOnSTable
(
pQueryInfo
,
0
))
{
// if (pQueryInfo->order.orderColId >= 0) {
// if (pQueryInfo->limit.limit == -1) {
// return invalidSqlErrMsg(pQueryInfo->msg, msg4);
// } else if (pQueryInfo->limit.limit > 10000) { // the result set can not be larger than 10000
// //todo use global config parameter
// return invalidSqlErrMsg(pQueryInfo->msg, msg5);
// }
// }
pQueryInfo
->
type
|=
TSDB_QUERY_TYPE_SUBQUERY
;
// for projection query on super table, all queries are subqueries
pQueryInfo
->
type
|=
TSDB_QUERY_TYPE_SUBQUERY
;
// for projection query on super table, all queries are subqueries
}
}
}
}
}
if
(
pQueryInfo
->
slimit
.
limit
==
0
)
{
if
(
pQueryInfo
->
slimit
.
limit
==
0
)
{
tscTrace
(
"%p limit 0, no output result"
,
pSql
);
tscTrace
(
"%p limit 0, no output result"
,
pSql
);
...
@@ -4504,6 +4506,20 @@ int32_t parseLimitClause(SQueryInfo* pQueryInfo, int32_t clauseIndex, SQuerySQL*
...
@@ -4504,6 +4506,20 @@ int32_t parseLimitClause(SQueryInfo* pQueryInfo, int32_t clauseIndex, SQuerySQL*
// keep original limitation value in globalLimit
// keep original limitation value in globalLimit
pQueryInfo
->
clauseLimit
=
pQueryInfo
->
limit
.
limit
;
pQueryInfo
->
clauseLimit
=
pQueryInfo
->
limit
.
limit
;
pQueryInfo
->
prjOffset
=
pQueryInfo
->
limit
.
offset
;
if
(
tscOrderedProjectionQueryOnSTable
(
pQueryInfo
,
0
))
{
/*
* the limitation/offset value should be removed during retrieve data from virtual node,
* since the global order are done in client side, so the limitation should also
* be done at the client side.
*/
if
(
pQueryInfo
->
limit
.
limit
>
0
)
{
pQueryInfo
->
limit
.
limit
=
-
1
;
}
pQueryInfo
->
limit
.
offset
=
0
;
}
}
else
{
}
else
{
if
(
pQueryInfo
->
slimit
.
limit
!=
-
1
||
pQueryInfo
->
slimit
.
offset
!=
0
)
{
if
(
pQueryInfo
->
slimit
.
limit
!=
-
1
||
pQueryInfo
->
slimit
.
offset
!=
0
)
{
return
invalidSqlErrMsg
(
pQueryInfo
->
msg
,
msg1
);
return
invalidSqlErrMsg
(
pQueryInfo
->
msg
,
msg1
);
...
...
src/client/src/tscSecondaryMerge.c
浏览文件 @
29df3ea3
...
@@ -306,6 +306,13 @@ void tscCreateLocalReducer(tExtMemBuffer **pMemBuffer, int32_t numOfBuffer, tOrd
...
@@ -306,6 +306,13 @@ void tscCreateLocalReducer(tExtMemBuffer **pMemBuffer, int32_t numOfBuffer, tOrd
// we change the maxCapacity of schema to denote that there is only one row in temp buffer
// we change the maxCapacity of schema to denote that there is only one row in temp buffer
pReducer
->
pDesc
->
pSchema
->
maxCapacity
=
1
;
pReducer
->
pDesc
->
pSchema
->
maxCapacity
=
1
;
//restore the limitation value at the last stage
if
(
tscOrderedProjectionQueryOnSTable
(
pQueryInfo
,
0
))
{
pQueryInfo
->
limit
.
limit
=
pQueryInfo
->
clauseLimit
;
pQueryInfo
->
limit
.
offset
=
pQueryInfo
->
prjOffset
;
}
pReducer
->
offset
=
pQueryInfo
->
limit
.
offset
;
pReducer
->
offset
=
pQueryInfo
->
limit
.
offset
;
pRes
->
pLocalReducer
=
pReducer
;
pRes
->
pLocalReducer
=
pReducer
;
...
@@ -510,7 +517,7 @@ static int32_t createOrderDescriptor(tOrderDescriptor **pOrderDesc, SSqlCmd *pCm
...
@@ -510,7 +517,7 @@ static int32_t createOrderDescriptor(tOrderDescriptor **pOrderDesc, SSqlCmd *pCm
}
}
// primary timestamp column is involved in final result
// primary timestamp column is involved in final result
if
(
pQueryInfo
->
nAggTimeInterval
!=
0
)
{
if
(
pQueryInfo
->
nAggTimeInterval
!=
0
||
tscOrderedProjectionQueryOnSTable
(
pQueryInfo
,
0
)
)
{
numOfGroupByCols
++
;
numOfGroupByCols
++
;
}
}
...
@@ -549,6 +556,12 @@ bool isSameGroup(SSqlCmd *pCmd, SLocalReducer *pReducer, char *pPrev, tFilePage
...
@@ -549,6 +556,12 @@ bool isSameGroup(SSqlCmd *pCmd, SLocalReducer *pReducer, char *pPrev, tFilePage
int16_t
functionId
=
tscSqlExprGet
(
pQueryInfo
,
0
)
->
functionId
;
int16_t
functionId
=
tscSqlExprGet
(
pQueryInfo
,
0
)
->
functionId
;
// disable merge procedure for column projection query
// disable merge procedure for column projection query
assert
(
functionId
!=
TSDB_FUNC_ARITHM
);
if
(
tscOrderedProjectionQueryOnSTable
(
pQueryInfo
,
0
))
{
return
true
;
}
if
(
functionId
==
TSDB_FUNC_PRJ
||
functionId
==
TSDB_FUNC_ARITHM
)
{
if
(
functionId
==
TSDB_FUNC_PRJ
||
functionId
==
TSDB_FUNC_ARITHM
)
{
return
false
;
return
false
;
}
}
...
@@ -848,11 +861,11 @@ static void doInterpolateResult(SSqlObj *pSql, SLocalReducer *pLocalReducer, boo
...
@@ -848,11 +861,11 @@ static void doInterpolateResult(SSqlObj *pSql, SLocalReducer *pLocalReducer, boo
int32_t
rowSize
=
tscGetResRowLength
(
pQueryInfo
);
int32_t
rowSize
=
tscGetResRowLength
(
pQueryInfo
);
// handle the descend order output
// handle the descend order output
if
(
pQueryInfo
->
order
.
order
==
TSQL_SO_ASC
)
{
//
if (pQueryInfo->order.order == TSQL_SO_ASC) {
memcpy
(
pRes
->
data
,
pFinalDataPage
->
data
,
pRes
->
numOfRows
*
rowSize
);
memcpy
(
pRes
->
data
,
pFinalDataPage
->
data
,
pRes
->
numOfRows
*
rowSize
);
}
else
{
//
} else {
reversedCopyResultToDstBuf
(
pQueryInfo
,
pRes
,
pFinalDataPage
);
//
reversedCopyResultToDstBuf(pQueryInfo, pRes, pFinalDataPage);
}
//
}
pFinalDataPage
->
numOfElems
=
0
;
pFinalDataPage
->
numOfElems
=
0
;
return
;
return
;
...
@@ -1400,8 +1413,6 @@ int32_t tscDoLocalreduce(SSqlObj *pSql) {
...
@@ -1400,8 +1413,6 @@ int32_t tscDoLocalreduce(SSqlObj *pSql) {
#if defined(_DEBUG_VIEW)
#if defined(_DEBUG_VIEW)
printf
(
"chosen row:
\t
"
);
printf
(
"chosen row:
\t
"
);
SSrcColumnInfo
colInfo
[
256
]
=
{
0
};
SSrcColumnInfo
colInfo
[
256
]
=
{
0
};
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
pCmd
,
pCmd
->
clauseIndex
);
tscGetSrcColumnInfo
(
colInfo
,
pQueryInfo
);
tscGetSrcColumnInfo
(
colInfo
,
pQueryInfo
);
tColModelDisplayEx
(
pModel
,
tmpBuffer
->
data
,
tmpBuffer
->
numOfElems
,
pModel
->
maxCapacity
,
colInfo
);
tColModelDisplayEx
(
pModel
,
tmpBuffer
->
data
,
tmpBuffer
->
numOfElems
,
pModel
->
maxCapacity
,
colInfo
);
...
...
src/client/src/tscServer.c
浏览文件 @
29df3ea3
...
@@ -1182,7 +1182,6 @@ void tscRetrieveFromVnodeCallBack(void *param, TAOS_RES *tres, int numOfRows) {
...
@@ -1182,7 +1182,6 @@ void tscRetrieveFromVnodeCallBack(void *param, TAOS_RES *tres, int numOfRows) {
#ifdef _DEBUG_VIEW
#ifdef _DEBUG_VIEW
printf
(
"received data from vnode: %d rows
\n
"
,
pRes
->
numOfRows
);
printf
(
"received data from vnode: %d rows
\n
"
,
pRes
->
numOfRows
);
SSrcColumnInfo
colInfo
[
256
]
=
{
0
};
SSrcColumnInfo
colInfo
[
256
]
=
{
0
};
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
pCmd
,
pCmd
->
clauseIndex
);
tscGetSrcColumnInfo
(
colInfo
,
pQueryInfo
);
tscGetSrcColumnInfo
(
colInfo
,
pQueryInfo
);
tColModelDisplayEx
(
pDesc
->
pSchema
,
pRes
->
data
,
pRes
->
numOfRows
,
pRes
->
numOfRows
,
colInfo
);
tColModelDisplayEx
(
pDesc
->
pSchema
,
pRes
->
data
,
pRes
->
numOfRows
,
pRes
->
numOfRows
,
colInfo
);
...
...
src/client/src/tscUtil.c
浏览文件 @
29df3ea3
...
@@ -228,7 +228,7 @@ bool tscIsTwoStageMergeMetricQuery(SQueryInfo* pQueryInfo, int32_t tableIndex) {
...
@@ -228,7 +228,7 @@ bool tscIsTwoStageMergeMetricQuery(SQueryInfo* pQueryInfo, int32_t tableIndex) {
return
false
;
return
false
;
}
}
bool
tsc
NonOrdered
ProjectionQueryOnSTable
(
SQueryInfo
*
pQueryInfo
,
int32_t
tableIndex
)
{
bool
tsc
Is
ProjectionQueryOnSTable
(
SQueryInfo
*
pQueryInfo
,
int32_t
tableIndex
)
{
SMeterMetaInfo
*
pMeterMetaInfo
=
tscGetMeterMetaInfoFromQueryInfo
(
pQueryInfo
,
tableIndex
);
SMeterMetaInfo
*
pMeterMetaInfo
=
tscGetMeterMetaInfoFromQueryInfo
(
pQueryInfo
,
tableIndex
);
/*
/*
...
@@ -246,11 +246,6 @@ bool tscNonOrderedProjectionQueryOnSTable(SQueryInfo* pQueryInfo, int32_t tableI
...
@@ -246,11 +246,6 @@ bool tscNonOrderedProjectionQueryOnSTable(SQueryInfo* pQueryInfo, int32_t tableI
return
false
;
return
false
;
}
}
// order by column exists, not a non-ordered projection query
if
(
pQueryInfo
->
order
.
orderColId
>=
0
)
{
return
false
;
}
// for project query, only the following two function is allowed
// for project query, only the following two function is allowed
for
(
int32_t
i
=
0
;
i
<
pQueryInfo
->
fieldsInfo
.
numOfOutputCols
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
pQueryInfo
->
fieldsInfo
.
numOfOutputCols
;
++
i
)
{
int32_t
functionId
=
tscSqlExprGet
(
pQueryInfo
,
i
)
->
functionId
;
int32_t
functionId
=
tscSqlExprGet
(
pQueryInfo
,
i
)
->
functionId
;
...
@@ -263,6 +258,24 @@ bool tscNonOrderedProjectionQueryOnSTable(SQueryInfo* pQueryInfo, int32_t tableI
...
@@ -263,6 +258,24 @@ bool tscNonOrderedProjectionQueryOnSTable(SQueryInfo* pQueryInfo, int32_t tableI
return
true
;
return
true
;
}
}
bool
tscNonOrderedProjectionQueryOnSTable
(
SQueryInfo
*
pQueryInfo
,
int32_t
tableIndex
)
{
if
(
!
tscIsProjectionQueryOnSTable
(
pQueryInfo
,
tableIndex
))
{
return
false
;
}
// order by column exists, not a non-ordered projection query
return
pQueryInfo
->
order
.
orderColId
<
0
;
}
bool
tscOrderedProjectionQueryOnSTable
(
SQueryInfo
*
pQueryInfo
,
int32_t
tableIndex
)
{
if
(
!
tscIsProjectionQueryOnSTable
(
pQueryInfo
,
tableIndex
))
{
return
false
;
}
// order by column exists, a non-ordered projection query
return
pQueryInfo
->
order
.
orderColId
>=
0
;
}
bool
tscProjectionQueryOnTable
(
SQueryInfo
*
pQueryInfo
)
{
bool
tscProjectionQueryOnTable
(
SQueryInfo
*
pQueryInfo
)
{
for
(
int32_t
i
=
0
;
i
<
pQueryInfo
->
fieldsInfo
.
numOfOutputCols
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
pQueryInfo
->
fieldsInfo
.
numOfOutputCols
;
++
i
)
{
int32_t
functionId
=
tscSqlExprGet
(
pQueryInfo
,
i
)
->
functionId
;
int32_t
functionId
=
tscSqlExprGet
(
pQueryInfo
,
i
)
->
functionId
;
...
...
src/system/detail/src/vnodeQueryImpl.c
浏览文件 @
29df3ea3
...
@@ -5391,14 +5391,14 @@ void doSkipResults(SQueryRuntimeEnv *pRuntimeEnv) {
...
@@ -5391,14 +5391,14 @@ void doSkipResults(SQueryRuntimeEnv *pRuntimeEnv) {
int32_t
bytes
=
pRuntimeEnv
->
pCtx
[
i
].
outputBytes
;
int32_t
bytes
=
pRuntimeEnv
->
pCtx
[
i
].
outputBytes
;
if
(
QUERY_IS_ASC_QUERY
(
pQuery
))
{
//
if (QUERY_IS_ASC_QUERY(pQuery)) {
memmove
(
pQuery
->
sdata
[
i
]
->
data
,
pQuery
->
sdata
[
i
]
->
data
+
bytes
*
numOfSkip
,
pQuery
->
pointsRead
*
bytes
);
memmove
(
pQuery
->
sdata
[
i
]
->
data
,
pQuery
->
sdata
[
i
]
->
data
+
bytes
*
numOfSkip
,
pQuery
->
pointsRead
*
bytes
);
}
else
{
// DESC query
//
} else { // DESC query
int32_t
maxrows
=
pQuery
->
pointsToRead
;
//
int32_t maxrows = pQuery->pointsToRead;
//
memmove
(
pQuery
->
sdata
[
i
]
->
data
+
(
maxrows
-
pQuery
->
pointsRead
)
*
bytes
,
//
memmove(pQuery->sdata[i]->data + (maxrows - pQuery->pointsRead) * bytes,
pQuery
->
sdata
[
i
]
->
data
+
(
maxrows
-
size
)
*
bytes
,
pQuery
->
pointsRead
*
bytes
);
//
pQuery->sdata[i]->data + (maxrows - size) * bytes, pQuery->pointsRead * bytes);
}
//
}
pRuntimeEnv
->
pCtx
[
i
].
aOutputBuf
-=
bytes
*
numOfSkip
*
step
;
pRuntimeEnv
->
pCtx
[
i
].
aOutputBuf
-=
bytes
*
numOfSkip
*
step
;
...
...
src/system/detail/src/vnodeQueryProcess.c
浏览文件 @
29df3ea3
...
@@ -747,10 +747,10 @@ static void vnodeMultiMeterMultiOutputProcessor(SQInfo *pQInfo) {
...
@@ -747,10 +747,10 @@ static void vnodeMultiMeterMultiOutputProcessor(SQInfo *pQInfo) {
pSupporter
->
meterIdx
++
;
pSupporter
->
meterIdx
++
;
// if the buffer is full or group by each table, we need to jump out of the loop
// if the buffer is full or group by each table, we need to jump out of the loop
if
(
Q_STATUS_EQUAL
(
pQuery
->
over
,
QUERY_RESBUF_FULL
)
||
//
if (Q_STATUS_EQUAL(pQuery->over, QUERY_RESBUF_FULL) ||
isGroupbyEachTable
(
pQuery
->
pGroupbyExpr
,
pSupporter
->
pSidSet
))
{
//
isGroupbyEachTable(pQuery->pGroupbyExpr, pSupporter->pSidSet)) {
break
;
break
;
}
//
}
}
else
{
}
else
{
// forward query range
// forward query range
...
...
src/system/detail/src/vnodeRead.c
浏览文件 @
29df3ea3
...
@@ -392,11 +392,6 @@ __clean_memory:
...
@@ -392,11 +392,6 @@ __clean_memory:
return
NULL
;
return
NULL
;
}
}
//static void vnodeFreeQInfoInQueueImpl(SSchedMsg *pMsg) {
// SQInfo *pQInfo = (SQInfo *)pMsg->ahandle;
// vnodeFreeQInfo(pQInfo, true);
//}
void
vnodeFreeQInfoInQueue
(
void
*
param
)
{
void
vnodeFreeQInfoInQueue
(
void
*
param
)
{
SQInfo
*
pQInfo
=
(
SQInfo
*
)
param
;
SQInfo
*
pQInfo
=
(
SQInfo
*
)
param
;
...
@@ -406,15 +401,6 @@ void vnodeFreeQInfoInQueue(void *param) {
...
@@ -406,15 +401,6 @@ void vnodeFreeQInfoInQueue(void *param) {
dTrace
(
"QInfo:%p set kill flag to free QInfo"
);
dTrace
(
"QInfo:%p set kill flag to free QInfo"
);
vnodeDecRefCount
(
pQInfo
);
vnodeDecRefCount
(
pQInfo
);
// dTrace("QInfo:%p set kill flag and add to queue, stop query ASAP", pQInfo);
// SSchedMsg schedMsg = {0};
// schedMsg.fp = vnodeFreeQInfoInQueueImpl;
// schedMsg.msg = NULL;
// schedMsg.thandle = (void *)1;
// schedMsg.ahandle = param;
// taosScheduleTask(queryQhandle, &schedMsg);
}
}
void
vnodeFreeQInfo
(
void
*
param
,
bool
decQueryRef
)
{
void
vnodeFreeQInfo
(
void
*
param
,
bool
decQueryRef
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录