Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
a90cc0ae
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1192
Star
22018
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看板
提交
a90cc0ae
编写于
5月 28, 2022
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
差异文件
Merge branch '3.0' of
https://github.com/taosdata/TDengine
into feat/row_refact
上级
4ed29dbf
9c8ad8a1
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
80 addition
and
47 deletion
+80
-47
source/common/src/ttime.c
source/common/src/ttime.c
+2
-2
source/dnode/vnode/src/meta/metaQuery.c
source/dnode/vnode/src/meta/metaQuery.c
+40
-32
source/libs/function/src/builtins.c
source/libs/function/src/builtins.c
+35
-9
source/libs/function/src/builtinsimpl.c
source/libs/function/src/builtinsimpl.c
+1
-1
source/libs/scalar/src/sclfunc.c
source/libs/scalar/src/sclfunc.c
+2
-3
未找到文件。
source/common/src/ttime.c
浏览文件 @
a90cc0ae
...
@@ -528,14 +528,14 @@ int32_t convertStringToTimestamp(int16_t type, char *inputData, int64_t timePrec
...
@@ -528,14 +528,14 @@ int32_t convertStringToTimestamp(int16_t type, char *inputData, int64_t timePrec
}
}
taosMemoryFree
(
newColData
);
taosMemoryFree
(
newColData
);
}
else
if
(
type
==
TSDB_DATA_TYPE_NCHAR
)
{
}
else
if
(
type
==
TSDB_DATA_TYPE_NCHAR
)
{
newColData
=
taosMemoryCalloc
(
1
,
charLen
/
TSDB_NCHAR_SIZE
+
1
);
newColData
=
taosMemoryCalloc
(
1
,
charLen
+
TSDB_NCHAR_SIZE
);
int
len
=
taosUcs4ToMbs
((
TdUcs4
*
)
varDataVal
(
inputData
),
charLen
,
newColData
);
int
len
=
taosUcs4ToMbs
((
TdUcs4
*
)
varDataVal
(
inputData
),
charLen
,
newColData
);
if
(
len
<
0
){
if
(
len
<
0
){
taosMemoryFree
(
newColData
);
taosMemoryFree
(
newColData
);
return
TSDB_CODE_FAILED
;
return
TSDB_CODE_FAILED
;
}
}
newColData
[
len
]
=
0
;
newColData
[
len
]
=
0
;
bool
ret
=
taosParseTime
(
newColData
,
timeVal
,
len
+
1
,
(
int32_t
)
timePrec
,
tsDaylight
);
int32_t
ret
=
taosParseTime
(
newColData
,
timeVal
,
len
+
1
,
(
int32_t
)
timePrec
,
tsDaylight
);
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
taosMemoryFree
(
newColData
);
taosMemoryFree
(
newColData
);
return
ret
;
return
ret
;
...
...
source/dnode/vnode/src/meta/metaQuery.c
浏览文件 @
a90cc0ae
...
@@ -155,44 +155,52 @@ int metaTbCursorNext(SMTbCursor *pTbCur) {
...
@@ -155,44 +155,52 @@ int metaTbCursorNext(SMTbCursor *pTbCur) {
}
}
SSchemaWrapper
*
metaGetTableSchema
(
SMeta
*
pMeta
,
tb_uid_t
uid
,
int32_t
sver
,
bool
isinline
)
{
SSchemaWrapper
*
metaGetTableSchema
(
SMeta
*
pMeta
,
tb_uid_t
uid
,
int32_t
sver
,
bool
isinline
)
{
void
*
pKey
=
NULL
;
void
*
pData
=
NULL
;
void
*
pVal
=
NULL
;
int
nData
=
0
;
int
kLen
=
0
;
int64_t
version
;
int
vLen
=
0
;
SSchemaWrapper
schema
=
{
0
};
int
ret
;
SSchemaWrapper
*
pSchema
=
NULL
;
SSkmDbKey
skmDbKey
;
SDecoder
dc
=
{
0
};
SSchemaWrapper
*
pSW
=
NULL
;
SSchema
*
pSchema
=
NULL
;
void
*
pBuf
;
SDecoder
coder
=
{
0
};
// fetch
skmDbKey
.
uid
=
uid
;
skmDbKey
.
sver
=
sver
;
pKey
=
&
skmDbKey
;
kLen
=
sizeof
(
skmDbKey
);
metaRLock
(
pMeta
);
metaRLock
(
pMeta
);
ret
=
tdbTbGet
(
pMeta
->
pSkmDb
,
pKey
,
kLen
,
&
pVal
,
&
vLen
);
if
(
sver
<
0
)
{
metaULock
(
pMeta
);
if
(
tdbTbGet
(
pMeta
->
pUidIdx
,
&
uid
,
sizeof
(
uid
),
&
pData
,
&
nData
)
<
0
)
{
if
(
ret
<
0
)
{
goto
_err
;
return
NULL
;
}
}
// decode
version
=
*
(
int64_t
*
)
pData
;
pBuf
=
pVal
;
pSW
=
taosMemoryMalloc
(
sizeof
(
SSchemaWrapper
)
);
tdbTbGet
(
pMeta
->
pTbDb
,
&
(
STbDbKey
){.
uid
=
uid
,
.
version
=
version
},
sizeof
(
STbDbKey
),
&
pData
,
&
nData
);
tDecoderInit
(
&
coder
,
pVal
,
vLen
);
SMetaEntry
me
=
{
0
};
tDecodeSSchemaWrapper
(
&
coder
,
pSW
);
tDecoderInit
(
&
dc
,
pData
,
nData
);
pSchema
=
taosMemoryMalloc
(
sizeof
(
SSchema
)
*
pSW
->
nCols
);
metaDecodeEntry
(
&
dc
,
&
me
);
memcpy
(
pSchema
,
pSW
->
pSchema
,
sizeof
(
SSchema
)
*
pSW
->
nCols
);
if
(
me
.
type
==
TSDB_SUPER_TABLE
)
{
tDecoderClear
(
&
coder
);
pSchema
=
tCloneSSchemaWrapper
(
&
me
.
stbEntry
.
schemaRow
);
}
else
if
(
me
.
type
==
TSDB_NORMAL_TABLE
)
{
}
else
{
ASSERT
(
0
);
}
tDecoderClear
(
&
dc
);
}
else
{
if
(
tdbTbGet
(
pMeta
->
pSkmDb
,
&
(
SSkmDbKey
){.
uid
=
uid
,
.
sver
=
sver
},
sizeof
(
SSkmDbKey
),
&
pData
,
&
nData
)
<
0
)
{
goto
_err
;
}
pSW
->
pSchema
=
pSchema
;
tDecoderInit
(
&
dc
,
pData
,
nData
);
tDecodeSSchemaWrapper
(
&
dc
,
&
schema
);
pSchema
=
tCloneSSchemaWrapper
(
&
schema
);
tDecoderClear
(
&
dc
);
}
tdbFree
(
pVal
);
metaULock
(
pMeta
);
tdbFree
(
pData
);
return
pSchema
;
return
pSW
;
_err:
metaULock
(
pMeta
);
tdbFree
(
pData
);
return
NULL
;
}
}
struct
SMCtbCursor
{
struct
SMCtbCursor
{
...
...
source/libs/function/src/builtins.c
浏览文件 @
a90cc0ae
...
@@ -156,6 +156,14 @@ static int32_t translatePercentile(SFunctionNode* pFunc, char* pErrBuf, int32_t
...
@@ -156,6 +156,14 @@ static int32_t translatePercentile(SFunctionNode* pFunc, char* pErrBuf, int32_t
return
invaildFuncParaNumErrMsg
(
pErrBuf
,
len
,
pFunc
->
functionName
);
return
invaildFuncParaNumErrMsg
(
pErrBuf
,
len
,
pFunc
->
functionName
);
}
}
//param0
SNode
*
pParamNode0
=
nodesListGetNode
(
pFunc
->
pParameterList
,
0
);
if
(
nodeType
(
pParamNode0
)
!=
QUERY_NODE_COLUMN
)
{
return
buildFuncErrMsg
(
pErrBuf
,
len
,
TSDB_CODE_FUNC_FUNTION_ERROR
,
"The first parameter of PERCENTILE function can only be column"
);
}
//param1
SValueNode
*
pValue
=
(
SValueNode
*
)
nodesListGetNode
(
pFunc
->
pParameterList
,
1
);
SValueNode
*
pValue
=
(
SValueNode
*
)
nodesListGetNode
(
pFunc
->
pParameterList
,
1
);
if
(
pValue
->
datum
.
i
<
0
||
pValue
->
datum
.
i
>
100
)
{
if
(
pValue
->
datum
.
i
<
0
||
pValue
->
datum
.
i
>
100
)
{
...
@@ -170,6 +178,7 @@ static int32_t translatePercentile(SFunctionNode* pFunc, char* pErrBuf, int32_t
...
@@ -170,6 +178,7 @@ static int32_t translatePercentile(SFunctionNode* pFunc, char* pErrBuf, int32_t
return
invaildFuncParaTypeErrMsg
(
pErrBuf
,
len
,
pFunc
->
functionName
);
return
invaildFuncParaTypeErrMsg
(
pErrBuf
,
len
,
pFunc
->
functionName
);
}
}
//set result type
pFunc
->
node
.
resType
=
(
SDataType
){.
bytes
=
tDataTypes
[
TSDB_DATA_TYPE_DOUBLE
].
bytes
,
.
type
=
TSDB_DATA_TYPE_DOUBLE
};
pFunc
->
node
.
resType
=
(
SDataType
){.
bytes
=
tDataTypes
[
TSDB_DATA_TYPE_DOUBLE
].
bytes
,
.
type
=
TSDB_DATA_TYPE_DOUBLE
};
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
...
@@ -188,30 +197,47 @@ static int32_t translateApercentile(SFunctionNode* pFunc, char* pErrBuf, int32_t
...
@@ -188,30 +197,47 @@ static int32_t translateApercentile(SFunctionNode* pFunc, char* pErrBuf, int32_t
return
invaildFuncParaNumErrMsg
(
pErrBuf
,
len
,
pFunc
->
functionName
);
return
invaildFuncParaNumErrMsg
(
pErrBuf
,
len
,
pFunc
->
functionName
);
}
}
uint8_t
para1Type
=
((
SExprNode
*
)
nodesListGetNode
(
pFunc
->
pParameterList
,
0
))
->
resType
.
type
;
//param0
uint8_t
para2Type
=
((
SExprNode
*
)
nodesListGetNode
(
pFunc
->
pParameterList
,
1
))
->
resType
.
type
;
SNode
*
pParamNode0
=
nodesListGetNode
(
pFunc
->
pParameterList
,
0
);
if
(
!
IS_NUMERIC_TYPE
(
para1Type
)
||
!
IS_INTEGER_TYPE
(
para2Type
))
{
if
(
nodeType
(
pParamNode0
)
!=
QUERY_NODE_COLUMN
)
{
return
invaildFuncParaTypeErrMsg
(
pErrBuf
,
len
,
pFunc
->
functionName
);
return
buildFuncErrMsg
(
pErrBuf
,
len
,
TSDB_CODE_FUNC_FUNTION_ERROR
,
"The first parameter of APERCENTILE function can only be column"
);
}
}
SNode
*
pParamNode
=
nodesListGetNode
(
pFunc
->
pParameterList
,
1
);
//param1
if
(
nodeType
(
pParamNode
)
!=
QUERY_NODE_VALUE
)
{
SNode
*
pParamNode1
=
nodesListGetNode
(
pFunc
->
pParameterList
,
1
);
if
(
nodeType
(
pParamNode1
)
!=
QUERY_NODE_VALUE
)
{
return
invaildFuncParaTypeErrMsg
(
pErrBuf
,
len
,
pFunc
->
functionName
);
return
invaildFuncParaTypeErrMsg
(
pErrBuf
,
len
,
pFunc
->
functionName
);
}
}
SValueNode
*
pValue
=
(
SValueNode
*
)
pParamNode
;
SValueNode
*
pValue
=
(
SValueNode
*
)
pParamNode
1
;
if
(
pValue
->
datum
.
i
<
0
||
pValue
->
datum
.
i
>
100
)
{
if
(
pValue
->
datum
.
i
<
0
||
pValue
->
datum
.
i
>
100
)
{
return
invaildFuncParaValueErrMsg
(
pErrBuf
,
len
,
pFunc
->
functionName
);
return
invaildFuncParaValueErrMsg
(
pErrBuf
,
len
,
pFunc
->
functionName
);
}
}
pValue
->
notReserved
=
true
;
pValue
->
notReserved
=
true
;
uint8_t
para1Type
=
((
SExprNode
*
)
nodesListGetNode
(
pFunc
->
pParameterList
,
0
))
->
resType
.
type
;
uint8_t
para2Type
=
((
SExprNode
*
)
nodesListGetNode
(
pFunc
->
pParameterList
,
1
))
->
resType
.
type
;
if
(
!
IS_NUMERIC_TYPE
(
para1Type
)
||
!
IS_INTEGER_TYPE
(
para2Type
))
{
return
invaildFuncParaTypeErrMsg
(
pErrBuf
,
len
,
pFunc
->
functionName
);
}
//param2
if
(
3
==
numOfParams
)
{
if
(
3
==
numOfParams
)
{
SNode
*
pPara3
=
nodesListGetNode
(
pFunc
->
pParameterList
,
2
);
uint8_t
para3Type
=
((
SExprNode
*
)
nodesListGetNode
(
pFunc
->
pParameterList
,
2
))
->
resType
.
type
;
if
(
QUERY_NODE_VALUE
!=
nodeType
(
pPara3
)
||
!
validAperventileAlgo
((
SValueNode
*
)
pPara3
))
{
if
(
!
IS_VAR_DATA_TYPE
(
para3Type
))
{
return
invaildFuncParaTypeErrMsg
(
pErrBuf
,
len
,
pFunc
->
functionName
);
}
SNode
*
pParamNode2
=
nodesListGetNode
(
pFunc
->
pParameterList
,
2
);
if
(
QUERY_NODE_VALUE
!=
nodeType
(
pParamNode2
)
||
!
validAperventileAlgo
((
SValueNode
*
)
pParamNode2
))
{
return
buildFuncErrMsg
(
pErrBuf
,
len
,
TSDB_CODE_FUNC_FUNTION_ERROR
,
return
buildFuncErrMsg
(
pErrBuf
,
len
,
TSDB_CODE_FUNC_FUNTION_ERROR
,
"Third parameter algorithm of apercentile must be 'default' or 't-digest'"
);
"Third parameter algorithm of apercentile must be 'default' or 't-digest'"
);
}
}
pValue
=
(
SValueNode
*
)
pParamNode2
;
pValue
->
notReserved
=
true
;
}
}
pFunc
->
node
.
resType
=
(
SDataType
){.
bytes
=
tDataTypes
[
TSDB_DATA_TYPE_DOUBLE
].
bytes
,
.
type
=
TSDB_DATA_TYPE_DOUBLE
};
pFunc
->
node
.
resType
=
(
SDataType
){.
bytes
=
tDataTypes
[
TSDB_DATA_TYPE_DOUBLE
].
bytes
,
.
type
=
TSDB_DATA_TYPE_DOUBLE
};
...
...
source/libs/function/src/builtinsimpl.c
浏览文件 @
a90cc0ae
...
@@ -1965,7 +1965,7 @@ bool apercentileFunctionSetup(SqlFunctionCtx* pCtx, SResultRowEntryInfo* pResult
...
@@ -1965,7 +1965,7 @@ bool apercentileFunctionSetup(SqlFunctionCtx* pCtx, SResultRowEntryInfo* pResult
if
(
pCtx
->
numOfParams
==
2
)
{
if
(
pCtx
->
numOfParams
==
2
)
{
pInfo
->
algo
=
APERCT_ALGO_DEFAULT
;
pInfo
->
algo
=
APERCT_ALGO_DEFAULT
;
}
else
if
(
pCtx
->
numOfParams
==
3
)
{
}
else
if
(
pCtx
->
numOfParams
==
3
)
{
pInfo
->
algo
=
getApercentileAlgo
(
pCtx
->
param
[
2
].
param
.
pz
);
pInfo
->
algo
=
getApercentileAlgo
(
varDataVal
(
pCtx
->
param
[
2
].
param
.
pz
)
);
if
(
pInfo
->
algo
==
APERCT_ALGO_UNKNOWN
)
{
if
(
pInfo
->
algo
==
APERCT_ALGO_UNKNOWN
)
{
return
false
;
return
false
;
}
}
...
...
source/libs/scalar/src/sclfunc.c
浏览文件 @
a90cc0ae
...
@@ -925,11 +925,10 @@ int32_t toUnixtimestampFunction(SScalarParam *pInput, int32_t inputNum, SScalarP
...
@@ -925,11 +925,10 @@ int32_t toUnixtimestampFunction(SScalarParam *pInput, int32_t inputNum, SScalarP
int32_t
ret
=
convertStringToTimestamp
(
type
,
input
,
timePrec
,
&
timeVal
);
int32_t
ret
=
convertStringToTimestamp
(
type
,
input
,
timePrec
,
&
timeVal
);
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
colDataAppendNULL
(
pOutput
->
columnData
,
i
);
colDataAppendNULL
(
pOutput
->
columnData
,
i
);
continue
;
}
else
{
}
colDataAppend
(
pOutput
->
columnData
,
i
,
(
char
*
)
&
timeVal
,
false
);
colDataAppend
(
pOutput
->
columnData
,
i
,
(
char
*
)
&
timeVal
,
false
);
}
}
}
pOutput
->
numOfRows
=
pInput
->
numOfRows
;
pOutput
->
numOfRows
=
pInput
->
numOfRows
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录