Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
828af14b
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
828af14b
编写于
3月 18, 2023
作者:
K
kailixu
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'main' into fix/TS-2891-M
上级
45a625f2
cd498627
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
42 addition
and
9 deletion
+42
-9
include/util/taoserror.h
include/util/taoserror.h
+1
-0
source/client/src/clientImpl.c
source/client/src/clientImpl.c
+4
-5
source/dnode/vnode/src/tsdb/tsdbRead.c
source/dnode/vnode/src/tsdb/tsdbRead.c
+5
-0
source/libs/parser/src/parTranslater.c
source/libs/parser/src/parTranslater.c
+29
-3
source/libs/parser/src/parUtil.c
source/libs/parser/src/parUtil.c
+2
-0
source/libs/parser/test/parSelectTest.cpp
source/libs/parser/test/parSelectTest.cpp
+1
-1
未找到文件。
include/util/taoserror.h
浏览文件 @
828af14b
...
...
@@ -688,6 +688,7 @@ int32_t* taosGetErrno();
#define TSDB_CODE_PAR_NOT_SUPPORT_JOIN TAOS_DEF_ERROR_CODE(0, 0x2664)
#define TSDB_CODE_PAR_INVALID_TAGS_PC TAOS_DEF_ERROR_CODE(0, 0x2665)
#define TSDB_CODE_PAR_INVALID_TIMELINE_QUERY TAOS_DEF_ERROR_CODE(0, 0x2666)
#define TSDB_CODE_PAR_INVALID_OPTR_USAGE TAOS_DEF_ERROR_CODE(0, 0x2667)
#define TSDB_CODE_PAR_INTERNAL_ERROR TAOS_DEF_ERROR_CODE(0, 0x26FF)
//planner
...
...
source/client/src/clientImpl.c
浏览文件 @
828af14b
...
...
@@ -1085,6 +1085,10 @@ static int32_t asyncExecSchQuery(SRequestObj* pRequest, SQuery* pQuery, SMetaDat
tscDebug
(
"0x%"
PRIx64
" plan not executed, code:%s 0x%"
PRIx64
,
pRequest
->
self
,
tstrerror
(
code
),
pRequest
->
requestId
);
destorySqlCallbackWrapper
(
pWrapper
);
if
(
TSDB_CODE_SUCCESS
!=
code
)
{
pRequest
->
code
=
terrno
;
}
pRequest
->
body
.
queryFp
(
pRequest
->
body
.
param
,
pRequest
,
code
);
}
...
...
@@ -1132,11 +1136,6 @@ void launchAsyncQuery(SRequestObj* pRequest, SQuery* pQuery, SMetaData* pResultM
pRequest
->
body
.
queryFp
(
pRequest
->
body
.
param
,
pRequest
,
-
1
);
break
;
}
// TODO weired responding code?
if
(
TSDB_CODE_SUCCESS
!=
code
)
{
pRequest
->
code
=
terrno
;
}
}
int32_t
refreshMeta
(
STscObj
*
pTscObj
,
SRequestObj
*
pRequest
)
{
...
...
source/dnode/vnode/src/tsdb/tsdbRead.c
浏览文件 @
828af14b
...
...
@@ -4550,6 +4550,8 @@ int32_t tsdbRetrieveDatablockSMA(STsdbReader* pReader, SSDataBlock* pDataBlock,
return
TSDB_CODE_SUCCESS
;
}
int64_t
st
=
taosGetTimestampUs
();
SDataBlk
*
pBlock
=
getCurrentBlock
(
&
pReader
->
status
.
blockIter
);
if
(
tDataBlkHasSma
(
pBlock
))
{
code
=
tsdbReadBlockSma
(
pReader
->
pFileReader
,
pBlock
,
pSup
->
pColAgg
);
...
...
@@ -4611,6 +4613,9 @@ int32_t tsdbRetrieveDatablockSMA(STsdbReader* pReader, SSDataBlock* pDataBlock,
*
pBlockSMA
=
pResBlock
->
pBlockAgg
;
pReader
->
cost
.
smaDataLoad
+=
1
;
double
elapsedTime
=
(
taosGetTimestampUs
()
-
st
)
/
1000
.
0
;
pReader
->
cost
.
smaLoadTime
+=
elapsedTime
;
tsdbDebug
(
"vgId:%d, succeed to load block SMA for uid %"
PRIu64
", %s"
,
0
,
pFBlock
->
uid
,
pReader
->
idStr
);
return
code
;
}
...
...
source/libs/parser/src/parTranslater.c
浏览文件 @
828af14b
...
...
@@ -1331,6 +1331,32 @@ static int32_t rewriteCountStar(STranslateContext* pCxt, SFunctionNode* pCount)
return
code
;
}
static
bool
isCountNotNullValue
(
SFunctionNode
*
pFunc
)
{
if
(
FUNCTION_TYPE_COUNT
!=
pFunc
->
funcType
||
1
!=
LIST_LENGTH
(
pFunc
->
pParameterList
))
{
return
false
;
}
SNode
*
pPara
=
nodesListGetNode
(
pFunc
->
pParameterList
,
0
);
return
(
QUERY_NODE_VALUE
==
nodeType
(
pPara
)
&&
!
((
SValueNode
*
)
pPara
)
->
isNull
);
}
// count(1) is rewritten as count(ts) for scannning optimization
static
int32_t
rewriteCountNotNullValue
(
STranslateContext
*
pCxt
,
SFunctionNode
*
pCount
)
{
SValueNode
*
pValue
=
(
SValueNode
*
)
nodesListGetNode
(
pCount
->
pParameterList
,
0
);
STableNode
*
pTable
=
NULL
;
int32_t
code
=
findTable
(
pCxt
,
NULL
,
&
pTable
);
if
(
TSDB_CODE_SUCCESS
==
code
&&
QUERY_NODE_REAL_TABLE
==
nodeType
(
pTable
))
{
SColumnNode
*
pCol
=
(
SColumnNode
*
)
nodesMakeNode
(
QUERY_NODE_COLUMN
);
if
(
NULL
==
pCol
)
{
code
=
TSDB_CODE_OUT_OF_MEMORY
;
}
else
{
setColumnInfoBySchema
((
SRealTableNode
*
)
pTable
,
((
SRealTableNode
*
)
pTable
)
->
pMeta
->
schema
,
-
1
,
pCol
);
NODES_DESTORY_LIST
(
pCount
->
pParameterList
);
code
=
nodesListMakeAppend
(
&
pCount
->
pParameterList
,
(
SNode
*
)
pCol
);
}
}
return
code
;
}
static
bool
isCountTbname
(
SFunctionNode
*
pFunc
)
{
if
(
FUNCTION_TYPE_COUNT
!=
pFunc
->
funcType
||
1
!=
LIST_LENGTH
(
pFunc
->
pParameterList
))
{
return
false
;
...
...
@@ -2041,7 +2067,7 @@ static int32_t getGroupByErrorCode(STranslateContext* pCxt) {
if
(
isSelectStmt
(
pCxt
->
pCurrStmt
)
&&
NULL
!=
((
SSelectStmt
*
)
pCxt
->
pCurrStmt
)
->
pGroupByList
)
{
return
TSDB_CODE_PAR_GROUPBY_LACK_EXPRESSION
;
}
return
TSDB_CODE_PAR_
NO_VALID_FUNC_IN_WIN
;
return
TSDB_CODE_PAR_
INVALID_OPTR_USAGE
;
}
static
EDealRes
rewriteColToSelectValFunc
(
STranslateContext
*
pCxt
,
SNode
**
pNode
)
{
...
...
@@ -2114,13 +2140,13 @@ static EDealRes doCheckExprForGroupBy(SNode** pNode, void* pContext) {
}
if
(
isScanPseudoColumnFunc
(
*
pNode
)
||
QUERY_NODE_COLUMN
==
nodeType
(
*
pNode
))
{
if
(
pSelect
->
selectFuncNum
>
1
||
pSelect
->
hasOtherVectorFunc
||
!
pSelect
->
hasSelectFunc
)
{
return
generateDealNodeErrMsg
(
pCxt
,
getGroupByErrorCode
(
pCxt
));
return
generateDealNodeErrMsg
(
pCxt
,
getGroupByErrorCode
(
pCxt
)
,
((
SExprNode
*
)(
*
pNode
))
->
userAlias
);
}
else
{
return
rewriteColToSelectValFunc
(
pCxt
,
pNode
);
}
}
if
(
isVectorFunc
(
*
pNode
)
&&
isDistinctOrderBy
(
pCxt
))
{
return
generateDealNodeErrMsg
(
pCxt
,
getGroupByErrorCode
(
pCxt
));
return
generateDealNodeErrMsg
(
pCxt
,
getGroupByErrorCode
(
pCxt
)
,
((
SExprNode
*
)(
*
pNode
))
->
userAlias
);
}
return
DEAL_RES_CONTINUE
;
}
...
...
source/libs/parser/src/parUtil.c
浏览文件 @
828af14b
...
...
@@ -174,6 +174,8 @@ static char* getSyntaxErrFormat(int32_t errCode) {
return
"Invalid usage of RANGE clause, EVERY clause or FILL clause"
;
case
TSDB_CODE_PAR_NO_VALID_FUNC_IN_WIN
:
return
"No valid function in window query"
;
case
TSDB_CODE_PAR_INVALID_OPTR_USAGE
:
return
"Invalid usage of expr: %s"
;
case
TSDB_CODE_OUT_OF_MEMORY
:
return
"Out of memory"
;
default:
...
...
source/libs/parser/test/parSelectTest.cpp
浏览文件 @
828af14b
...
...
@@ -286,7 +286,7 @@ TEST_F(ParserSelectTest, interval) {
TEST_F
(
ParserSelectTest
,
intervalSemanticCheck
)
{
useDb
(
"root"
,
"test"
);
run
(
"SELECT c1 FROM t1 INTERVAL(10s)"
,
TSDB_CODE_PAR_
NO_VALID_FUNC_IN_WIN
);
run
(
"SELECT c1 FROM t1 INTERVAL(10s)"
,
TSDB_CODE_PAR_
INVALID_OPTR_USAGE
);
run
(
"SELECT DISTINCT c1, c2 FROM t1 WHERE c1 > 3 INTERVAL(1d) FILL(NEXT)"
,
TSDB_CODE_PAR_INVALID_FILL_TIME_RANGE
);
run
(
"SELECT HISTOGRAM(c1, 'log_bin', '{
\"
start
\"
: -33,
\"
factor
\"
: 55,
\"
count
\"
: 5,
\"
infinity
\"
: false}', 1) FROM t1 "
"WHERE ts > TIMESTAMP '2022-04-01 00:00:00' and ts < TIMESTAMP '2022-04-30 23:59:59' INTERVAL(10s) FILL(NULL)"
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录