Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
7414f28d
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看板
提交
7414f28d
编写于
4月 13, 2023
作者:
G
Ganlin Zhao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix translatefunc not getting precision issue
上级
dcf77f25
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
33 addition
and
5 deletion
+33
-5
include/libs/function/functionMgt.h
include/libs/function/functionMgt.h
+1
-1
source/libs/function/src/functionMgt.c
source/libs/function/src/functionMgt.c
+3
-0
source/libs/parser/src/parTranslater.c
source/libs/parser/src/parTranslater.c
+14
-0
source/libs/scalar/src/scalar.c
source/libs/scalar/src/scalar.c
+15
-4
未找到文件。
include/libs/function/functionMgt.h
浏览文件 @
7414f28d
...
@@ -189,7 +189,7 @@ bool fmIsScalarFunc(int32_t funcId);
...
@@ -189,7 +189,7 @@ bool fmIsScalarFunc(int32_t funcId);
bool
fmIsVectorFunc
(
int32_t
funcId
);
bool
fmIsVectorFunc
(
int32_t
funcId
);
bool
fmIsIndefiniteRowsFunc
(
int32_t
funcId
);
bool
fmIsIndefiniteRowsFunc
(
int32_t
funcId
);
bool
fmIsStringFunc
(
int32_t
funcId
);
bool
fmIsStringFunc
(
int32_t
funcId
);
bool
fmIsDate
t
imeFunc
(
int32_t
funcId
);
bool
fmIsDate
T
imeFunc
(
int32_t
funcId
);
bool
fmIsSelectFunc
(
int32_t
funcId
);
bool
fmIsSelectFunc
(
int32_t
funcId
);
bool
fmIsTimelineFunc
(
int32_t
funcId
);
bool
fmIsTimelineFunc
(
int32_t
funcId
);
bool
fmIsTimeorderFunc
(
int32_t
funcId
);
bool
fmIsTimeorderFunc
(
int32_t
funcId
);
...
...
source/libs/function/src/functionMgt.c
浏览文件 @
7414f28d
...
@@ -174,6 +174,8 @@ bool fmIsSelectFunc(int32_t funcId) { return isSpecificClassifyFunc(funcId, FUNC
...
@@ -174,6 +174,8 @@ bool fmIsSelectFunc(int32_t funcId) { return isSpecificClassifyFunc(funcId, FUNC
bool
fmIsTimelineFunc
(
int32_t
funcId
)
{
return
isSpecificClassifyFunc
(
funcId
,
FUNC_MGT_TIMELINE_FUNC
);
}
bool
fmIsTimelineFunc
(
int32_t
funcId
)
{
return
isSpecificClassifyFunc
(
funcId
,
FUNC_MGT_TIMELINE_FUNC
);
}
bool
fmIsDateTimeFunc
(
int32_t
funcId
)
{
return
isSpecificClassifyFunc
(
funcId
,
FUNC_MGT_DATETIME_FUNC
);
}
bool
fmIsPseudoColumnFunc
(
int32_t
funcId
)
{
return
isSpecificClassifyFunc
(
funcId
,
FUNC_MGT_PSEUDO_COLUMN_FUNC
);
}
bool
fmIsPseudoColumnFunc
(
int32_t
funcId
)
{
return
isSpecificClassifyFunc
(
funcId
,
FUNC_MGT_PSEUDO_COLUMN_FUNC
);
}
bool
fmIsScanPseudoColumnFunc
(
int32_t
funcId
)
{
return
isSpecificClassifyFunc
(
funcId
,
FUNC_MGT_SCAN_PC_FUNC
);
}
bool
fmIsScanPseudoColumnFunc
(
int32_t
funcId
)
{
return
isSpecificClassifyFunc
(
funcId
,
FUNC_MGT_SCAN_PC_FUNC
);
}
...
@@ -184,6 +186,7 @@ bool fmIsWindowClauseFunc(int32_t funcId) { return fmIsAggFunc(funcId) || fmIsWi
...
@@ -184,6 +186,7 @@ bool fmIsWindowClauseFunc(int32_t funcId) { return fmIsAggFunc(funcId) || fmIsWi
bool
fmIsIndefiniteRowsFunc
(
int32_t
funcId
)
{
return
isSpecificClassifyFunc
(
funcId
,
FUNC_MGT_INDEFINITE_ROWS_FUNC
);
}
bool
fmIsIndefiniteRowsFunc
(
int32_t
funcId
)
{
return
isSpecificClassifyFunc
(
funcId
,
FUNC_MGT_INDEFINITE_ROWS_FUNC
);
}
bool
fmIsSpecialDataRequiredFunc
(
int32_t
funcId
)
{
bool
fmIsSpecialDataRequiredFunc
(
int32_t
funcId
)
{
return
isSpecificClassifyFunc
(
funcId
,
FUNC_MGT_SPECIAL_DATA_REQUIRED
);
return
isSpecificClassifyFunc
(
funcId
,
FUNC_MGT_SPECIAL_DATA_REQUIRED
);
}
}
...
...
source/libs/parser/src/parTranslater.c
浏览文件 @
7414f28d
...
@@ -1539,6 +1539,16 @@ static int32_t translateTimelineFunc(STranslateContext* pCxt, SFunctionNode* pFu
...
@@ -1539,6 +1539,16 @@ static int32_t translateTimelineFunc(STranslateContext* pCxt, SFunctionNode* pFu
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
static
int32_t
translateDateTimeFunc
(
STranslateContext
*
pCxt
,
SFunctionNode
*
pFunc
)
{
if
(
!
fmIsDateTimeFunc
(
pFunc
->
funcId
))
{
return
TSDB_CODE_SUCCESS
;
}
SSelectStmt
*
pSelect
=
(
SSelectStmt
*
)
pCxt
->
pCurrStmt
;
pFunc
->
node
.
resType
.
precision
=
pSelect
->
precision
;
return
TSDB_CODE_SUCCESS
;
}
static
bool
hasFillClause
(
SNode
*
pCurrStmt
)
{
static
bool
hasFillClause
(
SNode
*
pCurrStmt
)
{
if
(
!
isSelectStmt
(
pCurrStmt
))
{
if
(
!
isSelectStmt
(
pCurrStmt
))
{
return
false
;
return
false
;
...
@@ -1678,6 +1688,7 @@ static void setFuncClassification(SNode* pCurrStmt, SFunctionNode* pFunc) {
...
@@ -1678,6 +1688,7 @@ static void setFuncClassification(SNode* pCurrStmt, SFunctionNode* pFunc) {
SSelectStmt
*
pSelect
=
(
SSelectStmt
*
)
pCurrStmt
;
SSelectStmt
*
pSelect
=
(
SSelectStmt
*
)
pCurrStmt
;
pSelect
->
hasAggFuncs
=
pSelect
->
hasAggFuncs
?
true
:
fmIsAggFunc
(
pFunc
->
funcId
);
pSelect
->
hasAggFuncs
=
pSelect
->
hasAggFuncs
?
true
:
fmIsAggFunc
(
pFunc
->
funcId
);
pSelect
->
hasRepeatScanFuncs
=
pSelect
->
hasRepeatScanFuncs
?
true
:
fmIsRepeatScanFunc
(
pFunc
->
funcId
);
pSelect
->
hasRepeatScanFuncs
=
pSelect
->
hasRepeatScanFuncs
?
true
:
fmIsRepeatScanFunc
(
pFunc
->
funcId
);
if
(
fmIsIndefiniteRowsFunc
(
pFunc
->
funcId
))
{
if
(
fmIsIndefiniteRowsFunc
(
pFunc
->
funcId
))
{
pSelect
->
hasIndefiniteRowsFunc
=
true
;
pSelect
->
hasIndefiniteRowsFunc
=
true
;
pSelect
->
returnRows
=
fmGetFuncReturnRows
(
pFunc
);
pSelect
->
returnRows
=
fmGetFuncReturnRows
(
pFunc
);
...
@@ -1822,6 +1833,9 @@ static int32_t translateNormalFunction(STranslateContext* pCxt, SFunctionNode* p
...
@@ -1822,6 +1833,9 @@ static int32_t translateNormalFunction(STranslateContext* pCxt, SFunctionNode* p
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
translateTimelineFunc
(
pCxt
,
pFunc
);
code
=
translateTimelineFunc
(
pCxt
,
pFunc
);
}
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
translateDateTimeFunc
(
pCxt
,
pFunc
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
translateBlockDistFunc
(
pCxt
,
pFunc
);
code
=
translateBlockDistFunc
(
pCxt
,
pFunc
);
}
}
...
...
source/libs/scalar/src/scalar.c
浏览文件 @
7414f28d
...
@@ -1038,11 +1038,22 @@ bool sclContainsAggFuncNode(SNode *pNode) {
...
@@ -1038,11 +1038,22 @@ bool sclContainsAggFuncNode(SNode *pNode) {
return
aggFunc
;
return
aggFunc
;
}
}
static
int8_t
sclGetOpValueNodeTsPrecision
(
SNode
*
pLeft
,
SNode
*
pRight
)
{
static
u
int8_t
sclGetOpValueNodeTsPrecision
(
SNode
*
pLeft
,
SNode
*
pRight
)
{
int8_t
lPrec
=
((
SExprNode
*
)
pLeft
)
->
resType
.
precision
;
u
int8_t
lPrec
=
((
SExprNode
*
)
pLeft
)
->
resType
.
precision
;
int8_t
rPrec
=
((
SExprNode
*
)
pRight
)
->
resType
.
precision
;
u
int8_t
rPrec
=
((
SExprNode
*
)
pRight
)
->
resType
.
precision
;
return
TMAX
(
lPrec
,
rPrec
);
uint8_t
lType
=
((
SExprNode
*
)
pLeft
)
->
resType
.
type
;
uint8_t
rType
=
((
SExprNode
*
)
pRight
)
->
resType
.
type
;
if
(
TSDB_DATA_TYPE_TIMESTAMP
==
lType
&&
TSDB_DATA_TYPE_TIMESTAMP
==
rType
)
{
return
TMAX
(
lPrec
,
rPrec
);
}
else
if
(
TSDB_DATA_TYPE_TIMESTAMP
==
lType
&&
TSDB_DATA_TYPE_TIMESTAMP
!=
rType
)
{
return
lPrec
;
}
else
if
(
TSDB_DATA_TYPE_TIMESTAMP
==
rType
&&
TSDB_DATA_TYPE_TIMESTAMP
!=
lType
)
{
return
rPrec
;
}
return
0
;
}
}
int32_t
sclConvertOpValueNodeTs
(
SOperatorNode
*
node
,
SScalarCtx
*
ctx
)
{
int32_t
sclConvertOpValueNodeTs
(
SOperatorNode
*
node
,
SScalarCtx
*
ctx
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录