Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
3f577c50
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22017
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看板
提交
3f577c50
编写于
2月 02, 2023
作者:
S
shenglian zhou
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: show table distributed only works on super table, child table, and normal table
上级
04a3b1d5
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
38 addition
and
2 deletion
+38
-2
include/libs/function/functionMgt.h
include/libs/function/functionMgt.h
+1
-0
source/libs/function/src/functionMgt.c
source/libs/function/src/functionMgt.c
+7
-0
source/libs/parser/src/parTranslater.c
source/libs/parser/src/parTranslater.c
+26
-2
tests/script/tsim/compute/block_dist.sim
tests/script/tsim/compute/block_dist.sim
+4
-0
未找到文件。
include/libs/function/functionMgt.h
浏览文件 @
3f577c50
...
...
@@ -218,6 +218,7 @@ bool fmIsKeepOrderFunc(int32_t funcId);
bool
fmIsCumulativeFunc
(
int32_t
funcId
);
bool
fmIsInterpPseudoColumnFunc
(
int32_t
funcId
);
bool
fmIsGroupKeyFunc
(
int32_t
funcId
);
bool
fmIsBlockDistFunc
(
int32_t
funcId
);
void
getLastCacheDataType
(
SDataType
*
pType
);
...
...
source/libs/function/src/functionMgt.c
浏览文件 @
3f577c50
...
...
@@ -262,6 +262,13 @@ bool fmIsGroupKeyFunc(int32_t funcId) {
return
FUNCTION_TYPE_GROUP_KEY
==
funcMgtBuiltins
[
funcId
].
type
;
}
bool
fmIsBlockDistFunc
(
int32_t
funcId
)
{
if
(
funcId
<
0
||
funcId
>=
funcMgtBuiltinsNum
)
{
return
false
;
}
return
FUNCTION_TYPE_BLOCK_DIST
==
funcMgtBuiltins
[
funcId
].
type
;
}
void
fmFuncMgtDestroy
()
{
void
*
m
=
gFunMgtService
.
pFuncNameHashTable
;
if
(
m
!=
NULL
&&
atomic_val_compare_exchange_ptr
((
void
**
)
&
gFunMgtService
.
pFuncNameHashTable
,
m
,
0
)
==
m
)
{
...
...
source/libs/parser/src/parTranslater.c
浏览文件 @
3f577c50
...
...
@@ -1558,6 +1558,26 @@ static int32_t translateRepeatScanFunc(STranslateContext* pCxt, SFunctionNode* p
return
TSDB_CODE_SUCCESS
;
}
static
int32_t
translateBlockDistFunc
(
STranslateContext
*
pCtx
,
SFunctionNode
*
pFunc
)
{
if
(
!
fmIsBlockDistFunc
(
pFunc
->
funcId
))
{
return
TSDB_CODE_SUCCESS
;
}
if
(
!
isSelectStmt
(
pCtx
->
pCurrStmt
))
{
return
generateSyntaxErrMsgExt
(
&
pCtx
->
msgBuf
,
TSDB_CODE_PAR_ONLY_SUPPORT_SINGLE_TABLE
,
"%s is only supported in single table query"
,
pFunc
->
functionName
);
}
SSelectStmt
*
pSelect
=
(
SSelectStmt
*
)
pCtx
->
pCurrStmt
;
SNode
*
pTable
=
pSelect
->
pFromTable
;
if
(
NULL
!=
pTable
&&
(
QUERY_NODE_REAL_TABLE
!=
nodeType
(
pTable
)
||
(
TSDB_SUPER_TABLE
!=
((
SRealTableNode
*
)
pTable
)
->
pMeta
->
tableType
&&
TSDB_CHILD_TABLE
!=
((
SRealTableNode
*
)
pTable
)
->
pMeta
->
tableType
&&
TSDB_NORMAL_TABLE
!=
((
SRealTableNode
*
)
pTable
)
->
pMeta
->
tableType
)))
{
return
generateSyntaxErrMsgExt
(
&
pCtx
->
msgBuf
,
TSDB_CODE_PAR_NOT_ALLOWED_FUNC
,
"%s is only supported on super table, child table or normal table"
,
pFunc
->
functionName
);
}
return
TSDB_CODE_SUCCESS
;
}
static
bool
isStar
(
SNode
*
pNode
)
{
return
(
QUERY_NODE_COLUMN
==
nodeType
(
pNode
))
&&
(
'\0'
==
((
SColumnNode
*
)
pNode
)
->
tableAlias
[
0
])
&&
(
0
==
strcmp
(((
SColumnNode
*
)
pNode
)
->
colName
,
"*"
));
...
...
@@ -1717,7 +1737,7 @@ static int32_t rewriteSystemInfoFunc(STranslateContext* pCxt, SNode** pNode) {
return
TSDB_CODE_PAR_INTERNAL_ERROR
;
}
static
int32_t
translateNor
am
lFunction
(
STranslateContext
*
pCxt
,
SFunctionNode
*
pFunc
)
{
static
int32_t
translateNor
ma
lFunction
(
STranslateContext
*
pCxt
,
SFunctionNode
*
pFunc
)
{
int32_t
code
=
translateAggFunc
(
pCxt
,
pFunc
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
translateScanPseudoColumnFunc
(
pCxt
,
pFunc
);
...
...
@@ -1749,6 +1769,9 @@ static int32_t translateNoramlFunction(STranslateContext* pCxt, SFunctionNode* p
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
translateTimelineFunc
(
pCxt
,
pFunc
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
translateBlockDistFunc
(
pCxt
,
pFunc
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
setFuncClassification
(
pCxt
->
pCurrStmt
,
pFunc
);
}
...
...
@@ -1809,7 +1832,7 @@ static int32_t translateFunctionImpl(STranslateContext* pCxt, SFunctionNode** pF
if
(
fmIsClientPseudoColumnFunc
((
*
pFunc
)
->
funcId
))
{
return
rewriteClientPseudoColumnFunc
(
pCxt
,
(
SNode
**
)
pFunc
);
}
return
translateNor
am
lFunction
(
pCxt
,
*
pFunc
);
return
translateNor
ma
lFunction
(
pCxt
,
*
pFunc
);
}
static
EDealRes
translateFunction
(
STranslateContext
*
pCxt
,
SFunctionNode
**
pFunc
)
{
...
...
@@ -6307,6 +6330,7 @@ static int32_t createSelectStmtForShow(ENodeType showType, SSelectStmt** pStmt)
}
static
int32_t
createSelectStmtForShowTableDist
(
SShowTableDistributedStmt
*
pStmt
,
SSelectStmt
**
pOutput
)
{
return
createSimpleSelectStmt
(
pStmt
->
dbName
,
pStmt
->
tableName
,
0
,
NULL
,
pOutput
);
}
...
...
tests/script/tsim/compute/block_dist.sim
浏览文件 @
3f577c50
...
...
@@ -91,6 +91,10 @@ print ============== TD-5998
sql_error select _block_dist() from (select * from $nt)
sql_error select _block_dist() from (select * from $mt)
print ============== TD-22140 & TD-22165
sql_error show table distributed information_schema.ins_databases
sql_error show table distributed performance_schema.perf_apps
print =============== clear
sql drop database $db
sql select * from information_schema.ins_databases
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录