Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
78f30314
T
TDengine
项目概览
慢慢CG
/
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看板
提交
78f30314
编写于
6月 15, 2021
作者:
Y
yihaoDeng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-3086]<feature> tag support timestamp
上级
5242a597
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
35 addition
and
12 deletion
+35
-12
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+27
-11
src/common/src/tvariant.c
src/common/src/tvariant.c
+4
-0
src/query/inc/sql.y
src/query/inc/sql.y
+1
-0
src/query/src/qExecutor.c
src/query/src/qExecutor.c
+3
-1
未找到文件。
src/client/src/tscSQLParser.c
浏览文件 @
78f30314
...
...
@@ -1276,7 +1276,7 @@ static bool validateTagParams(SArray* pTagsList, SArray* pFieldList, SSqlCmd* pC
const
char
*
msg1
=
"invalid number of tag columns"
;
const
char
*
msg2
=
"tag length too long"
;
const
char
*
msg3
=
"duplicated column names"
;
const
char
*
msg4
=
"timestamp not allowed in tags"
;
//
const char* msg4 = "timestamp not allowed in tags";
const
char
*
msg5
=
"invalid data type in tags"
;
const
char
*
msg6
=
"invalid tag name"
;
const
char
*
msg7
=
"invalid binary/nchar tag length"
;
...
...
@@ -1292,10 +1292,10 @@ static bool validateTagParams(SArray* pTagsList, SArray* pFieldList, SSqlCmd* pC
for
(
int32_t
i
=
0
;
i
<
numOfTags
;
++
i
)
{
TAOS_FIELD
*
p
=
taosArrayGet
(
pTagsList
,
i
);
if
(
p
->
type
==
TSDB_DATA_TYPE_TIMESTAMP
)
{
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg4
);
return
false
;
}
//
if (p->type == TSDB_DATA_TYPE_TIMESTAMP) {
//
invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg4);
//
return false;
//
}
if
(
!
isValidDataType
(
p
->
type
))
{
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg5
);
...
...
@@ -1353,7 +1353,7 @@ static bool validateTagParams(SArray* pTagsList, SArray* pFieldList, SSqlCmd* pC
* tags name /column name is truncated in sql.y
*/
bool
validateOneTags
(
SSqlCmd
*
pCmd
,
TAOS_FIELD
*
pTagField
)
{
const
char
*
msg1
=
"timestamp not allowed in tags"
;
//
const char* msg1 = "timestamp not allowed in tags";
const
char
*
msg2
=
"duplicated column names"
;
const
char
*
msg3
=
"tag length too long"
;
const
char
*
msg4
=
"invalid tag name"
;
...
...
@@ -1376,10 +1376,10 @@ bool validateOneTags(SSqlCmd* pCmd, TAOS_FIELD* pTagField) {
}
// no timestamp allowable
if
(
pTagField
->
type
==
TSDB_DATA_TYPE_TIMESTAMP
)
{
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg1
);
return
false
;
}
//
if (pTagField->type == TSDB_DATA_TYPE_TIMESTAMP) {
//
invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg1);
//
return false;
//
}
if
((
pTagField
->
type
<
TSDB_DATA_TYPE_BOOL
)
||
(
pTagField
->
type
>
TSDB_DATA_TYPE_UBIGINT
))
{
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg6
);
...
...
@@ -8001,8 +8001,24 @@ int32_t exprTreeFromSqlExpr(SSqlCmd* pCmd, tExprNode **pExpr, const tSqlExpr* pS
*
pExpr
=
calloc
(
1
,
sizeof
(
tExprNode
));
(
*
pExpr
)
->
nodeType
=
TSQL_NODE_VALUE
;
(
*
pExpr
)
->
pVal
=
calloc
(
1
,
sizeof
(
tVariant
));
tVariantAssign
((
*
pExpr
)
->
pVal
,
&
pSqlExpr
->
value
);
int32_t
type
=
-
1
;
STableMeta
*
pTableMeta
=
tscGetMetaInfo
(
pQueryInfo
,
0
)
->
pTableMeta
;
if
(
pCols
!=
NULL
)
{
SColIndex
*
idx
=
taosArrayGet
(
pCols
,
0
);
SSchema
*
pSchema
=
tscGetTableColumnSchema
(
pTableMeta
,
idx
->
colIndex
);
if
(
pSchema
!=
NULL
)
{
type
=
pSchema
->
type
;
}
}
if
(
type
==
TSDB_DATA_TYPE_TIMESTAMP
)
{
int32_t
ret
=
setColumnFilterInfoForTimestamp
(
pCmd
,
pQueryInfo
,
(
*
pExpr
)
->
pVal
);
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
return
ret
;
}
}
return
TSDB_CODE_SUCCESS
;
}
else
if
(
pSqlExpr
->
type
==
SQL_NODE_SQLFUNCTION
)
{
// arithmetic expression on the results of aggregation functions
...
...
src/common/src/tvariant.c
浏览文件 @
78f30314
...
...
@@ -77,6 +77,10 @@ void tVariantCreate(tVariant *pVar, SStrToken *token) {
pVar
->
nLen
=
strRmquote
(
pVar
->
pz
,
token
->
n
);
break
;
}
case
TSDB_DATA_TYPE_TIMESTAMP
:
{
pVar
->
i64
=
taosGetTimestamp
(
TSDB_TIME_PRECISION_NANO
);
break
;
}
default:
{
// nType == 0 means the null value
type
=
TSDB_DATA_TYPE_NULL
;
...
...
src/query/inc/sql.y
浏览文件 @
78f30314
...
...
@@ -433,6 +433,7 @@ tagitem(A) ::= FLOAT(X). { toTSDBType(X.type); tVariantCreate(&A, &X); }
tagitem(A) ::= STRING(X). { toTSDBType(X.type); tVariantCreate(&A, &X); }
tagitem(A) ::= BOOL(X). { toTSDBType(X.type); tVariantCreate(&A, &X); }
tagitem(A) ::= NULL(X). { X.type = 0; tVariantCreate(&A, &X); }
tagitem(A) ::= NOW(X). { X.type = TSDB_DATA_TYPE_TIMESTAMP; tVariantCreate(&A, &X);}
tagitem(A) ::= MINUS(X) INTEGER(Y).{
X.n += Y.n;
...
...
src/query/src/qExecutor.c
浏览文件 @
78f30314
...
...
@@ -2889,7 +2889,9 @@ void setTagValue(SOperatorInfo* pOperatorInfo, void *pTable, SQLFunctionCtx* pCt
doSetTagValueInParam
(
pTable
,
pLocalExprInfo
->
base
.
colInfo
.
colId
,
&
pCtx
[
idx
].
tag
,
pLocalExprInfo
->
base
.
resType
,
pLocalExprInfo
->
base
.
resBytes
);
if
(
IS_NUMERIC_TYPE
(
pLocalExprInfo
->
base
.
resType
)
||
pLocalExprInfo
->
base
.
resType
==
TSDB_DATA_TYPE_BOOL
)
{
if
(
IS_NUMERIC_TYPE
(
pLocalExprInfo
->
base
.
resType
)
||
pLocalExprInfo
->
base
.
resType
==
TSDB_DATA_TYPE_BOOL
||
pLocalExprInfo
->
base
.
resType
==
TSDB_DATA_TYPE_TIMESTAMP
)
{
memcpy
(
pRuntimeEnv
->
tagVal
+
offset
,
&
pCtx
[
idx
].
tag
.
i64
,
pLocalExprInfo
->
base
.
resBytes
);
}
else
{
memcpy
(
pRuntimeEnv
->
tagVal
+
offset
,
pCtx
[
idx
].
tag
.
pz
,
pCtx
[
idx
].
tag
.
nLen
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录