Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
2bf2d5e6
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看板
提交
2bf2d5e6
编写于
8月 17, 2022
作者:
wmmhello
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix:error in get table list by tag filter
上级
d5a8b397
变更
4
展开全部
隐藏空白更改
内联
并排
Showing
4 changed file
with
336 addition
and
13 deletion
+336
-13
source/dnode/vnode/src/meta/metaQuery.c
source/dnode/vnode/src/meta/metaQuery.c
+15
-5
source/libs/executor/src/executil.c
source/libs/executor/src/executil.c
+23
-6
source/libs/scalar/src/sclvector.c
source/libs/scalar/src/sclvector.c
+3
-2
tests/system-test/2-query/json_tag.py
tests/system-test/2-query/json_tag.py
+295
-0
未找到文件。
source/dnode/vnode/src/meta/metaQuery.c
浏览文件 @
2bf2d5e6
...
@@ -965,10 +965,11 @@ END:
...
@@ -965,10 +965,11 @@ END:
int32_t
metaGetTableTags
(
SMeta
*
pMeta
,
uint64_t
suid
,
SArray
*
uidList
,
SArray
*
tags
)
{
int32_t
metaGetTableTags
(
SMeta
*
pMeta
,
uint64_t
suid
,
SArray
*
uidList
,
SArray
*
tags
)
{
SMCtbCursor
*
pCur
=
metaOpenCtbCursor
(
pMeta
,
suid
);
SMCtbCursor
*
pCur
=
metaOpenCtbCursor
(
pMeta
,
suid
);
SHashObj
*
uHash
=
taosHashInit
(
32
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_BIGINT
),
false
,
HASH_NO_LOCK
);
SHashObj
*
uHash
=
NULL
;
size_t
len
=
taosArrayGetSize
(
uidList
);
size_t
len
=
taosArrayGetSize
(
uidList
);
// len > 0 means there already have uids
if
(
len
>
0
)
{
if
(
len
>
0
){
for
(
int
i
=
0
;
i
<
len
;
i
++
)
{
uHash
=
taosHashInit
(
32
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_BIGINT
),
true
,
HASH_NO_LOCK
);
for
(
int
i
=
0
;
i
<
len
;
i
++
){
int64_t
*
uid
=
taosArrayGet
(
uidList
,
i
);
int64_t
*
uid
=
taosArrayGet
(
uidList
,
i
);
taosHashPut
(
uHash
,
uid
,
sizeof
(
int64_t
),
&
i
,
sizeof
(
i
));
taosHashPut
(
uHash
,
uid
,
sizeof
(
int64_t
),
&
i
,
sizeof
(
i
));
}
}
...
@@ -985,13 +986,22 @@ int32_t metaGetTableTags(SMeta *pMeta, uint64_t suid, SArray *uidList, SArray *t
...
@@ -985,13 +986,22 @@ int32_t metaGetTableTags(SMeta *pMeta, uint64_t suid, SArray *uidList, SArray *t
void
*
tag
=
taosMemoryMalloc
(
pCur
->
vLen
);
void
*
tag
=
taosMemoryMalloc
(
pCur
->
vLen
);
memcpy
(
tag
,
pCur
->
pVal
,
pCur
->
vLen
);
memcpy
(
tag
,
pCur
->
pVal
,
pCur
->
vLen
);
taosArrayPush
(
tags
,
&
tag
);
if
(
len
==
0
)
{
if
(
len
==
0
)
{
taosArrayPush
(
uidList
,
&
id
);
taosArrayPush
(
uidList
,
&
id
);
taosArrayPush
(
tags
,
&
tag
);
}
else
{
taosHashPut
(
uHash
,
&
id
,
sizeof
(
int64_t
),
&
tag
,
POINTER_BYTES
);
}
}
}
}
for
(
int
i
=
0
;
i
<
len
;
i
++
){
int64_t
*
uid
=
taosArrayGet
(
uidList
,
i
);
void
**
tag
=
taosHashGet
(
uHash
,
uid
,
POINTER_BYTES
);
taosArrayPush
(
tags
,
tag
);
}
taosHashCleanup
(
uHash
);
taosHashCleanup
(
uHash
);
metaCloseCtbCursor
(
pCur
);
metaCloseCtbCursor
(
pCur
);
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
...
...
source/libs/executor/src/executil.c
浏览文件 @
2bf2d5e6
...
@@ -321,6 +321,8 @@ static EDealRes getColumn(SNode** pNode, void* pContext) {
...
@@ -321,6 +321,8 @@ static EDealRes getColumn(SNode** pNode, void* pContext) {
pSColumnNode
->
node
.
resType
.
bytes
=
TSDB_TABLE_FNAME_LEN
-
1
+
VARSTR_HEADER_SIZE
;
pSColumnNode
->
node
.
resType
.
bytes
=
TSDB_TABLE_FNAME_LEN
-
1
+
VARSTR_HEADER_SIZE
;
nodesDestroyNode
(
*
pNode
);
nodesDestroyNode
(
*
pNode
);
*
pNode
=
(
SNode
*
)
pSColumnNode
;
*
pNode
=
(
SNode
*
)
pSColumnNode
;
}
else
{
return
DEAL_RES_CONTINUE
;
}
}
}
else
{
}
else
{
return
DEAL_RES_CONTINUE
;
return
DEAL_RES_CONTINUE
;
...
@@ -423,11 +425,16 @@ static SColumnInfoData* getColInfoResult(void* metaHandle, uint64_t suid, SArray
...
@@ -423,11 +425,16 @@ static SColumnInfoData* getColInfoResult(void* metaHandle, uint64_t suid, SArray
int64_t
*
uid
=
taosArrayGet
(
uidList
,
i
);
int64_t
*
uid
=
taosArrayGet
(
uidList
,
i
);
for
(
int32_t
j
=
0
;
j
<
taosArrayGetSize
(
pResBlock
->
pDataBlock
);
j
++
){
for
(
int32_t
j
=
0
;
j
<
taosArrayGetSize
(
pResBlock
->
pDataBlock
);
j
++
){
SColumnInfoData
*
pColInfo
=
(
SColumnInfoData
*
)
taosArrayGet
(
pResBlock
->
pDataBlock
,
j
);
SColumnInfoData
*
pColInfo
=
(
SColumnInfoData
*
)
taosArrayGet
(
pResBlock
->
pDataBlock
,
j
);
char
str
[
TSDB_TABLE_FNAME_LEN
+
VARSTR_HEADER_SIZE
]
=
{
0
};
metaGetTableNameByUid
(
metaHandle
,
*
uid
,
str
);
colDataAppend
(
pColInfo
,
i
,
str
,
false
);
if
(
pColInfo
->
info
.
colId
==
-
1
){
// tbname
if
(
pColInfo
->
info
.
colId
==
-
1
){
// tbname
char
str
[
TSDB_TABLE_FNAME_LEN
+
VARSTR_HEADER_SIZE
]
=
{
0
};
//
char str[TSDB_TABLE_FNAME_LEN + VARSTR_HEADER_SIZE] = {0};
metaGetTableNameByUid
(
metaHandle
,
*
uid
,
str
);
//
metaGetTableNameByUid(metaHandle, *uid, str);
colDataAppend
(
pColInfo
,
i
,
str
,
false
);
//
colDataAppend(pColInfo, i, str, false);
qDebug
(
"tbnameget
uid:%ld, tbname:%s"
,
*
uid
,
str
+
2
);
// qDebug("tagfilter
uid:%ld, tbname:%s", *uid, str+2);
}
else
{
}
else
{
STagVal
tagVal
=
{
0
};
STagVal
tagVal
=
{
0
};
tagVal
.
cid
=
pColInfo
->
info
.
colId
;
tagVal
.
cid
=
pColInfo
->
info
.
colId
;
...
@@ -445,6 +452,16 @@ static SColumnInfoData* getColInfoResult(void* metaHandle, uint64_t suid, SArray
...
@@ -445,6 +452,16 @@ static SColumnInfoData* getColInfoResult(void* metaHandle, uint64_t suid, SArray
taosMemoryFree
(
tmp
);
taosMemoryFree
(
tmp
);
}
else
{
}
else
{
colDataAppend
(
pColInfo
,
i
,
(
const
char
*
)
&
tagVal
.
i64
,
false
);
colDataAppend
(
pColInfo
,
i
,
(
const
char
*
)
&
tagVal
.
i64
,
false
);
if
(
pColInfo
->
info
.
type
==
TSDB_DATA_TYPE_TINYINT
){
int8_t
tint
=
*
(
int8_t
*
)(
&
tagVal
.
i64
);
qDebug
(
"tagfilter uid:%ld, tbname:%s, tint:%d"
,
*
uid
,
str
+
2
,
tint
);
}
else
if
(
pColInfo
->
info
.
type
==
TSDB_DATA_TYPE_INT
){
int
nint
=
*
(
int
*
)(
&
tagVal
.
i64
);
qDebug
(
"tagfilter uid:%ld, tbname:%s nint:+%d"
,
*
uid
,
str
+
2
,
nint
);
}
}
}
}
}
}
}
...
@@ -529,7 +546,7 @@ int32_t getTableList(void* metaHandle, void* pVnode, SScanPhysiNode* pScanNode,
...
@@ -529,7 +546,7 @@ int32_t getTableList(void* metaHandle, void* pVnode, SScanPhysiNode* pScanNode,
void
*
var
=
POINTER_SHIFT
(
pColInfoData
->
pData
,
j
*
pColInfoData
->
info
.
bytes
);
void
*
var
=
POINTER_SHIFT
(
pColInfoData
->
pData
,
j
*
pColInfoData
->
info
.
bytes
);
int64_t
*
uid
=
taosArrayGet
(
res
,
i
);
int64_t
*
uid
=
taosArrayGet
(
res
,
i
);
qDebug
(
"t
bnameget
get uid:%ld, res:%d"
,
*
uid
,
*
(
bool
*
)
var
);
qDebug
(
"t
agfilter
get uid:%ld, res:%d"
,
*
uid
,
*
(
bool
*
)
var
);
if
(
*
(
bool
*
)
var
==
false
)
{
if
(
*
(
bool
*
)
var
==
false
)
{
taosArrayRemove
(
res
,
i
);
taosArrayRemove
(
res
,
i
);
j
++
;
j
++
;
...
@@ -545,7 +562,7 @@ int32_t getTableList(void* metaHandle, void* pVnode, SScanPhysiNode* pScanNode,
...
@@ -545,7 +562,7 @@ int32_t getTableList(void* metaHandle, void* pVnode, SScanPhysiNode* pScanNode,
for
(
int
i
=
0
;
i
<
taosArrayGetSize
(
res
);
i
++
)
{
for
(
int
i
=
0
;
i
<
taosArrayGetSize
(
res
);
i
++
)
{
STableKeyInfo
info
=
{.
uid
=
*
(
uint64_t
*
)
taosArrayGet
(
res
,
i
),
.
groupId
=
0
};
STableKeyInfo
info
=
{.
uid
=
*
(
uint64_t
*
)
taosArrayGet
(
res
,
i
),
.
groupId
=
0
};
taosArrayPush
(
pListInfo
->
pTableList
,
&
info
);
taosArrayPush
(
pListInfo
->
pTableList
,
&
info
);
qDebug
(
"t
bnameget
get uid:%ld"
,
info
.
uid
);
qDebug
(
"t
agfilter
get uid:%ld"
,
info
.
uid
);
}
}
taosArrayDestroy
(
res
);
taosArrayDestroy
(
res
);
...
...
source/libs/scalar/src/sclvector.c
浏览文件 @
2bf2d5e6
...
@@ -1672,8 +1672,9 @@ void vectorBitOr(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam *pOut,
...
@@ -1672,8 +1672,9 @@ void vectorBitOr(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam *pOut,
colDataAppendInt8(pOut->columnData, i, (int8_t*)&result);\
colDataAppendInt8(pOut->columnData, i, (int8_t*)&result);\
}else{\
}else{\
bool res = filterDoCompare(fp, optr, pLeftData, pRightData);\
bool res = filterDoCompare(fp, optr, pLeftData, pRightData);\
colDataAppendInt8(pOut->columnData, i, (int8_t*)&res);\
colDataAppendInt8(pOut->columnData, i, (int8_t*)&res); \
}\
if(GET_PARAM_TYPE(pLeft) == TSDB_DATA_TYPE_BIGINT){qDebug("tagfilter left:%d, right:%d, res:%d", *(int64_t*)(pLeftData), *(int64_t*)(pRightData), res);} \
} \
if(freeLeft) taosMemoryFreeClear(pLeftData);\
if(freeLeft) taosMemoryFreeClear(pLeftData);\
if(freeRight) taosMemoryFreeClear(pRightData);\
if(freeRight) taosMemoryFreeClear(pRightData);\
}
}
...
...
tests/system-test/2-query/json_tag.py
浏览文件 @
2bf2d5e6
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录