Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
461cd037
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看板
提交
461cd037
编写于
6月 06, 2022
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
差异文件
Merge branch '3.0' of
https://github.com/taosdata/TDengine
into feat/row_refact
上级
f81d1027
10e48241
变更
31
展开全部
显示空白变更内容
内联
并排
Showing
31 changed file
with
770 addition
and
430 deletion
+770
-430
cmake/cmake.options
cmake/cmake.options
+1
-1
include/client/taos.h
include/client/taos.h
+19
-19
include/common/tdatablock.h
include/common/tdatablock.h
+3
-9
include/libs/index/index.h
include/libs/index/index.h
+2
-1
include/util/tdef.h
include/util/tdef.h
+1
-1
source/common/src/tdatablock.c
source/common/src/tdatablock.c
+1
-1
source/dnode/vnode/inc/vnode.h
source/dnode/vnode/inc/vnode.h
+10
-9
source/dnode/vnode/src/inc/meta.h
source/dnode/vnode/src/inc/meta.h
+5
-6
source/dnode/vnode/src/inc/vnodeInt.h
source/dnode/vnode/src/inc/vnodeInt.h
+1
-0
source/dnode/vnode/src/meta/metaOpen.c
source/dnode/vnode/src/meta/metaOpen.c
+0
-6
source/dnode/vnode/src/meta/metaSma.c
source/dnode/vnode/src/meta/metaSma.c
+4
-4
source/dnode/vnode/src/meta/metaTable.c
source/dnode/vnode/src/meta/metaTable.c
+69
-24
source/dnode/vnode/src/tsdb/tsdbRead.c
source/dnode/vnode/src/tsdb/tsdbRead.c
+6
-0
source/libs/executor/src/executorimpl.c
source/libs/executor/src/executorimpl.c
+3
-2
source/libs/index/src/index.c
source/libs/index/src/index.c
+2
-2
source/libs/index/src/indexComm.c
source/libs/index/src/indexComm.c
+4
-4
source/libs/index/src/indexFilter.c
source/libs/index/src/indexFilter.c
+84
-37
source/libs/index/test/indexTests.cc
source/libs/index/test/indexTests.cc
+65
-48
source/libs/index/test/jsonUT.cc
source/libs/index/test/jsonUT.cc
+77
-65
source/libs/nodes/src/nodesUtilFuncs.c
source/libs/nodes/src/nodesUtilFuncs.c
+1
-1
source/libs/parser/inc/sql.y
source/libs/parser/inc/sql.y
+1
-1
source/libs/parser/src/sql.c
source/libs/parser/src/sql.c
+1
-1
source/libs/scalar/inc/filterInt.h
source/libs/scalar/inc/filterInt.h
+1
-1
source/libs/scalar/src/filter.c
source/libs/scalar/src/filter.c
+3
-2
source/libs/scalar/src/sclvector.c
source/libs/scalar/src/sclvector.c
+87
-66
source/libs/scalar/test/scalar/scalarTests.cpp
source/libs/scalar/test/scalar/scalarTests.cpp
+235
-53
tests/pytest/util/dnodes.py
tests/pytest/util/dnodes.py
+1
-1
tests/system-test/0-others/udf_create.py
tests/system-test/0-others/udf_create.py
+35
-27
tests/system-test/0-others/udf_restart_taosd.py
tests/system-test/0-others/udf_restart_taosd.py
+35
-27
tests/system-test/2-query/json_tag.py
tests/system-test/2-query/json_tag.py
+10
-10
tests/system-test/fulltest.bat
tests/system-test/fulltest.bat
+3
-1
未找到文件。
cmake/cmake.options
浏览文件 @
461cd037
...
...
@@ -146,6 +146,6 @@ option(
option(
BUILD_WITH_INVERTEDINDEX
"If use invertedIndex"
O
FF
O
N
)
include/client/taos.h
浏览文件 @
461cd037
...
...
@@ -103,10 +103,10 @@ typedef void (*__taos_async_fn_t)(void *param, TAOS_RES *, int code);
typedef
struct
TAOS_MULTI_BIND
{
int
buffer_type
;
void
*
buffer
;
void
*
buffer
;
uintptr_t
buffer_length
;
int32_t
*
length
;
char
*
is_null
;
int32_t
*
length
;
char
*
is_null
;
int
num
;
}
TAOS_MULTI_BIND
;
...
...
@@ -157,7 +157,7 @@ DLL_EXPORT int taos_stmt_add_batch(TAOS_STMT *stmt);
DLL_EXPORT
int
taos_stmt_execute
(
TAOS_STMT
*
stmt
);
DLL_EXPORT
TAOS_RES
*
taos_stmt_use_result
(
TAOS_STMT
*
stmt
);
DLL_EXPORT
int
taos_stmt_close
(
TAOS_STMT
*
stmt
);
DLL_EXPORT
char
*
taos_stmt_errstr
(
TAOS_STMT
*
stmt
);
DLL_EXPORT
char
*
taos_stmt_errstr
(
TAOS_STMT
*
stmt
);
DLL_EXPORT
int
taos_stmt_affected_rows
(
TAOS_STMT
*
stmt
);
DLL_EXPORT
int
taos_stmt_affected_rows_once
(
TAOS_STMT
*
stmt
);
...
...
@@ -179,7 +179,7 @@ DLL_EXPORT bool taos_is_update_query(TAOS_RES *res);
DLL_EXPORT
int
taos_fetch_block
(
TAOS_RES
*
res
,
TAOS_ROW
*
rows
);
DLL_EXPORT
int
taos_fetch_block_s
(
TAOS_RES
*
res
,
int
*
numOfRows
,
TAOS_ROW
*
rows
);
DLL_EXPORT
int
taos_fetch_raw_block
(
TAOS_RES
*
res
,
int
*
numOfRows
,
void
**
pData
);
DLL_EXPORT
int
*
taos_get_column_data_offset
(
TAOS_RES
*
res
,
int
columnIndex
);
DLL_EXPORT
int
*
taos_get_column_data_offset
(
TAOS_RES
*
res
,
int
columnIndex
);
DLL_EXPORT
int
taos_validate_sql
(
TAOS
*
taos
,
const
char
*
sql
);
DLL_EXPORT
void
taos_reset_current_db
(
TAOS
*
taos
);
...
...
@@ -229,7 +229,7 @@ DLL_EXPORT tmq_list_t *tmq_list_new();
DLL_EXPORT
int32_t
tmq_list_append
(
tmq_list_t
*
,
const
char
*
);
DLL_EXPORT
void
tmq_list_destroy
(
tmq_list_t
*
);
DLL_EXPORT
int32_t
tmq_list_get_size
(
const
tmq_list_t
*
);
DLL_EXPORT
char
**
tmq_list_to_c_array
(
const
tmq_list_t
*
);
DLL_EXPORT
char
**
tmq_list_to_c_array
(
const
tmq_list_t
*
);
DLL_EXPORT
tmq_t
*
tmq_consumer_new
(
tmq_conf_t
*
conf
,
char
*
errstr
,
int32_t
errstrLen
);
...
...
@@ -240,7 +240,7 @@ DLL_EXPORT const char *tmq_err2str(tmq_resp_err_t);
DLL_EXPORT
tmq_resp_err_t
tmq_subscribe
(
tmq_t
*
tmq
,
const
tmq_list_t
*
topic_list
);
DLL_EXPORT
tmq_resp_err_t
tmq_unsubscribe
(
tmq_t
*
tmq
);
DLL_EXPORT
tmq_resp_err_t
tmq_subscription
(
tmq_t
*
tmq
,
tmq_list_t
**
topics
);
DLL_EXPORT
TAOS_RES
*
tmq_consumer_poll
(
tmq_t
*
tmq
,
int64_t
timeout
);
DLL_EXPORT
TAOS_RES
*
tmq_consumer_poll
(
tmq_t
*
tmq
,
int64_t
timeout
);
DLL_EXPORT
tmq_resp_err_t
tmq_consumer_close
(
tmq_t
*
tmq
);
DLL_EXPORT
tmq_resp_err_t
tmq_commit_sync
(
tmq_t
*
tmq
,
const
tmq_topic_vgroup_list_t
*
offsets
);
DLL_EXPORT
void
tmq_commit_async
(
tmq_t
*
tmq
,
const
tmq_topic_vgroup_list_t
*
offsets
,
tmq_commit_cb
*
cb
,
void
*
param
);
...
...
@@ -260,7 +260,7 @@ enum tmq_conf_res_t {
typedef
enum
tmq_conf_res_t
tmq_conf_res_t
;
DLL_EXPORT
tmq_conf_t
*
tmq_conf_new
();
DLL_EXPORT
tmq_conf_t
*
tmq_conf_new
();
DLL_EXPORT
tmq_conf_res_t
tmq_conf_set
(
tmq_conf_t
*
conf
,
const
char
*
key
,
const
char
*
value
);
DLL_EXPORT
void
tmq_conf_destroy
(
tmq_conf_t
*
conf
);
DLL_EXPORT
void
tmq_conf_set_auto_commit_cb
(
tmq_conf_t
*
conf
,
tmq_commit_cb
*
cb
,
void
*
param
);
...
...
include/common/tdatablock.h
浏览文件 @
461cd037
...
...
@@ -71,20 +71,14 @@ SEpSet getEpSet_s(SCorEpSet* pEpSet);
#define colDataGetData(p1_, r_) \
((IS_VAR_DATA_TYPE((p1_)->info.type)) ? colDataGetVarData(p1_, r_) : colDataGetNumData(p1_, r_))
static
FORCE_INLINE
bool
colDataIsNull_s
(
const
SColumnInfoData
*
pColumnInfoData
,
uint32_t
row
)
{
if
(
pColumnInfoData
->
info
.
type
==
TSDB_DATA_TYPE_JSON
)
{
if
(
colDataIsNull_var
(
pColumnInfoData
,
row
))
{
return
true
;
}
char
*
data
=
colDataGetVarData
(
pColumnInfoData
,
row
);
return
(
*
data
==
TSDB_DATA_TYPE_NULL
);
}
#define IS_JSON_NULL(type,data) ((type) == TSDB_DATA_TYPE_JSON && *(data) == TSDB_DATA_TYPE_NULL)
static
FORCE_INLINE
bool
colDataIsNull_s
(
const
SColumnInfoData
*
pColumnInfoData
,
uint32_t
row
)
{
if
(
!
pColumnInfoData
->
hasNull
)
{
return
false
;
}
if
(
pColumnInfoData
->
info
.
type
==
TSDB_DATA_TYPE_VARCHAR
||
pColumnInfoData
->
info
.
type
==
TSDB_DATA_TYPE_NCHAR
)
{
if
(
IS_VAR_DATA_TYPE
(
pColumnInfoData
->
info
.
type
)
)
{
return
colDataIsNull_var
(
pColumnInfoData
,
row
);
}
else
{
if
(
pColumnInfoData
->
nullbitmap
==
NULL
)
{
...
...
include/libs/index/index.h
浏览文件 @
461cd037
...
...
@@ -193,8 +193,9 @@ void indexInit();
/* index filter */
typedef
struct
SIndexMetaArg
{
void
*
metaHandle
;
void
*
metaEx
;
void
*
idx
;
void
*
ivtIdx
;
uint64_t
suid
;
}
SIndexMetaArg
;
...
...
include/util/tdef.h
浏览文件 @
461cd037
...
...
@@ -129,7 +129,7 @@ typedef enum EOperatorType {
OP_TYPE_SUB
,
OP_TYPE_MULTI
,
OP_TYPE_DIV
,
OP_TYPE_
MOD
,
OP_TYPE_
REM
,
// unary arithmetic operator
OP_TYPE_MINUS
,
OP_TYPE_ASSIGN
,
...
...
source/common/src/tdatablock.c
浏览文件 @
461cd037
...
...
@@ -109,7 +109,7 @@ int32_t getJsonValueLen(const char *data) {
dataLen
=
DOUBLE_BYTES
+
CHAR_BYTES
;
}
else
if
(
*
data
==
TSDB_DATA_TYPE_BOOL
)
{
dataLen
=
CHAR_BYTES
+
CHAR_BYTES
;
}
else
if
(
*
data
==
TD_TAG_JSON
)
{
// json string
}
else
if
(
*
data
&
TD_TAG_JSON
)
{
// json string
dataLen
=
((
STag
*
)(
data
))
->
len
;
}
else
{
ASSERT
(
0
);
...
...
source/dnode/vnode/inc/vnode.h
浏览文件 @
461cd037
...
...
@@ -56,7 +56,7 @@ int32_t vnodePreprocessReq(SVnode *pVnode, SRpcMsg *pMsg);
int32_t
vnodeProcessWriteReq
(
SVnode
*
pVnode
,
SRpcMsg
*
pMsg
,
int64_t
version
,
SRpcMsg
*
pRsp
);
int32_t
vnodeProcessCMsg
(
SVnode
*
pVnode
,
SRpcMsg
*
pMsg
,
SRpcMsg
**
pRsp
);
int32_t
vnodeProcessSyncReq
(
SVnode
*
pVnode
,
SRpcMsg
*
pMsg
,
SRpcMsg
**
pRsp
);
int32_t
vnodePreprocessQueryMsg
(
SVnode
*
pVnode
,
SRpcMsg
*
pMsg
);
int32_t
vnodePreprocessQueryMsg
(
SVnode
*
pVnode
,
SRpcMsg
*
pMsg
);
int32_t
vnodeProcessQueryMsg
(
SVnode
*
pVnode
,
SRpcMsg
*
pMsg
);
int32_t
vnodeProcessFetchMsg
(
SVnode
*
pVnode
,
SRpcMsg
*
pMsg
,
SQueueInfo
*
pInfo
);
int32_t
vnodeGetLoad
(
SVnode
*
pVnode
,
SVnodeLoad
*
pLoad
);
...
...
@@ -86,7 +86,7 @@ typedef struct SMetaFltParam {
tb_uid_t
suid
;
int16_t
cid
;
int16_t
type
;
char
*
val
;
char
*
val
;
bool
reverse
;
int
(
*
filterFunc
)(
void
*
a
,
void
*
b
,
int16_t
type
);
...
...
@@ -121,7 +121,8 @@ int32_t tsdbGetFileBlocksDistInfo(tsdbReaderT *pReader, STableBlockDistInfo
bool
isTsdbCacheLastRow
(
tsdbReaderT
*
pReader
);
int32_t
tsdbGetAllTableList
(
SMeta
*
pMeta
,
uint64_t
uid
,
SArray
*
list
);
int32_t
tsdbGetCtbIdList
(
SMeta
*
pMeta
,
int64_t
suid
,
SArray
*
list
);
void
*
tsdbGetIdx
(
SMeta
*
pMeta
);
void
*
tsdbGetIdx
(
SMeta
*
pMeta
);
void
*
tsdbGetIvtIdx
(
SMeta
*
pMeta
);
int64_t
tsdbGetNumOfRowsInMemTable
(
tsdbReaderT
*
pHandle
);
bool
tsdbNextDataBlock
(
tsdbReaderT
pTsdbReadHandle
);
...
...
@@ -197,7 +198,7 @@ struct SMetaEntry {
int64_t
version
;
int8_t
type
;
tb_uid_t
uid
;
char
*
name
;
char
*
name
;
union
{
struct
{
SSchemaWrapper
schemaRow
;
...
...
@@ -225,17 +226,17 @@ struct SMetaEntry {
struct
SMetaReader
{
int32_t
flags
;
SMeta
*
pMeta
;
SMeta
*
pMeta
;
SDecoder
coder
;
SMetaEntry
me
;
void
*
pBuf
;
void
*
pBuf
;
int32_t
szBuf
;
};
struct
SMTbCursor
{
TBC
*
pDbc
;
void
*
pKey
;
void
*
pVal
;
TBC
*
pDbc
;
void
*
pKey
;
void
*
pVal
;
int32_t
kLen
;
int32_t
vLen
;
SMetaReader
mr
;
...
...
source/dnode/vnode/src/inc/meta.h
浏览文件 @
461cd037
...
...
@@ -69,12 +69,11 @@ struct SMeta {
TTB
*
pUidIdx
;
TTB
*
pNameIdx
;
TTB
*
pCtbIdx
;
#ifdef USE_INVERTED_INDEX
// ivt idx and idx
void
*
pTagIvtIdx
;
#else
TTB
*
pTagIdx
;
#endif
TTB
*
pTtlIdx
;
TTB
*
pSmaIdx
;
SMetaIdx
*
pIdx
;
};
...
...
source/dnode/vnode/src/inc/vnodeInt.h
浏览文件 @
461cd037
...
...
@@ -104,6 +104,7 @@ int32_t metaSnapshotReaderOpen(SMeta* pMeta, SMetaSnapshotReader** ppRea
int32_t
metaSnapshotReaderClose
(
SMetaSnapshotReader
*
pReader
);
int32_t
metaSnapshotRead
(
SMetaSnapshotReader
*
pReader
,
void
**
ppData
,
uint32_t
*
nData
);
void
*
metaGetIdx
(
SMeta
*
pMeta
);
void
*
metaGetIvtIdx
(
SMeta
*
pMeta
);
int32_t
metaCreateTSma
(
SMeta
*
pMeta
,
int64_t
version
,
SSmaCfg
*
pCfg
);
int32_t
metaDropTSma
(
SMeta
*
pMeta
,
int64_t
indexUid
);
...
...
source/dnode/vnode/src/meta/metaOpen.c
浏览文件 @
461cd037
...
...
@@ -93,7 +93,6 @@ int metaOpen(SVnode *pVnode, SMeta **ppMeta) {
}
// open pTagIdx
#ifdef USE_INVERTED_INDEX
// TODO(yihaoDeng), refactor later
char
indexFullPath
[
128
]
=
{
0
};
sprintf
(
indexFullPath
,
"%s/%s"
,
pMeta
->
path
,
"invert"
);
...
...
@@ -104,13 +103,11 @@ int metaOpen(SVnode *pVnode, SMeta **ppMeta) {
goto
_err
;
}
#else
ret
=
tdbTbOpen
(
"tag.idx"
,
-
1
,
0
,
tagIdxKeyCmpr
,
pMeta
->
pEnv
,
&
pMeta
->
pTagIdx
);
if
(
ret
<
0
)
{
metaError
(
"vgId:%d, failed to open meta tag index since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
terrno
));
goto
_err
;
}
#endif
// open pTtlIdx
ret
=
tdbTbOpen
(
"ttl.idx"
,
sizeof
(
STtlIdxKey
),
0
,
ttlIdxKeyCmpr
,
pMeta
->
pEnv
,
&
pMeta
->
pTtlIdx
);
...
...
@@ -141,11 +138,8 @@ _err:
if
(
pMeta
->
pIdx
)
metaCloseIdx
(
pMeta
);
if
(
pMeta
->
pSmaIdx
)
tdbTbClose
(
pMeta
->
pSmaIdx
);
if
(
pMeta
->
pTtlIdx
)
tdbTbClose
(
pMeta
->
pTtlIdx
);
#ifdef USE_INVERTED_INDEX
if
(
pMeta
->
pTagIvtIdx
)
indexClose
(
pMeta
->
pTagIvtIdx
);
#else
if
(
pMeta
->
pTagIdx
)
tdbTbClose
(
pMeta
->
pTagIdx
);
#endif
if
(
pMeta
->
pCtbIdx
)
tdbTbClose
(
pMeta
->
pCtbIdx
);
if
(
pMeta
->
pNameIdx
)
tdbTbClose
(
pMeta
->
pNameIdx
);
if
(
pMeta
->
pUidIdx
)
tdbTbClose
(
pMeta
->
pUidIdx
);
...
...
source/dnode/vnode/src/meta/metaSma.c
浏览文件 @
461cd037
...
...
@@ -28,9 +28,9 @@ int32_t metaCreateTSma(SMeta *pMeta, int64_t version, SSmaCfg *pCfg) {
int
vLen
=
0
;
const
void
*
pKey
=
NULL
;
const
void
*
pVal
=
NULL
;
void
*
pBuf
=
NULL
;
void
*
pBuf
=
NULL
;
int32_t
szBuf
=
0
;
void
*
p
=
NULL
;
void
*
p
=
NULL
;
SMetaReader
mr
=
{
0
};
// validate req
...
...
@@ -83,8 +83,8 @@ int32_t metaDropTSma(SMeta *pMeta, int64_t indexUid) {
static
int
metaSaveSmaToDB
(
SMeta
*
pMeta
,
const
SMetaEntry
*
pME
)
{
STbDbKey
tbDbKey
;
void
*
pKey
=
NULL
;
void
*
pVal
=
NULL
;
void
*
pKey
=
NULL
;
void
*
pVal
=
NULL
;
int
kLen
=
0
;
int
vLen
=
0
;
SEncoder
coder
=
{
0
};
...
...
source/dnode/vnode/src/meta/metaTable.c
浏览文件 @
461cd037
...
...
@@ -15,6 +15,7 @@
#include "meta.h"
static
int
metaSaveJsonVarToIdx
(
SMeta
*
pMeta
,
const
SMetaEntry
*
pCtbEntry
,
const
SSchema
*
pSchema
);
static
int
metaHandleEntry
(
SMeta
*
pMeta
,
const
SMetaEntry
*
pME
);
static
int
metaSaveToTbDb
(
SMeta
*
pMeta
,
const
SMetaEntry
*
pME
);
static
int
metaUpdateUidIdx
(
SMeta
*
pMeta
,
const
SMetaEntry
*
pME
);
...
...
@@ -25,7 +26,7 @@ static int metaUpdateCtbIdx(SMeta *pMeta, const SMetaEntry *pME);
static
int
metaUpdateTagIdx
(
SMeta
*
pMeta
,
const
SMetaEntry
*
pCtbEntry
);
static
int
metaDropTableByUid
(
SMeta
*
pMeta
,
tb_uid_t
uid
,
int
*
type
);
static
int
metaUpdateMetaRsp
(
tb_uid_t
uid
,
char
*
tbName
,
SSchemaWrapper
*
pSchema
,
STableMetaRsp
*
pMetaRsp
)
{
static
int
metaUpdateMetaRsp
(
tb_uid_t
uid
,
char
*
tbName
,
SSchemaWrapper
*
pSchema
,
STableMetaRsp
*
pMetaRsp
)
{
pMetaRsp
->
pSchemas
=
taosMemoryMalloc
(
pSchema
->
nCols
*
sizeof
(
SSchema
));
if
(
NULL
==
pMetaRsp
->
pSchemas
)
{
terrno
=
TSDB_CODE_VND_OUT_OF_MEMORY
;
...
...
@@ -43,6 +44,68 @@ static int metaUpdateMetaRsp(tb_uid_t uid, char* tbName, SSchemaWrapper *pSchema
return
0
;
}
static
int
metaSaveJsonVarToIdx
(
SMeta
*
pMeta
,
const
SMetaEntry
*
pCtbEntry
,
const
SSchema
*
pSchema
)
{
#ifdef USE_INVERTED_INDEX
if
(
pMeta
->
pTagIvtIdx
==
NULL
||
pCtbEntry
==
NULL
)
{
return
-
1
;
}
void
*
data
=
pCtbEntry
->
ctbEntry
.
pTags
;
const
char
*
tagName
=
pSchema
->
name
;
tb_uid_t
suid
=
pCtbEntry
->
ctbEntry
.
suid
;
tb_uid_t
tuid
=
pCtbEntry
->
uid
;
const
void
*
pTagData
=
pCtbEntry
->
ctbEntry
.
pTags
;
int32_t
nTagData
=
0
;
SArray
*
pTagVals
=
NULL
;
if
(
tTagToValArray
((
const
STag
*
)
data
,
&
pTagVals
)
!=
0
)
{
return
-
1
;
}
char
key
[
512
]
=
{
0
};
SIndexMultiTerm
*
terms
=
indexMultiTermCreate
();
int16_t
nCols
=
taosArrayGetSize
(
pTagVals
);
for
(
int
i
=
0
;
i
<
nCols
;
i
++
)
{
STagVal
*
pTagVal
=
(
STagVal
*
)
taosArrayGet
(
pTagVals
,
i
);
char
type
=
pTagVal
->
type
;
sprintf
(
key
,
"%s_%s"
,
tagName
,
pTagVal
->
pKey
);
int32_t
nKey
=
strlen
(
key
);
SIndexTerm
*
term
=
NULL
;
if
(
type
==
TSDB_DATA_TYPE_NULL
)
{
// handle null value
}
else
if
(
type
==
TSDB_DATA_TYPE_NCHAR
)
{
if
(
pTagVal
->
nData
>
0
)
{
char
*
val
=
taosMemoryCalloc
(
1
,
pTagVal
->
nData
+
VARSTR_HEADER_SIZE
);
int32_t
len
=
taosUcs4ToMbs
((
TdUcs4
*
)
pTagVal
->
pData
,
pTagVal
->
nData
,
val
+
VARSTR_HEADER_SIZE
);
memcpy
(
val
,
(
uint16_t
*
)
&
len
,
VARSTR_HEADER_SIZE
);
type
=
TSDB_DATA_TYPE_VARCHAR
;
term
=
indexTermCreate
(
suid
,
ADD_VALUE
,
type
,
key
,
nKey
,
val
,
len
);
}
else
if
(
pTagVal
->
nData
==
0
)
{
char
*
val
=
NULL
;
int32_t
len
=
0
;
// handle NULL key
}
}
else
if
(
type
==
TSDB_DATA_TYPE_DOUBLE
)
{
double
val
=
*
(
double
*
)(
&
pTagVal
->
i64
);
int
len
=
0
;
term
=
indexTermCreate
(
suid
,
ADD_VALUE
,
type
,
key
,
nKey
,
(
const
char
*
)
&
val
,
len
);
}
else
if
(
type
==
TSDB_DATA_TYPE_BOOL
)
{
int
val
=
*
(
int
*
)(
&
pTagVal
->
i64
);
int
len
=
0
;
term
=
indexTermCreate
(
suid
,
ADD_VALUE
,
type
,
key
,
nKey
,
(
const
char
*
)
&
val
,
len
);
}
if
(
term
!=
NULL
)
{
indexMultiTermAdd
(
terms
,
term
);
}
memset
(
key
,
0
,
sizeof
(
key
));
}
tIndexJsonPut
(
pMeta
->
pTagIvtIdx
,
terms
,
tuid
);
indexMultiTermDestroy
(
terms
);
#endif
return
-
1
;
}
int
metaCreateSTable
(
SMeta
*
pMeta
,
int64_t
version
,
SVCreateStbReq
*
pReq
)
{
SMetaEntry
me
=
{
0
};
int
kLen
=
0
;
...
...
@@ -341,7 +404,6 @@ static int metaDropTableByUid(SMeta *pMeta, tb_uid_t uid, int *type) {
return
0
;
}
static
int
metaAlterTableColumn
(
SMeta
*
pMeta
,
int64_t
version
,
SVAlterTbReq
*
pAlterTbReq
,
STableMetaRsp
*
pMetaRsp
)
{
void
*
pVal
=
NULL
;
int
nVal
=
0
;
...
...
@@ -824,28 +886,16 @@ static int metaUpdateTagIdx(SMeta *pMeta, const SMetaEntry *pCtbEntry) {
}
else
{
// pTagData = pCtbEntry->ctbEntry.pTags;
// nTagData = ((const STag *)pCtbEntry->ctbEntry.pTags)->len;
pTagData
=
pCtbEntry
->
ctbEntry
.
pTags
;
nTagData
=
((
const
STag
*
)
pCtbEntry
->
ctbEntry
.
pTags
)
->
len
;
return
metaSaveJsonVarToIdx
(
pMeta
,
pCtbEntry
,
pTagColumn
);
}
// update tag index
#ifdef USE_INVERTED_INDEX
tb_uid_t
suid
=
pCtbEntry
->
ctbEntry
.
suid
;
tb_uid_t
tuid
=
pCtbEntry
->
uid
;
SIndexMultiTerm
*
tmGroup
=
indexMultiTermCreate
();
SIndexTerm
*
tm
=
indexTermCreate
(
suid
,
ADD_VALUE
,
pTagColumn
->
type
,
pTagColumn
->
name
,
sizeof
(
pTagColumn
->
name
),
pTagData
,
pTagData
==
NULL
?
0
:
strlen
(
pTagData
));
indexMultiTermAdd
(
tmGroup
,
tm
);
int
ret
=
indexPut
((
SIndex
*
)
pMeta
->
pTagIvtIdx
,
tmGroup
,
tuid
);
indexMultiTermDestroy
(
tmGroup
);
#else
if
(
metaCreateTagIdxKey
(
pCtbEntry
->
ctbEntry
.
suid
,
pTagColumn
->
colId
,
pTagData
,
nTagData
,
pTagColumn
->
type
,
pCtbEntry
->
uid
,
&
pTagIdxKey
,
&
nTagIdxKey
)
<
0
)
{
return
-
1
;
}
tdbTbInsert
(
pMeta
->
pTagIdx
,
pTagIdxKey
,
nTagIdxKey
,
NULL
,
0
,
&
pMeta
->
txn
);
metaDestroyTagIdxKey
(
pTagIdxKey
);
#endif
tDecoderClear
(
&
dc
);
tdbFree
(
pData
);
return
0
;
...
...
@@ -930,10 +980,5 @@ _err:
return
-
1
;
}
// refactor later
void
*
metaGetIdx
(
SMeta
*
pMeta
)
{
#ifdef USE_INVERTED_INDEX
return
pMeta
->
pTagIvtIdx
;
#else
return
pMeta
->
pTagIdx
;
#endif
}
void
*
metaGetIdx
(
SMeta
*
pMeta
)
{
return
pMeta
->
pTagIdx
;
}
void
*
metaGetIvtIdx
(
SMeta
*
pMeta
)
{
return
pMeta
->
pTagIvtIdx
;
}
source/dnode/vnode/src/tsdb/tsdbRead.c
浏览文件 @
461cd037
...
...
@@ -2834,6 +2834,12 @@ void* tsdbGetIdx(SMeta* pMeta) {
}
return
metaGetIdx
(
pMeta
);
}
void
*
tsdbGetIvtIdx
(
SMeta
*
pMeta
)
{
if
(
pMeta
==
NULL
)
{
return
NULL
;
}
return
metaGetIvtIdx
(
pMeta
);
}
int32_t
tsdbGetAllTableList
(
SMeta
*
pMeta
,
uint64_t
uid
,
SArray
*
list
)
{
SMCtbCursor
*
pCur
=
metaOpenCtbCursor
(
pMeta
,
uid
);
...
...
source/libs/executor/src/executorimpl.c
浏览文件 @
461cd037
...
...
@@ -4797,7 +4797,8 @@ int32_t getTableList(void* metaHandle, int32_t tableType, uint64_t tableUid, STa
if
(
tableType
==
TSDB_SUPER_TABLE
)
{
if
(
pTagCond
)
{
SIndexMetaArg
metaArg
=
{.
metaEx
=
metaHandle
,
.
metaHandle
=
tsdbGetIdx
(
metaHandle
),
.
suid
=
tableUid
};
SIndexMetaArg
metaArg
=
{
.
metaEx
=
metaHandle
,
.
idx
=
tsdbGetIdx
(
metaHandle
),
.
ivtIdx
=
tsdbGetIvtIdx
(
metaHandle
),
.
suid
=
tableUid
};
SArray
*
res
=
taosArrayInit
(
8
,
sizeof
(
uint64_t
));
code
=
doFilterTag
(
pTagCond
,
&
metaArg
,
res
);
...
...
source/libs/index/src/index.c
浏览文件 @
461cd037
...
...
@@ -202,7 +202,7 @@ int indexPut(SIndex* index, SIndexMultiTerm* fVals, uint64_t uid) {
char
buf
[
128
]
=
{
0
};
ICacheKey
key
=
{.
suid
=
p
->
suid
,
.
colName
=
p
->
colName
,
.
nColName
=
strlen
(
p
->
colName
),
.
colType
=
p
->
colType
};
int32_t
sz
=
indexSerialCacheKey
(
&
key
,
buf
);
indexDebug
(
"suid: %"
PRIu64
", colName: %s, colType: %d"
,
key
.
suid
,
key
.
colName
,
key
.
colType
);
indexDebug
(
"
w
suid: %"
PRIu64
", colName: %s, colType: %d"
,
key
.
suid
,
key
.
colName
,
key
.
colType
);
IndexCache
**
cache
=
taosHashGet
(
index
->
colObj
,
buf
,
sz
);
assert
(
*
cache
!=
NULL
);
...
...
@@ -330,7 +330,7 @@ static int indexTermSearch(SIndex* sIdx, SIndexTermQuery* query, SArray** result
char
buf
[
128
]
=
{
0
};
ICacheKey
key
=
{
.
suid
=
term
->
suid
,
.
colName
=
term
->
colName
,
.
nColName
=
strlen
(
term
->
colName
),
.
colType
=
term
->
colType
};
indexDebug
(
"suid: %"
PRIu64
", colName: %s, colType: %d"
,
key
.
suid
,
key
.
colName
,
key
.
colType
);
indexDebug
(
"
r
suid: %"
PRIu64
", colName: %s, colType: %d"
,
key
.
suid
,
key
.
colName
,
key
.
colType
);
int32_t
sz
=
indexSerialCacheKey
(
&
key
,
buf
);
taosThreadMutexLock
(
&
sIdx
->
mtx
);
...
...
source/libs/index/src/indexComm.c
浏览文件 @
461cd037
...
...
@@ -402,16 +402,16 @@ int32_t indexConvertDataToStr(void* src, int8_t type, void** dst) {
break
;
}
case
TSDB_DATA_TYPE_VARCHAR
:
{
// TSDB_DATA_TYPE_BINARY
tlen
=
taosEncodeBinary
(
NULL
,
src
,
strl
en
(
src
));
tlen
=
taosEncodeBinary
(
NULL
,
varDataVal
(
src
),
varDataL
en
(
src
));
*
dst
=
taosMemoryCalloc
(
1
,
tlen
+
1
);
tlen
=
taosEncodeBinary
(
dst
,
src
,
strl
en
(
src
));
tlen
=
taosEncodeBinary
(
dst
,
varDataVal
(
src
),
varDataL
en
(
src
));
*
dst
=
(
char
*
)
*
dst
-
tlen
;
break
;
}
case
TSDB_DATA_TYPE_VARBINARY
:
tlen
=
taosEncodeBinary
(
NULL
,
src
,
strl
en
(
src
));
tlen
=
taosEncodeBinary
(
NULL
,
varDataVal
(
src
),
varDataL
en
(
src
));
*
dst
=
taosMemoryCalloc
(
1
,
tlen
+
1
);
tlen
=
taosEncodeBinary
(
dst
,
src
,
strl
en
(
src
));
tlen
=
taosEncodeBinary
(
dst
,
varDataVal
(
src
),
varDataL
en
(
src
));
*
dst
=
(
char
*
)
*
dst
-
tlen
;
break
;
default:
...
...
source/libs/index/src/indexFilter.c
浏览文件 @
461cd037
...
...
@@ -31,7 +31,7 @@ typedef struct SIFParam {
SHashObj
*
pFilter
;
SArray
*
result
;
char
*
condValue
;
char
*
condValue
;
SIdxFltStatus
status
;
uint8_t
colValType
;
...
...
@@ -45,7 +45,7 @@ typedef struct SIFParam {
typedef
struct
SIFCtx
{
int32_t
code
;
SHashObj
*
pRes
;
/* element is SIFParam */
SHashObj
*
pRes
;
/* element is SIFParam */
bool
noExec
;
// true: just iterate condition tree, and add hint to executor plan
SIndexMetaArg
arg
;
// SIdxFltStatus st;
...
...
@@ -128,7 +128,7 @@ static int32_t sifGetValueFromNode(SNode *node, char **value) {
// covert data From snode;
SValueNode
*
vn
=
(
SValueNode
*
)
node
;
char
*
pData
=
nodesGetValueFromNode
(
vn
);
char
*
pData
=
nodesGetValueFromNode
(
vn
);
SDataType
*
pType
=
&
vn
->
node
.
resType
;
int32_t
type
=
pType
->
type
;
int32_t
valLen
=
0
;
...
...
@@ -162,12 +162,27 @@ static int32_t sifGetValueFromNode(SNode *node, char **value) {
return
TSDB_CODE_SUCCESS
;
}
static
int32_t
sifInitJsonParam
(
SNode
*
node
,
SIFParam
*
param
,
SIFCtx
*
ctx
)
{
SOperatorNode
*
nd
=
(
SOperatorNode
*
)
node
;
assert
(
nodeType
(
node
)
==
QUERY_NODE_OPERATOR
);
SColumnNode
*
l
=
(
SColumnNode
*
)
nd
->
pLeft
;
SValueNode
*
r
=
(
SValueNode
*
)
nd
->
pRight
;
param
->
colId
=
l
->
colId
;
param
->
colValType
=
l
->
node
.
resType
.
type
;
memcpy
(
param
->
dbName
,
l
->
dbName
,
sizeof
(
l
->
dbName
));
sprintf
(
param
->
colName
,
"%s_%s"
,
l
->
colName
,
r
->
literal
);
param
->
colValType
=
r
->
typeData
;
return
0
;
// memcpy(param->colName, l->colName, sizeof(l->colName));
}
static
int32_t
sifInitParam
(
SNode
*
node
,
SIFParam
*
param
,
SIFCtx
*
ctx
)
{
switch
(
nodeType
(
node
))
{
case
QUERY_NODE_VALUE
:
{
SValueNode
*
vn
=
(
SValueNode
*
)
node
;
SIF_ERR_RET
(
sifGetValueFromNode
(
node
,
&
param
->
condValue
));
param
->
colId
=
-
1
;
param
->
colValType
=
(
uint8_t
)(
vn
->
node
.
resType
.
type
);
break
;
}
case
QUERY_NODE_COLUMN
:
{
...
...
@@ -219,17 +234,31 @@ static int32_t sifInitOperParams(SIFParam **params, SOperatorNode *node, SIFCtx
indexError
(
"invalid operation node, left: %p, rigth: %p"
,
node
->
pLeft
,
node
->
pRight
);
SIF_ERR_RET
(
TSDB_CODE_QRY_INVALID_INPUT
);
}
if
(
node
->
opType
==
OP_TYPE_JSON_GET_VALUE
||
node
->
opType
==
OP_TYPE_JSON_CONTAINS
)
{
return
code
;
}
SIFParam
*
paramList
=
taosMemoryCalloc
(
nParam
,
sizeof
(
SIFParam
));
if
(
NULL
==
paramList
)
{
SIF_ERR_RET
(
TSDB_CODE_QRY_OUT_OF_MEMORY
);
}
if
(
nodeType
(
node
->
pLeft
)
==
QUERY_NODE_OPERATOR
)
{
SNode
*
interNode
=
(
node
->
pLeft
);
SIF_ERR_JRET
(
sifInitJsonParam
(
interNode
,
&
paramList
[
0
],
ctx
));
if
(
nParam
>
1
)
{
SIF_ERR_JRET
(
sifInitParam
(
node
->
pRight
,
&
paramList
[
1
],
ctx
));
}
paramList
[
0
].
colValType
=
TSDB_DATA_TYPE_JSON
;
*
params
=
paramList
;
return
TSDB_CODE_SUCCESS
;
}
else
{
SIF_ERR_JRET
(
sifInitParam
(
node
->
pLeft
,
&
paramList
[
0
],
ctx
));
if
(
nParam
>
1
)
{
SIF_ERR_JRET
(
sifInitParam
(
node
->
pRight
,
&
paramList
[
1
],
ctx
));
}
*
params
=
paramList
;
return
TSDB_CODE_SUCCESS
;
}
_return:
taosMemoryFree
(
paramList
);
SIF_RET
(
code
);
...
...
@@ -306,25 +335,21 @@ static Filter sifGetFilterFunc(EIndexQueryType type, bool *reverse) {
}
static
int32_t
sifDoIndex
(
SIFParam
*
left
,
SIFParam
*
right
,
int8_t
operType
,
SIFParam
*
output
)
{
SIndexMetaArg
*
arg
=
&
output
->
arg
;
#ifdef USE_INVERTED_INDEX
SIndexTerm
*
tm
=
indexTermCreate
(
arg
->
suid
,
DEFAULT
,
left
->
colValType
,
left
->
colName
,
strlen
(
left
->
colName
),
int
ret
=
0
;
EIndexQueryType
qtype
=
0
;
SIF_ERR_RET
(
sifGetFuncFromSql
(
operType
,
&
qtype
));
if
(
left
->
colValType
==
TSDB_DATA_TYPE_JSON
)
{
SIndexTerm
*
tm
=
indexTermCreate
(
arg
->
suid
,
DEFAULT
,
right
->
colValType
,
left
->
colName
,
strlen
(
left
->
colName
),
right
->
condValue
,
strlen
(
right
->
condValue
));
if
(
tm
==
NULL
)
{
return
TSDB_CODE_QRY_OUT_OF_MEMORY
;
}
EIndexQueryType
qtype
=
0
;
SIF_ERR_RET
(
sifGetFuncFromSql
(
operType
,
&
qtype
));
SIndexMultiTermQuery
*
mtm
=
indexMultiTermQueryCreate
(
MUST
);
indexMultiTermQueryAdd
(
mtm
,
tm
,
qtype
);
int
ret
=
indexSearch
(
arg
->
metaHandle
,
mtm
,
output
->
result
);
indexDebug
(
"index filter data size: %d"
,
(
int
)
taosArrayGetSize
(
output
->
result
));
indexMultiTermQueryDestroy
(
mtm
);
return
ret
;
#else
EIndexQueryType
qtype
=
0
;
SIF_ERR_RET
(
sifGetFuncFromSql
(
operType
,
&
qtype
));
ret
=
tIndexJsonSearch
(
arg
->
ivtIdx
,
mtm
,
output
->
result
);
}
else
{
bool
reverse
;
Filter
filterFunc
=
sifGetFilterFunc
(
qtype
,
&
reverse
);
...
...
@@ -335,10 +360,9 @@ static int32_t sifDoIndex(SIFParam *left, SIFParam *right, int8_t operType, SIFP
.
reverse
=
reverse
,
.
filterFunc
=
filterFunc
};
int
ret
=
metaFilteTableIds
(
arg
->
metaEx
,
&
param
,
output
->
result
);
ret
=
metaFilteTableIds
(
arg
->
metaEx
,
&
param
,
output
->
result
);
}
return
ret
;
#endif
return
0
;
}
static
int32_t
sifLessThanFunc
(
SIFParam
*
left
,
SIFParam
*
right
,
SIFParam
*
output
)
{
...
...
@@ -392,6 +416,14 @@ static int32_t sifNotMatchFunc(SIFParam *left, SIFParam *right, SIFParam *output
int
id
=
OP_TYPE_NMATCH
;
return
sifDoIndex
(
left
,
right
,
id
,
output
);
}
static
int32_t
sifJsonContains
(
SIFParam
*
left
,
SIFParam
*
right
,
SIFParam
*
output
)
{
// return 0
return
0
;
}
static
int32_t
sifJsonGetValue
(
SIFParam
*
left
,
SIFParam
*
rigth
,
SIFParam
*
output
)
{
// return 0
return
0
;
}
static
int32_t
sifDefaultFunc
(
SIFParam
*
left
,
SIFParam
*
right
,
SIFParam
*
output
)
{
// add more except
...
...
@@ -445,6 +477,14 @@ static int32_t sifGetOperFn(int32_t funcId, sif_func_t *func, SIdxFltStatus *sta
*
status
=
SFLT_NOT_INDEX
;
*
func
=
sifNotMatchFunc
;
return
0
;
case
OP_TYPE_JSON_CONTAINS
:
*
status
=
SFLT_ACCURATE_INDEX
;
*
func
=
sifJsonContains
;
return
0
;
case
OP_TYPE_JSON_GET_VALUE
:
*
status
=
SFLT_ACCURATE_INDEX
;
*
func
=
sifJsonGetValue
;
return
0
;
default:
*
status
=
SFLT_NOT_INDEX
;
*
func
=
sifNullFunc
;
...
...
@@ -457,12 +497,17 @@ static int32_t sifGetOperFn(int32_t funcId, sif_func_t *func, SIdxFltStatus *sta
static
int32_t
sifExecOper
(
SOperatorNode
*
node
,
SIFCtx
*
ctx
,
SIFParam
*
output
)
{
int32_t
code
=
0
;
int32_t
nParam
=
sifGetOperParamNum
(
node
->
opType
);
if
(
nParam
<=
1
)
{
SIF_ERR_RET
(
TSDB_CODE_QRY_INVALID_INPUT
);
}
if
(
node
->
opType
==
OP_TYPE_JSON_GET_VALUE
||
node
->
opType
==
OP_TYPE_JSON_CONTAINS
)
{
return
code
;
}
SIFParam
*
params
=
NULL
;
SIF_ERR_RET
(
sifInitOperParams
(
&
params
,
node
,
ctx
));
SIF_ERR_RET
(
sifInitOperParams
(
&
params
,
node
,
ctx
));
// ugly code, refactor later
output
->
arg
=
ctx
->
arg
;
sif_func_t
operFn
=
sifNullFunc
;
code
=
sifGetOperFn
(
node
->
opType
,
&
operFn
,
&
output
->
status
);
if
(
!
ctx
->
noExec
)
{
...
...
@@ -567,7 +612,9 @@ EDealRes sifCalcWalker(SNode *node, void *context) {
if
(
QUERY_NODE_LOGIC_CONDITION
==
nodeType
(
node
))
{
return
sifWalkLogic
(
node
,
ctx
);
}
if
(
QUERY_NODE_OPERATOR
==
nodeType
(
node
))
{
indexInfo
(
"node type for index filter, type: %d"
,
nodeType
(
node
));
return
sifWalkOper
(
node
,
ctx
);
}
...
...
@@ -658,7 +705,7 @@ int32_t doFilterTag(const SNode *pFilterNode, SIndexMetaArg *metaArg, SArray *re
// todo move to the initialization function
// SIF_ERR_RET(filterInitFromNode((SNode *)pFilterNode, &filter, 0));
SArray
*
output
=
taosArrayInit
(
8
,
sizeof
(
uint64_t
));
SArray
*
output
=
taosArrayInit
(
8
,
sizeof
(
uint64_t
));
SIFParam
param
=
{.
arg
=
*
metaArg
,
.
result
=
output
};
SIF_ERR_RET
(
sifCalculate
((
SNode
*
)
pFilterNode
,
&
param
));
...
...
source/libs/index/test/indexTests.cc
浏览文件 @
461cd037
...
...
@@ -500,8 +500,13 @@ TEST_F(IndexTFileEnv, test_tfile_write) {
std
::
string
colName
(
"voltage"
);
std
::
string
colVal
(
"ab"
);
SIndexTerm
*
term
=
indexTermCreate
(
1
,
ADD_VALUE
,
TSDB_DATA_TYPE_BINARY
,
colName
.
c_str
(),
colName
.
size
(),
colVal
.
c_str
(),
colVal
.
size
());
char
buf
[
256
]
=
{
0
};
int16_t
sz
=
colVal
.
size
();
memcpy
(
buf
,
(
uint16_t
*
)
&
sz
,
2
);
memcpy
(
buf
+
2
,
colVal
.
c_str
(),
colVal
.
size
());
SIndexTerm
*
term
=
indexTermCreate
(
1
,
ADD_VALUE
,
TSDB_DATA_TYPE_BINARY
,
colName
.
c_str
(),
colName
.
size
(),
buf
,
sizeof
(
buf
));
SIndexTermQuery
query
=
{
term
,
QUERY_TERM
};
SArray
*
result
=
(
SArray
*
)
taosArrayInit
(
1
,
sizeof
(
uint64_t
));
...
...
@@ -564,6 +569,18 @@ class IndexCacheEnv : public ::testing::Test {
CacheObj
*
coj
;
};
SIndexTerm
*
indexTermCreateT
(
int64_t
suid
,
SIndexOperOnColumn
oper
,
uint8_t
colType
,
const
char
*
colName
,
int32_t
nColName
,
const
char
*
colVal
,
int32_t
nColVal
)
{
char
buf
[
256
]
=
{
0
};
int16_t
sz
=
nColVal
;
memcpy
(
buf
,
(
uint16_t
*
)
&
sz
,
2
);
memcpy
(
buf
+
2
,
colVal
,
nColVal
);
if
(
colType
==
TSDB_DATA_TYPE_BINARY
)
{
return
indexTermCreate
(
suid
,
oper
,
colType
,
colName
,
nColName
,
buf
,
sizeof
(
buf
));
}
else
{
return
indexTermCreate
(
suid
,
oper
,
colType
,
colName
,
nColName
,
colVal
,
nColVal
);
}
}
#define MAX_TERM_KEY_LEN 128
TEST_F
(
IndexCacheEnv
,
cache_test
)
{
int
version
=
0
;
...
...
@@ -574,7 +591,7 @@ TEST_F(IndexCacheEnv, cache_test) {
std
::
string
colName
(
"voltage"
);
{
std
::
string
colVal
(
"v1"
);
SIndexTerm
*
term
=
indexTermCreate
(
0
,
ADD_VALUE
,
TSDB_DATA_TYPE_BINARY
,
colName
.
c_str
(),
colName
.
size
(),
SIndexTerm
*
term
=
indexTermCreate
T
(
0
,
ADD_VALUE
,
TSDB_DATA_TYPE_BINARY
,
colName
.
c_str
(),
colName
.
size
(),
colVal
.
c_str
(),
colVal
.
size
());
coj
->
Put
(
term
,
colId
,
version
++
,
suid
++
);
indexTermDestroy
(
term
);
...
...
@@ -582,28 +599,28 @@ TEST_F(IndexCacheEnv, cache_test) {
}
{
std
::
string
colVal
(
"v3"
);
SIndexTerm
*
term
=
indexTermCreate
(
0
,
ADD_VALUE
,
TSDB_DATA_TYPE_BINARY
,
colName
.
c_str
(),
colName
.
size
(),
SIndexTerm
*
term
=
indexTermCreate
T
(
0
,
ADD_VALUE
,
TSDB_DATA_TYPE_BINARY
,
colName
.
c_str
(),
colName
.
size
(),
colVal
.
c_str
(),
colVal
.
size
());
coj
->
Put
(
term
,
colId
,
version
++
,
suid
++
);
indexTermDestroy
(
term
);
}
{
std
::
string
colVal
(
"v2"
);
SIndexTerm
*
term
=
indexTermCreate
(
0
,
ADD_VALUE
,
TSDB_DATA_TYPE_BINARY
,
colName
.
c_str
(),
colName
.
size
(),
SIndexTerm
*
term
=
indexTermCreate
T
(
0
,
ADD_VALUE
,
TSDB_DATA_TYPE_BINARY
,
colName
.
c_str
(),
colName
.
size
(),
colVal
.
c_str
(),
colVal
.
size
());
coj
->
Put
(
term
,
colId
,
version
++
,
suid
++
);
indexTermDestroy
(
term
);
}
{
std
::
string
colVal
(
"v3"
);
SIndexTerm
*
term
=
indexTermCreate
(
0
,
ADD_VALUE
,
TSDB_DATA_TYPE_BINARY
,
colName
.
c_str
(),
colName
.
size
(),
SIndexTerm
*
term
=
indexTermCreate
T
(
0
,
ADD_VALUE
,
TSDB_DATA_TYPE_BINARY
,
colName
.
c_str
(),
colName
.
size
(),
colVal
.
c_str
(),
colVal
.
size
());
coj
->
Put
(
term
,
colId
,
version
++
,
suid
++
);
indexTermDestroy
(
term
);
}
{
std
::
string
colVal
(
"v3"
);
SIndexTerm
*
term
=
indexTermCreate
(
0
,
ADD_VALUE
,
TSDB_DATA_TYPE_BINARY
,
colName
.
c_str
(),
colName
.
size
(),
SIndexTerm
*
term
=
indexTermCreate
T
(
0
,
ADD_VALUE
,
TSDB_DATA_TYPE_BINARY
,
colName
.
c_str
(),
colName
.
size
(),
colVal
.
c_str
(),
colVal
.
size
());
coj
->
Put
(
term
,
colId
,
version
++
,
suid
++
);
indexTermDestroy
(
term
);
...
...
@@ -612,14 +629,14 @@ TEST_F(IndexCacheEnv, cache_test) {
std
::
cout
<<
"--------first----------"
<<
std
::
endl
;
{
std
::
string
colVal
(
"v3"
);
SIndexTerm
*
term
=
indexTermCreate
(
0
,
ADD_VALUE
,
TSDB_DATA_TYPE_BINARY
,
colName
.
c_str
(),
colName
.
size
(),
SIndexTerm
*
term
=
indexTermCreate
T
(
0
,
ADD_VALUE
,
TSDB_DATA_TYPE_BINARY
,
colName
.
c_str
(),
colName
.
size
(),
colVal
.
c_str
(),
colVal
.
size
());
coj
->
Put
(
term
,
othColId
,
version
++
,
suid
++
);
indexTermDestroy
(
term
);
}
{
std
::
string
colVal
(
"v4"
);
SIndexTerm
*
term
=
indexTermCreate
(
0
,
ADD_VALUE
,
TSDB_DATA_TYPE_BINARY
,
colName
.
c_str
(),
colName
.
size
(),
SIndexTerm
*
term
=
indexTermCreate
T
(
0
,
ADD_VALUE
,
TSDB_DATA_TYPE_BINARY
,
colName
.
c_str
(),
colName
.
size
(),
colVal
.
c_str
(),
colVal
.
size
());
coj
->
Put
(
term
,
othColId
,
version
++
,
suid
++
);
indexTermDestroy
(
term
);
...
...
@@ -630,7 +647,7 @@ TEST_F(IndexCacheEnv, cache_test) {
std
::
string
colVal
(
"v4"
);
for
(
size_t
i
=
0
;
i
<
10
;
i
++
)
{
colVal
[
colVal
.
size
()
-
1
]
=
'a'
+
i
;
SIndexTerm
*
term
=
indexTermCreate
(
0
,
ADD_VALUE
,
TSDB_DATA_TYPE_BINARY
,
colName
.
c_str
(),
colName
.
size
(),
SIndexTerm
*
term
=
indexTermCreate
T
(
0
,
ADD_VALUE
,
TSDB_DATA_TYPE_BINARY
,
colName
.
c_str
(),
colName
.
size
(),
colVal
.
c_str
(),
colVal
.
size
());
coj
->
Put
(
term
,
colId
,
version
++
,
suid
++
);
indexTermDestroy
(
term
);
...
...
@@ -640,7 +657,7 @@ TEST_F(IndexCacheEnv, cache_test) {
// begin query
{
std
::
string
colVal
(
"v3"
);
SIndexTerm
*
term
=
indexTermCreate
(
0
,
ADD_VALUE
,
TSDB_DATA_TYPE_BINARY
,
colName
.
c_str
(),
colName
.
size
(),
SIndexTerm
*
term
=
indexTermCreate
T
(
0
,
ADD_VALUE
,
TSDB_DATA_TYPE_BINARY
,
colName
.
c_str
(),
colName
.
size
(),
colVal
.
c_str
(),
colVal
.
size
());
SIndexTermQuery
query
=
{
term
,
QUERY_TERM
};
SArray
*
ret
=
(
SArray
*
)
taosArrayInit
(
4
,
sizeof
(
suid
));
...
...
@@ -655,7 +672,7 @@ TEST_F(IndexCacheEnv, cache_test) {
}
{
std
::
string
colVal
(
"v2"
);
SIndexTerm
*
term
=
indexTermCreate
(
0
,
ADD_VALUE
,
TSDB_DATA_TYPE_BINARY
,
colName
.
c_str
(),
colName
.
size
(),
SIndexTerm
*
term
=
indexTermCreate
T
(
0
,
ADD_VALUE
,
TSDB_DATA_TYPE_BINARY
,
colName
.
c_str
(),
colName
.
size
(),
colVal
.
c_str
(),
colVal
.
size
());
SIndexTermQuery
query
=
{
term
,
QUERY_TERM
};
SArray
*
ret
=
(
SArray
*
)
taosArrayInit
(
4
,
sizeof
(
suid
));
...
...
@@ -690,7 +707,7 @@ class IndexObj {
return
ret
;
}
void
Del
(
const
std
::
string
&
colName
,
const
std
::
string
&
colVal
,
uint64_t
uid
)
{
SIndexTerm
*
term
=
indexTermCreate
(
0
,
DEL_VALUE
,
TSDB_DATA_TYPE_BINARY
,
colName
.
c_str
(),
colName
.
size
(),
SIndexTerm
*
term
=
indexTermCreate
T
(
0
,
DEL_VALUE
,
TSDB_DATA_TYPE_BINARY
,
colName
.
c_str
(),
colName
.
size
(),
colVal
.
c_str
(),
colVal
.
size
());
SIndexMultiTerm
*
terms
=
indexMultiTermCreate
();
indexMultiTermAdd
(
terms
,
term
);
...
...
@@ -699,7 +716,7 @@ class IndexObj {
}
int
WriteMillonData
(
const
std
::
string
&
colName
,
const
std
::
string
&
colVal
=
"Hello world"
,
size_t
numOfTable
=
100
*
10000
)
{
SIndexTerm
*
term
=
indexTermCreate
(
0
,
ADD_VALUE
,
TSDB_DATA_TYPE_BINARY
,
colName
.
c_str
(),
colName
.
size
(),
SIndexTerm
*
term
=
indexTermCreate
T
(
0
,
ADD_VALUE
,
TSDB_DATA_TYPE_BINARY
,
colName
.
c_str
(),
colName
.
size
(),
colVal
.
c_str
(),
colVal
.
size
());
SIndexMultiTerm
*
terms
=
indexMultiTermCreate
();
indexMultiTermAdd
(
terms
,
term
);
...
...
@@ -721,7 +738,7 @@ class IndexObj {
// opt
tColVal
[
taosRand
()
%
colValSize
]
=
'a'
+
k
%
26
;
}
SIndexTerm
*
term
=
indexTermCreate
(
0
,
ADD_VALUE
,
TSDB_DATA_TYPE_BINARY
,
colName
.
c_str
(),
colName
.
size
(),
SIndexTerm
*
term
=
indexTermCreate
T
(
0
,
ADD_VALUE
,
TSDB_DATA_TYPE_BINARY
,
colName
.
c_str
(),
colName
.
size
(),
tColVal
.
c_str
(),
tColVal
.
size
());
SIndexMultiTerm
*
terms
=
indexMultiTermCreate
();
indexMultiTermAdd
(
terms
,
term
);
...
...
@@ -757,7 +774,7 @@ class IndexObj {
int
SearchOne
(
const
std
::
string
&
colName
,
const
std
::
string
&
colVal
)
{
SIndexMultiTermQuery
*
mq
=
indexMultiTermQueryCreate
(
MUST
);
SIndexTerm
*
term
=
indexTermCreate
(
0
,
ADD_VALUE
,
TSDB_DATA_TYPE_BINARY
,
colName
.
c_str
(),
colName
.
size
(),
SIndexTerm
*
term
=
indexTermCreate
T
(
0
,
ADD_VALUE
,
TSDB_DATA_TYPE_BINARY
,
colName
.
c_str
(),
colName
.
size
(),
colVal
.
c_str
(),
colVal
.
size
());
indexMultiTermQueryAdd
(
mq
,
term
,
QUERY_TERM
);
...
...
@@ -779,7 +796,7 @@ class IndexObj {
}
int
SearchOneTarget
(
const
std
::
string
&
colName
,
const
std
::
string
&
colVal
,
uint64_t
val
)
{
SIndexMultiTermQuery
*
mq
=
indexMultiTermQueryCreate
(
MUST
);
SIndexTerm
*
term
=
indexTermCreate
(
0
,
ADD_VALUE
,
TSDB_DATA_TYPE_BINARY
,
colName
.
c_str
(),
colName
.
size
(),
SIndexTerm
*
term
=
indexTermCreate
T
(
0
,
ADD_VALUE
,
TSDB_DATA_TYPE_BINARY
,
colName
.
c_str
(),
colName
.
size
(),
colVal
.
c_str
(),
colVal
.
size
());
indexMultiTermQueryAdd
(
mq
,
term
,
QUERY_TERM
);
...
...
@@ -804,7 +821,7 @@ class IndexObj {
void
PutOne
(
const
std
::
string
&
colName
,
const
std
::
string
&
colVal
)
{
SIndexMultiTerm
*
terms
=
indexMultiTermCreate
();
SIndexTerm
*
term
=
indexTermCreate
(
0
,
ADD_VALUE
,
TSDB_DATA_TYPE_BINARY
,
colName
.
c_str
(),
colName
.
size
(),
SIndexTerm
*
term
=
indexTermCreate
T
(
0
,
ADD_VALUE
,
TSDB_DATA_TYPE_BINARY
,
colName
.
c_str
(),
colName
.
size
(),
colVal
.
c_str
(),
colVal
.
size
());
indexMultiTermAdd
(
terms
,
term
);
Put
(
terms
,
10
);
...
...
@@ -812,7 +829,7 @@ class IndexObj {
}
void
PutOneTarge
(
const
std
::
string
&
colName
,
const
std
::
string
&
colVal
,
uint64_t
val
)
{
SIndexMultiTerm
*
terms
=
indexMultiTermCreate
();
SIndexTerm
*
term
=
indexTermCreate
(
0
,
ADD_VALUE
,
TSDB_DATA_TYPE_BINARY
,
colName
.
c_str
(),
colName
.
size
(),
SIndexTerm
*
term
=
indexTermCreate
T
(
0
,
ADD_VALUE
,
TSDB_DATA_TYPE_BINARY
,
colName
.
c_str
(),
colName
.
size
(),
colVal
.
c_str
(),
colVal
.
size
());
indexMultiTermAdd
(
terms
,
term
);
Put
(
terms
,
val
);
...
...
@@ -858,7 +875,7 @@ TEST_F(IndexEnv2, testIndexOpen) {
{
std
::
string
colName
(
"tag1"
),
colVal
(
"Hello"
);
SIndexTerm
*
term
=
indexTermCreate
(
0
,
ADD_VALUE
,
TSDB_DATA_TYPE_BINARY
,
colName
.
c_str
(),
colName
.
size
(),
SIndexTerm
*
term
=
indexTermCreate
T
(
0
,
ADD_VALUE
,
TSDB_DATA_TYPE_BINARY
,
colName
.
c_str
(),
colName
.
size
(),
colVal
.
c_str
(),
colVal
.
size
());
SIndexMultiTerm
*
terms
=
indexMultiTermCreate
();
indexMultiTermAdd
(
terms
,
term
);
...
...
@@ -873,7 +890,7 @@ TEST_F(IndexEnv2, testIndexOpen) {
size_t
size
=
200
;
std
::
string
colName
(
"tag1"
),
colVal
(
"hello"
);
SIndexTerm
*
term
=
indexTermCreate
(
0
,
ADD_VALUE
,
TSDB_DATA_TYPE_BINARY
,
colName
.
c_str
(),
colName
.
size
(),
SIndexTerm
*
term
=
indexTermCreate
T
(
0
,
ADD_VALUE
,
TSDB_DATA_TYPE_BINARY
,
colName
.
c_str
(),
colName
.
size
(),
colVal
.
c_str
(),
colVal
.
size
());
SIndexMultiTerm
*
terms
=
indexMultiTermCreate
();
indexMultiTermAdd
(
terms
,
term
);
...
...
@@ -888,7 +905,7 @@ TEST_F(IndexEnv2, testIndexOpen) {
size_t
size
=
200
;
std
::
string
colName
(
"tag1"
),
colVal
(
"Hello"
);
SIndexTerm
*
term
=
indexTermCreate
(
0
,
ADD_VALUE
,
TSDB_DATA_TYPE_BINARY
,
colName
.
c_str
(),
colName
.
size
(),
SIndexTerm
*
term
=
indexTermCreate
T
(
0
,
ADD_VALUE
,
TSDB_DATA_TYPE_BINARY
,
colName
.
c_str
(),
colName
.
size
(),
colVal
.
c_str
(),
colVal
.
size
());
SIndexMultiTerm
*
terms
=
indexMultiTermCreate
();
indexMultiTermAdd
(
terms
,
term
);
...
...
@@ -903,7 +920,7 @@ TEST_F(IndexEnv2, testIndexOpen) {
{
std
::
string
colName
(
"tag1"
),
colVal
(
"Hello"
);
SIndexMultiTermQuery
*
mq
=
indexMultiTermQueryCreate
(
MUST
);
SIndexTerm
*
term
=
indexTermCreate
(
0
,
ADD_VALUE
,
TSDB_DATA_TYPE_BINARY
,
colName
.
c_str
(),
colName
.
size
(),
SIndexTerm
*
term
=
indexTermCreate
T
(
0
,
ADD_VALUE
,
TSDB_DATA_TYPE_BINARY
,
colName
.
c_str
(),
colName
.
size
(),
colVal
.
c_str
(),
colVal
.
size
());
indexMultiTermQueryAdd
(
mq
,
term
,
QUERY_TERM
);
...
...
@@ -926,7 +943,7 @@ TEST_F(IndexEnv2, testEmptyIndexOpen) {
{
std
::
string
colName
(
"tag1"
),
colVal
(
"Hello"
);
SIndexTerm
*
term
=
indexTermCreate
(
0
,
ADD_VALUE
,
TSDB_DATA_TYPE_BINARY
,
colName
.
c_str
(),
colName
.
size
(),
SIndexTerm
*
term
=
indexTermCreate
T
(
0
,
ADD_VALUE
,
TSDB_DATA_TYPE_BINARY
,
colName
.
c_str
(),
colName
.
size
(),
colVal
.
c_str
(),
colVal
.
size
());
SIndexMultiTerm
*
terms
=
indexMultiTermCreate
();
indexMultiTermAdd
(
terms
,
term
);
...
...
source/libs/index/test/jsonUT.cc
浏览文件 @
461cd037
...
...
@@ -19,6 +19,18 @@
static
std
::
string
dir
=
TD_TMP_DIR_PATH
"json"
;
static
std
::
string
logDir
=
TD_TMP_DIR_PATH
"log"
;
SIndexTerm
*
indexTermCreateT
(
int64_t
suid
,
SIndexOperOnColumn
oper
,
uint8_t
colType
,
const
char
*
colName
,
int32_t
nColName
,
const
char
*
colVal
,
int32_t
nColVal
)
{
char
buf
[
256
]
=
{
0
};
int16_t
sz
=
nColVal
;
memcpy
(
buf
,
(
uint16_t
*
)
&
sz
,
2
);
memcpy
(
buf
+
2
,
colVal
,
nColVal
);
if
(
colType
==
TSDB_DATA_TYPE_BINARY
)
{
return
indexTermCreate
(
suid
,
oper
,
colType
,
colName
,
nColName
,
buf
,
sizeof
(
buf
));
}
else
{
return
indexTermCreate
(
suid
,
oper
,
colType
,
colName
,
nColName
,
colVal
,
nColVal
);
}
}
static
void
initLog
()
{
const
char
*
defaultLogFileNamePrefix
=
"taoslog"
;
const
int32_t
maxLogFileNum
=
10
;
...
...
@@ -59,8 +71,8 @@ class JsonEnv : public ::testing::Test {
static
void
WriteData
(
SIndexJson
*
index
,
const
std
::
string
&
colName
,
int8_t
dtype
,
void
*
data
,
int
dlen
,
int
tableId
,
int8_t
operType
=
ADD_VALUE
)
{
SIndexTerm
*
term
=
indexTermCreate
(
1
,
(
SIndexOperOnColumn
)
operType
,
dtype
,
colName
.
c_str
(),
colName
.
size
(),
(
const
char
*
)
data
,
dlen
);
SIndexTerm
*
term
=
indexTermCreateT
(
1
,
(
SIndexOperOnColumn
)
operType
,
dtype
,
colName
.
c_str
(),
colName
.
size
(),
(
const
char
*
)
data
,
dlen
);
SIndexMultiTerm
*
terms
=
indexMultiTermCreate
();
indexMultiTermAdd
(
terms
,
term
);
tIndexJsonPut
(
index
,
terms
,
(
int64_t
)
tableId
);
...
...
@@ -70,8 +82,8 @@ static void WriteData(SIndexJson* index, const std::string& colName, int8_t dtyp
static
void
delData
(
SIndexJson
*
index
,
const
std
::
string
&
colName
,
int8_t
dtype
,
void
*
data
,
int
dlen
,
int
tableId
,
int8_t
operType
=
DEL_VALUE
)
{
SIndexTerm
*
term
=
indexTermCreate
(
1
,
(
SIndexOperOnColumn
)
operType
,
dtype
,
colName
.
c_str
(),
colName
.
size
(),
(
const
char
*
)
data
,
dlen
);
SIndexTerm
*
term
=
indexTermCreateT
(
1
,
(
SIndexOperOnColumn
)
operType
,
dtype
,
colName
.
c_str
(),
colName
.
size
(),
(
const
char
*
)
data
,
dlen
);
SIndexMultiTerm
*
terms
=
indexMultiTermCreate
();
indexMultiTermAdd
(
terms
,
term
);
tIndexJsonPut
(
index
,
terms
,
(
int64_t
)
tableId
);
...
...
@@ -83,7 +95,7 @@ static void Search(SIndexJson* index, const std::string& colNam, int8_t dtype, v
std
::
string
colName
(
colNam
);
SIndexMultiTermQuery
*
mq
=
indexMultiTermQueryCreate
(
MUST
);
SIndexTerm
*
q
=
indexTermCreate
(
1
,
ADD_VALUE
,
dtype
,
colName
.
c_str
(),
colName
.
size
(),
(
const
char
*
)
data
,
dlen
);
SIndexTerm
*
q
=
indexTermCreate
T
(
1
,
ADD_VALUE
,
dtype
,
colName
.
c_str
(),
colName
.
size
(),
(
const
char
*
)
data
,
dlen
);
SArray
*
res
=
taosArrayInit
(
1
,
sizeof
(
uint64_t
));
indexMultiTermQueryAdd
(
mq
,
q
,
(
EIndexQueryType
)
filterType
);
...
...
@@ -95,7 +107,7 @@ TEST_F(JsonEnv, testWrite) {
{
std
::
string
colName
(
"test"
);
std
::
string
colVal
(
"ab"
);
SIndexTerm
*
term
=
indexTermCreate
(
1
,
ADD_VALUE
,
TSDB_DATA_TYPE_BINARY
,
colName
.
c_str
(),
colName
.
size
(),
SIndexTerm
*
term
=
indexTermCreate
T
(
1
,
ADD_VALUE
,
TSDB_DATA_TYPE_BINARY
,
colName
.
c_str
(),
colName
.
size
(),
colVal
.
c_str
(),
colVal
.
size
());
SIndexMultiTerm
*
terms
=
indexMultiTermCreate
();
...
...
@@ -108,7 +120,7 @@ TEST_F(JsonEnv, testWrite) {
{
std
::
string
colName
(
"voltage"
);
std
::
string
colVal
(
"ab1"
);
SIndexTerm
*
term
=
indexTermCreate
(
1
,
ADD_VALUE
,
TSDB_DATA_TYPE_BINARY
,
colName
.
c_str
(),
colName
.
size
(),
SIndexTerm
*
term
=
indexTermCreate
T
(
1
,
ADD_VALUE
,
TSDB_DATA_TYPE_BINARY
,
colName
.
c_str
(),
colName
.
size
(),
colVal
.
c_str
(),
colVal
.
size
());
SIndexMultiTerm
*
terms
=
indexMultiTermCreate
();
...
...
@@ -121,7 +133,7 @@ TEST_F(JsonEnv, testWrite) {
{
std
::
string
colName
(
"voltage"
);
std
::
string
colVal
(
"123"
);
SIndexTerm
*
term
=
indexTermCreate
(
1
,
ADD_VALUE
,
TSDB_DATA_TYPE_BINARY
,
colName
.
c_str
(),
colName
.
size
(),
SIndexTerm
*
term
=
indexTermCreate
T
(
1
,
ADD_VALUE
,
TSDB_DATA_TYPE_BINARY
,
colName
.
c_str
(),
colName
.
size
(),
colVal
.
c_str
(),
colVal
.
size
());
SIndexMultiTerm
*
terms
=
indexMultiTermCreate
();
...
...
@@ -136,7 +148,7 @@ TEST_F(JsonEnv, testWrite) {
std
::
string
colVal
(
"ab"
);
SIndexMultiTermQuery
*
mq
=
indexMultiTermQueryCreate
(
MUST
);
SIndexTerm
*
q
=
indexTermCreate
(
1
,
ADD_VALUE
,
TSDB_DATA_TYPE_BINARY
,
colName
.
c_str
(),
colName
.
size
(),
SIndexTerm
*
q
=
indexTermCreate
T
(
1
,
ADD_VALUE
,
TSDB_DATA_TYPE_BINARY
,
colName
.
c_str
(),
colName
.
size
(),
colVal
.
c_str
(),
colVal
.
size
());
SArray
*
result
=
taosArrayInit
(
1
,
sizeof
(
uint64_t
));
...
...
@@ -150,7 +162,7 @@ TEST_F(JsonEnv, testWriteMillonData) {
{
std
::
string
colName
(
"test"
);
std
::
string
colVal
(
"ab"
);
SIndexTerm
*
term
=
indexTermCreate
(
1
,
ADD_VALUE
,
TSDB_DATA_TYPE_BINARY
,
colName
.
c_str
(),
colName
.
size
(),
SIndexTerm
*
term
=
indexTermCreate
T
(
1
,
ADD_VALUE
,
TSDB_DATA_TYPE_BINARY
,
colName
.
c_str
(),
colName
.
size
(),
colVal
.
c_str
(),
colVal
.
size
());
SIndexMultiTerm
*
terms
=
indexMultiTermCreate
();
...
...
@@ -165,7 +177,7 @@ TEST_F(JsonEnv, testWriteMillonData) {
std
::
string
colVal
(
"abxxxxxxxxxxxx"
);
for
(
int
i
=
0
;
i
<
10
;
i
++
)
{
colVal
[
i
%
colVal
.
size
()]
=
'0'
+
i
%
128
;
SIndexTerm
*
term
=
indexTermCreate
(
1
,
ADD_VALUE
,
TSDB_DATA_TYPE_BINARY
,
colName
.
c_str
(),
colName
.
size
(),
SIndexTerm
*
term
=
indexTermCreate
T
(
1
,
ADD_VALUE
,
TSDB_DATA_TYPE_BINARY
,
colName
.
c_str
(),
colName
.
size
(),
colVal
.
c_str
(),
colVal
.
size
());
SIndexMultiTerm
*
terms
=
indexMultiTermCreate
();
...
...
@@ -179,7 +191,7 @@ TEST_F(JsonEnv, testWriteMillonData) {
{
std
::
string
colName
(
"voltagefdadfa"
);
std
::
string
colVal
(
"abxxxxxxxxxxxx"
);
SIndexTerm
*
term
=
indexTermCreate
(
1
,
ADD_VALUE
,
TSDB_DATA_TYPE_BINARY
,
colName
.
c_str
(),
colName
.
size
(),
SIndexTerm
*
term
=
indexTermCreate
T
(
1
,
ADD_VALUE
,
TSDB_DATA_TYPE_BINARY
,
colName
.
c_str
(),
colName
.
size
(),
colVal
.
c_str
(),
colVal
.
size
());
SIndexMultiTerm
*
terms
=
indexMultiTermCreate
();
...
...
@@ -194,7 +206,7 @@ TEST_F(JsonEnv, testWriteMillonData) {
std
::
string
colVal
(
"ab"
);
SIndexMultiTermQuery
*
mq
=
indexMultiTermQueryCreate
(
MUST
);
SIndexTerm
*
q
=
indexTermCreate
(
1
,
ADD_VALUE
,
TSDB_DATA_TYPE_BINARY
,
colName
.
c_str
(),
colName
.
size
(),
SIndexTerm
*
q
=
indexTermCreate
T
(
1
,
ADD_VALUE
,
TSDB_DATA_TYPE_BINARY
,
colName
.
c_str
(),
colName
.
size
(),
colVal
.
c_str
(),
colVal
.
size
());
SArray
*
result
=
taosArrayInit
(
1
,
sizeof
(
uint64_t
));
...
...
@@ -209,7 +221,7 @@ TEST_F(JsonEnv, testWriteMillonData) {
std
::
string
colVal
(
"ab"
);
SIndexMultiTermQuery
*
mq
=
indexMultiTermQueryCreate
(
MUST
);
SIndexTerm
*
q
=
indexTermCreate
(
1
,
ADD_VALUE
,
TSDB_DATA_TYPE_BINARY
,
colName
.
c_str
(),
colName
.
size
(),
SIndexTerm
*
q
=
indexTermCreate
T
(
1
,
ADD_VALUE
,
TSDB_DATA_TYPE_BINARY
,
colName
.
c_str
(),
colName
.
size
(),
colVal
.
c_str
(),
colVal
.
size
());
SArray
*
result
=
taosArrayInit
(
1
,
sizeof
(
uint64_t
));
...
...
@@ -224,7 +236,7 @@ TEST_F(JsonEnv, testWriteMillonData) {
std
::
string
colVal
(
"ab"
);
SIndexMultiTermQuery
*
mq
=
indexMultiTermQueryCreate
(
MUST
);
SIndexTerm
*
q
=
indexTermCreate
(
1
,
ADD_VALUE
,
TSDB_DATA_TYPE_BINARY
,
colName
.
c_str
(),
colName
.
size
(),
SIndexTerm
*
q
=
indexTermCreate
T
(
1
,
ADD_VALUE
,
TSDB_DATA_TYPE_BINARY
,
colName
.
c_str
(),
colName
.
size
(),
colVal
.
c_str
(),
colVal
.
size
());
SArray
*
result
=
taosArrayInit
(
1
,
sizeof
(
uint64_t
));
...
...
@@ -241,7 +253,7 @@ TEST_F(JsonEnv, testWriteJsonNumberData) {
std
::
string
colName
(
"test"
);
// std::string colVal("10");
int
val
=
10
;
SIndexTerm
*
term
=
indexTermCreate
(
1
,
ADD_VALUE
,
TSDB_DATA_TYPE_INT
,
colName
.
c_str
(),
colName
.
size
(),
SIndexTerm
*
term
=
indexTermCreate
T
(
1
,
ADD_VALUE
,
TSDB_DATA_TYPE_INT
,
colName
.
c_str
(),
colName
.
size
(),
(
const
char
*
)
&
val
,
sizeof
(
val
));
SIndexMultiTerm
*
terms
=
indexMultiTermCreate
();
...
...
@@ -254,7 +266,7 @@ TEST_F(JsonEnv, testWriteJsonNumberData) {
{
std
::
string
colName
(
"test2"
);
int
val
=
20
;
SIndexTerm
*
term
=
indexTermCreate
(
1
,
ADD_VALUE
,
TSDB_DATA_TYPE_INT
,
colName
.
c_str
(),
colName
.
size
(),
SIndexTerm
*
term
=
indexTermCreate
T
(
1
,
ADD_VALUE
,
TSDB_DATA_TYPE_INT
,
colName
.
c_str
(),
colName
.
size
(),
(
const
char
*
)
&
val
,
sizeof
(
val
));
SIndexMultiTerm
*
terms
=
indexMultiTermCreate
();
...
...
@@ -267,7 +279,7 @@ TEST_F(JsonEnv, testWriteJsonNumberData) {
{
std
::
string
colName
(
"test"
);
int
val
=
15
;
SIndexTerm
*
term
=
indexTermCreate
(
1
,
ADD_VALUE
,
TSDB_DATA_TYPE_INT
,
colName
.
c_str
(),
colName
.
size
(),
SIndexTerm
*
term
=
indexTermCreate
T
(
1
,
ADD_VALUE
,
TSDB_DATA_TYPE_INT
,
colName
.
c_str
(),
colName
.
size
(),
(
const
char
*
)
&
val
,
sizeof
(
val
));
SIndexMultiTerm
*
terms
=
indexMultiTermCreate
();
...
...
@@ -280,7 +292,7 @@ TEST_F(JsonEnv, testWriteJsonNumberData) {
{
std
::
string
colName
(
"test2"
);
const
char
*
val
=
"test"
;
SIndexTerm
*
term
=
indexTermCreate
(
1
,
ADD_VALUE
,
TSDB_DATA_TYPE_BINARY
,
colName
.
c_str
(),
colName
.
size
(),
SIndexTerm
*
term
=
indexTermCreate
T
(
1
,
ADD_VALUE
,
TSDB_DATA_TYPE_BINARY
,
colName
.
c_str
(),
colName
.
size
(),
(
const
char
*
)
val
,
strlen
(
val
));
SIndexMultiTerm
*
terms
=
indexMultiTermCreate
();
...
...
@@ -294,7 +306,7 @@ TEST_F(JsonEnv, testWriteJsonNumberData) {
std
::
string
colName
(
"test"
);
int
val
=
15
;
SIndexMultiTermQuery
*
mq
=
indexMultiTermQueryCreate
(
MUST
);
SIndexTerm
*
q
=
indexTermCreate
(
1
,
ADD_VALUE
,
TSDB_DATA_TYPE_INT
,
colName
.
c_str
(),
colName
.
size
(),
SIndexTerm
*
q
=
indexTermCreate
T
(
1
,
ADD_VALUE
,
TSDB_DATA_TYPE_INT
,
colName
.
c_str
(),
colName
.
size
(),
(
const
char
*
)
&
val
,
sizeof
(
val
));
SArray
*
result
=
taosArrayInit
(
1
,
sizeof
(
uint64_t
));
...
...
@@ -308,7 +320,7 @@ TEST_F(JsonEnv, testWriteJsonNumberData) {
int
val
=
15
;
SIndexMultiTermQuery
*
mq
=
indexMultiTermQueryCreate
(
MUST
);
SIndexTerm
*
q
=
indexTermCreate
(
1
,
ADD_VALUE
,
TSDB_DATA_TYPE_INT
,
colName
.
c_str
(),
colName
.
size
(),
SIndexTerm
*
q
=
indexTermCreate
T
(
1
,
ADD_VALUE
,
TSDB_DATA_TYPE_INT
,
colName
.
c_str
(),
colName
.
size
(),
(
const
char
*
)
&
val
,
sizeof
(
val
));
SArray
*
result
=
taosArrayInit
(
1
,
sizeof
(
uint64_t
));
...
...
@@ -323,7 +335,7 @@ TEST_F(JsonEnv, testWriteJsonNumberData) {
;
SIndexMultiTermQuery
*
mq
=
indexMultiTermQueryCreate
(
MUST
);
SIndexTerm
*
q
=
indexTermCreate
(
1
,
ADD_VALUE
,
TSDB_DATA_TYPE_INT
,
colName
.
c_str
(),
colName
.
size
(),
SIndexTerm
*
q
=
indexTermCreate
T
(
1
,
ADD_VALUE
,
TSDB_DATA_TYPE_INT
,
colName
.
c_str
(),
colName
.
size
(),
(
const
char
*
)
&
val
,
sizeof
(
int
));
SArray
*
result
=
taosArrayInit
(
1
,
sizeof
(
uint64_t
));
...
...
@@ -338,7 +350,7 @@ TEST_F(JsonEnv, testWriteJsonNumberData) {
// std::string colVal("10");
SIndexMultiTermQuery
*
mq
=
indexMultiTermQueryCreate
(
MUST
);
SIndexTerm
*
q
=
indexTermCreate
(
1
,
ADD_VALUE
,
TSDB_DATA_TYPE_INT
,
colName
.
c_str
(),
colName
.
size
(),
SIndexTerm
*
q
=
indexTermCreate
T
(
1
,
ADD_VALUE
,
TSDB_DATA_TYPE_INT
,
colName
.
c_str
(),
colName
.
size
(),
(
const
char
*
)
&
val
,
sizeof
(
val
));
SArray
*
result
=
taosArrayInit
(
1
,
sizeof
(
uint64_t
));
...
...
@@ -353,7 +365,7 @@ TEST_F(JsonEnv, testWriteJsonNumberData) {
// std::string colVal("10");
SIndexMultiTermQuery
*
mq
=
indexMultiTermQueryCreate
(
MUST
);
SIndexTerm
*
q
=
indexTermCreate
(
1
,
ADD_VALUE
,
TSDB_DATA_TYPE_INT
,
colName
.
c_str
(),
colName
.
size
(),
SIndexTerm
*
q
=
indexTermCreate
T
(
1
,
ADD_VALUE
,
TSDB_DATA_TYPE_INT
,
colName
.
c_str
(),
colName
.
size
(),
(
const
char
*
)
&
val
,
sizeof
(
val
));
SArray
*
result
=
taosArrayInit
(
1
,
sizeof
(
uint64_t
));
...
...
@@ -368,7 +380,7 @@ TEST_F(JsonEnv, testWriteJsonTfileAndCache_INT) {
{
std
::
string
colName
(
"test1"
);
int
val
=
10
;
SIndexTerm
*
term
=
indexTermCreate
(
1
,
ADD_VALUE
,
TSDB_DATA_TYPE_INT
,
colName
.
c_str
(),
colName
.
size
(),
SIndexTerm
*
term
=
indexTermCreate
T
(
1
,
ADD_VALUE
,
TSDB_DATA_TYPE_INT
,
colName
.
c_str
(),
colName
.
size
(),
(
const
char
*
)
&
val
,
sizeof
(
val
));
SIndexMultiTerm
*
terms
=
indexMultiTermCreate
();
...
...
@@ -381,7 +393,7 @@ TEST_F(JsonEnv, testWriteJsonTfileAndCache_INT) {
{
std
::
string
colName
(
"test"
);
std
::
string
colVal
(
"xxxxxxxxxxxxxxxxxxx"
);
SIndexTerm
*
term
=
indexTermCreate
(
1
,
ADD_VALUE
,
TSDB_DATA_TYPE_BINARY
,
colName
.
c_str
(),
colName
.
size
(),
SIndexTerm
*
term
=
indexTermCreate
T
(
1
,
ADD_VALUE
,
TSDB_DATA_TYPE_BINARY
,
colName
.
c_str
(),
colName
.
size
(),
colVal
.
c_str
(),
colVal
.
size
());
SIndexMultiTerm
*
terms
=
indexMultiTermCreate
();
...
...
@@ -396,7 +408,7 @@ TEST_F(JsonEnv, testWriteJsonTfileAndCache_INT) {
int
val
=
10
;
SIndexMultiTermQuery
*
mq
=
indexMultiTermQueryCreate
(
MUST
);
SIndexTerm
*
q
=
indexTermCreate
(
1
,
ADD_VALUE
,
TSDB_DATA_TYPE_INT
,
colName
.
c_str
(),
colName
.
size
(),
SIndexTerm
*
q
=
indexTermCreate
T
(
1
,
ADD_VALUE
,
TSDB_DATA_TYPE_INT
,
colName
.
c_str
(),
colName
.
size
(),
(
const
char
*
)
&
val
,
sizeof
(
val
));
SArray
*
result
=
taosArrayInit
(
1
,
sizeof
(
uint64_t
));
...
...
@@ -410,7 +422,7 @@ TEST_F(JsonEnv, testWriteJsonTfileAndCache_INT) {
int
val
=
10
;
SIndexMultiTermQuery
*
mq
=
indexMultiTermQueryCreate
(
MUST
);
SIndexTerm
*
q
=
indexTermCreate
(
1
,
ADD_VALUE
,
TSDB_DATA_TYPE_INT
,
colName
.
c_str
(),
colName
.
size
(),
SIndexTerm
*
q
=
indexTermCreate
T
(
1
,
ADD_VALUE
,
TSDB_DATA_TYPE_INT
,
colName
.
c_str
(),
colName
.
size
(),
(
const
char
*
)
&
val
,
sizeof
(
int
));
SArray
*
result
=
taosArrayInit
(
1
,
sizeof
(
uint64_t
));
...
...
@@ -425,7 +437,7 @@ TEST_F(JsonEnv, testWriteJsonTfileAndCache_INT) {
int
val
=
10
;
SIndexMultiTermQuery
*
mq
=
indexMultiTermQueryCreate
(
MUST
);
SIndexTerm
*
q
=
indexTermCreate
(
1
,
ADD_VALUE
,
TSDB_DATA_TYPE_INT
,
colName
.
c_str
(),
colName
.
size
(),
SIndexTerm
*
q
=
indexTermCreate
T
(
1
,
ADD_VALUE
,
TSDB_DATA_TYPE_INT
,
colName
.
c_str
(),
colName
.
size
(),
(
const
char
*
)
&
val
,
sizeof
(
val
));
SArray
*
result
=
taosArrayInit
(
1
,
sizeof
(
uint64_t
));
...
...
@@ -439,7 +451,7 @@ TEST_F(JsonEnv, testWriteJsonTfileAndCache_INT) {
int
val
=
10
;
SIndexMultiTermQuery
*
mq
=
indexMultiTermQueryCreate
(
MUST
);
SIndexTerm
*
q
=
indexTermCreate
(
1
,
ADD_VALUE
,
TSDB_DATA_TYPE_INT
,
colName
.
c_str
(),
colName
.
size
(),
SIndexTerm
*
q
=
indexTermCreate
T
(
1
,
ADD_VALUE
,
TSDB_DATA_TYPE_INT
,
colName
.
c_str
(),
colName
.
size
(),
(
const
char
*
)
&
val
,
sizeof
(
val
));
SArray
*
result
=
taosArrayInit
(
1
,
sizeof
(
uint64_t
));
...
...
@@ -453,7 +465,7 @@ TEST_F(JsonEnv, testWriteJsonTfileAndCache_INT) {
int
val
=
10
;
SIndexMultiTermQuery
*
mq
=
indexMultiTermQueryCreate
(
MUST
);
SIndexTerm
*
q
=
indexTermCreate
(
1
,
ADD_VALUE
,
TSDB_DATA_TYPE_INT
,
colName
.
c_str
(),
colName
.
size
(),
SIndexTerm
*
q
=
indexTermCreate
T
(
1
,
ADD_VALUE
,
TSDB_DATA_TYPE_INT
,
colName
.
c_str
(),
colName
.
size
(),
(
const
char
*
)
&
val
,
sizeof
(
val
));
SArray
*
result
=
taosArrayInit
(
1
,
sizeof
(
uint64_t
));
...
...
@@ -466,7 +478,7 @@ TEST_F(JsonEnv, testWriteJsonTfileAndCache_INT) {
std
::
string
colName
(
"other_column"
);
int
val
=
100
;
SIndexTerm
*
term
=
indexTermCreate
(
1
,
ADD_VALUE
,
TSDB_DATA_TYPE_INT
,
colName
.
c_str
(),
colName
.
size
(),
SIndexTerm
*
term
=
indexTermCreate
T
(
1
,
ADD_VALUE
,
TSDB_DATA_TYPE_INT
,
colName
.
c_str
(),
colName
.
size
(),
(
const
char
*
)
&
val
,
sizeof
(
val
));
SIndexMultiTerm
*
terms
=
indexMultiTermCreate
();
...
...
@@ -482,7 +494,7 @@ TEST_F(JsonEnv, testWriteJsonTfileAndCache_INT) {
// std::string colVal("10");
SIndexMultiTermQuery
*
mq
=
indexMultiTermQueryCreate
(
MUST
);
SIndexTerm
*
q
=
indexTermCreate
(
1
,
ADD_VALUE
,
TSDB_DATA_TYPE_INT
,
colName
.
c_str
(),
colName
.
size
(),
SIndexTerm
*
q
=
indexTermCreate
T
(
1
,
ADD_VALUE
,
TSDB_DATA_TYPE_INT
,
colName
.
c_str
(),
colName
.
size
(),
(
const
char
*
)
&
val
,
sizeof
(
val
));
SArray
*
result
=
taosArrayInit
(
1
,
sizeof
(
uint64_t
));
...
...
@@ -494,7 +506,7 @@ TEST_F(JsonEnv, testWriteJsonTfileAndCache_INT) {
{
std
::
string
colName
(
"test1"
);
int
val
=
15
;
SIndexTerm
*
term
=
indexTermCreate
(
1
,
ADD_VALUE
,
TSDB_DATA_TYPE_INT
,
colName
.
c_str
(),
colName
.
size
(),
SIndexTerm
*
term
=
indexTermCreate
T
(
1
,
ADD_VALUE
,
TSDB_DATA_TYPE_INT
,
colName
.
c_str
(),
colName
.
size
(),
(
const
char
*
)
&
val
,
sizeof
(
val
));
SIndexMultiTerm
*
terms
=
indexMultiTermCreate
();
...
...
@@ -510,7 +522,7 @@ TEST_F(JsonEnv, testWriteJsonTfileAndCache_INT) {
// std::string colVal("10");
SIndexMultiTermQuery
*
mq
=
indexMultiTermQueryCreate
(
MUST
);
SIndexTerm
*
q
=
indexTermCreate
(
1
,
ADD_VALUE
,
TSDB_DATA_TYPE_INT
,
colName
.
c_str
(),
colName
.
size
(),
SIndexTerm
*
q
=
indexTermCreate
T
(
1
,
ADD_VALUE
,
TSDB_DATA_TYPE_INT
,
colName
.
c_str
(),
colName
.
size
(),
(
const
char
*
)
&
val
,
sizeof
(
val
));
SArray
*
result
=
taosArrayInit
(
1
,
sizeof
(
uint64_t
));
...
...
source/libs/nodes/src/nodesUtilFuncs.c
浏览文件 @
461cd037
...
...
@@ -1096,7 +1096,7 @@ bool nodesIsArithmeticOp(const SOperatorNode* pOp) {
case
OP_TYPE_SUB
:
case
OP_TYPE_MULTI
:
case
OP_TYPE_DIV
:
case
OP_TYPE_
MOD
:
case
OP_TYPE_
REM
:
return
true
;
default:
break
;
...
...
source/libs/parser/inc/sql.y
浏览文件 @
461cd037
...
...
@@ -611,7 +611,7 @@ expression(A) ::= expression(B) NK_SLASH expression(C).
expression(A) ::= expression(B) NK_REM expression(C). {
SToken s = getTokenFromRawExprNode(pCxt, B);
SToken e = getTokenFromRawExprNode(pCxt, C);
A = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_
MOD, releaseRawExprNode(pCxt, B), releaseRawExprNode(pCxt, C)));
A = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_
REM, releaseRawExprNode(pCxt, B), releaseRawExprNode(pCxt, C)));
}
expression(A) ::= column_reference(B) NK_ARROW NK_STRING(C). {
SToken s = getTokenFromRawExprNode(pCxt, B);
...
...
source/libs/parser/src/sql.c
浏览文件 @
461cd037
...
...
@@ -4079,7 +4079,7 @@ static YYACTIONTYPE yy_reduce(
{
SToken
s
=
getTokenFromRawExprNode
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy172
);
SToken
e
=
getTokenFromRawExprNode
(
pCxt
,
yymsp
[
0
].
minor
.
yy172
);
yylhsminor
.
yy172
=
createRawExprNodeExt
(
pCxt
,
&
s
,
&
e
,
createOperatorNode
(
pCxt
,
OP_TYPE_
MOD
,
releaseRawExprNode
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy172
),
releaseRawExprNode
(
pCxt
,
yymsp
[
0
].
minor
.
yy172
)));
yylhsminor
.
yy172
=
createRawExprNodeExt
(
pCxt
,
&
s
,
&
e
,
createOperatorNode
(
pCxt
,
OP_TYPE_
REM
,
releaseRawExprNode
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy172
),
releaseRawExprNode
(
pCxt
,
yymsp
[
0
].
minor
.
yy172
)));
}
yymsp
[
-
2
].
minor
.
yy172
=
yylhsminor
.
yy172
;
break
;
...
...
source/libs/scalar/inc/filterInt.h
浏览文件 @
461cd037
...
...
@@ -350,7 +350,7 @@ struct SFilterInfo {
extern
bool
filterDoCompare
(
__compar_fn_t
func
,
uint8_t
optr
,
void
*
left
,
void
*
right
);
extern
__compar_fn_t
filterGetCompFunc
(
int32_t
type
,
int32_t
optr
);
extern
OptrStr
gOptrStr
[];
#ifdef __cplusplus
}
...
...
source/libs/scalar/src/filter.c
浏览文件 @
461cd037
...
...
@@ -29,8 +29,9 @@ OptrStr gOptrStr[] = {
{
OP_TYPE_SUB
,
"-"
},
{
OP_TYPE_MULTI
,
"*"
},
{
OP_TYPE_DIV
,
"/"
},
{
OP_TYPE_MOD
,
"%"
},
{
OP_TYPE_REM
,
"%"
},
{
OP_TYPE_MINUS
,
"minus"
},
{
OP_TYPE_ASSIGN
,
"assign"
},
// bit operator
{
OP_TYPE_BIT_AND
,
"&"
},
{
OP_TYPE_BIT_OR
,
"|"
},
...
...
source/libs/scalar/src/sclvector.c
浏览文件 @
461cd037
此差异已折叠。
点击以展开。
source/libs/scalar/test/scalar/scalarTests.cpp
浏览文件 @
461cd037
此差异已折叠。
点击以展开。
tests/pytest/util/dnodes.py
浏览文件 @
461cd037
...
...
@@ -318,7 +318,7 @@ class TDDnode:
print
(
cmd
)
if
(
not
self
.
remoteIP
==
""
):
self
.
remoteExec
(
self
.
cfgDict
,
"tdDnodes.d
eploy(%d,updateCfgDict)
\n
tdDnodes.start(%d)"
%
(
self
.
index
,
self
.
index
))
self
.
remoteExec
(
self
.
cfgDict
,
"tdDnodes.d
nodes[%d].deployed=1
\n
tdDnodes.dnodes[%d].logDir=
\"
%%s/sim/dnode%%d/log
\"
%%(tdDnodes.dnodes[%d].path,%d)
\n
tdDnodes.dnodes[%d].cfgDir=
\"
%%s/sim/dnode%%d/cfg
\"
%%(tdDnodes.dnodes[%d].path,%d)
\n
tdDnodes.start(%d)"
%
(
self
.
index
-
1
,
self
.
index
-
1
,
self
.
index
-
1
,
self
.
index
,
self
.
index
-
1
,
self
.
index
-
1
,
self
.
index
,
self
.
index
))
self
.
running
=
1
else
:
if
os
.
system
(
cmd
)
!=
0
:
...
...
tests/system-test/0-others/udf_create.py
浏览文件 @
461cd037
...
...
@@ -25,7 +25,7 @@ class TDTestCase:
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
if
(
"taosd"
in
files
):
if
(
"taosd"
in
files
or
"taosd.exe"
in
files
):
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
if
(
"packaging"
not
in
rootRealPath
):
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
...
...
@@ -41,11 +41,19 @@ class TDTestCase:
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
print
(
projPath
)
libudf1
=
subprocess
.
Popen
(
'find %s -name "libudf1.so"|grep lib|head -n1'
%
projPath
,
shell
=
True
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
STDOUT
).
stdout
.
read
().
decode
(
"utf-8"
)
libudf2
=
subprocess
.
Popen
(
'find %s -name "libudf2.so"|grep lib|head -n1'
%
projPath
,
shell
=
True
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
STDOUT
).
stdout
.
read
().
decode
(
"utf-8"
)
os
.
system
(
"mkdir /tmp/udf/"
)
os
.
system
(
"cp %s /tmp/udf/ "
%
libudf1
.
replace
(
"
\n
"
,
""
))
os
.
system
(
"cp %s /tmp/udf/ "
%
libudf2
.
replace
(
"
\n
"
,
""
))
if
platform
.
system
().
lower
()
==
'windows'
:
self
.
libudf1
=
subprocess
.
Popen
(
'(for /r %s %%i in ("udf1.d*") do @echo %%i)|grep lib|head -n1'
%
projPath
,
shell
=
True
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
STDOUT
).
stdout
.
read
().
decode
(
"utf-8"
)
self
.
libudf2
=
subprocess
.
Popen
(
'(for /r %s %%i in ("udf2.d*") do @echo %%i)|grep lib|head -n1'
%
projPath
,
shell
=
True
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
STDOUT
).
stdout
.
read
().
decode
(
"utf-8"
)
if
(
not
tdDnodes
.
dnodes
[
0
].
remoteIP
==
""
):
tdDnodes
.
dnodes
[
0
].
remote_conn
.
get
(
tdDnodes
.
dnodes
[
0
].
config
[
"path"
]
+
'/debug/build/lib/libudf1.so'
,
projPath
+
"
\\
debug
\\
build
\\
lib
\\
"
)
tdDnodes
.
dnodes
[
0
].
remote_conn
.
get
(
tdDnodes
.
dnodes
[
0
].
config
[
"path"
]
+
'/debug/build/lib/libudf2.so'
,
projPath
+
"
\\
debug
\\
build
\\
lib
\\
"
)
self
.
libudf1
=
self
.
libudf1
.
replace
(
'udf1.dll'
,
'libudf1.so'
)
self
.
libudf2
=
self
.
libudf2
.
replace
(
'udf2.dll'
,
'libudf2.so'
)
else
:
self
.
libudf1
=
subprocess
.
Popen
(
'find %s -name "libudf1.so"|grep lib|head -n1'
%
projPath
,
shell
=
True
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
STDOUT
).
stdout
.
read
().
decode
(
"utf-8"
)
self
.
libudf2
=
subprocess
.
Popen
(
'find %s -name "libudf2.so"|grep lib|head -n1'
%
projPath
,
shell
=
True
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
STDOUT
).
stdout
.
read
().
decode
(
"utf-8"
)
self
.
libudf1
=
self
.
libudf1
.
replace
(
'
\r
'
,
''
).
replace
(
'
\n
'
,
''
)
self
.
libudf2
=
self
.
libudf2
.
replace
(
'
\r
'
,
''
).
replace
(
'
\n
'
,
''
)
def
prepare_data
(
self
):
...
...
@@ -136,11 +144,11 @@ class TDTestCase:
for
i
in
range
(
5
):
# create scalar functions
tdSql
.
execute
(
"create function udf1 as '
/tmp/udf/libudf1.so' outputtype int bufSize 8;"
)
tdSql
.
execute
(
"create function udf1 as '
%s' outputtype int bufSize 8;"
%
self
.
libudf1
)
# create aggregate functions
tdSql
.
execute
(
"create aggregate function udf2 as '
/tmp/udf/libudf2.so' outputtype double bufSize 8;"
)
tdSql
.
execute
(
"create aggregate function udf2 as '
%s' outputtype double bufSize 8;"
%
self
.
libudf2
)
functions
=
tdSql
.
getResult
(
"show functions"
)
function_nums
=
len
(
functions
)
...
...
@@ -161,11 +169,11 @@ class TDTestCase:
tdLog
.
info
(
"drop two udf functions success "
)
# create scalar functions
tdSql
.
execute
(
"create function udf1 as '
/tmp/udf/libudf1.so' outputtype int bufSize 8;"
)
tdSql
.
execute
(
"create function udf1 as '
%s' outputtype int bufSize 8;"
%
self
.
libudf1
)
# create aggregate functions
tdSql
.
execute
(
"create aggregate function udf2 as '
/tmp/udf/libudf2.so' outputtype double bufSize 8;"
)
tdSql
.
execute
(
"create aggregate function udf2 as '
%s' outputtype double bufSize 8;"
%
self
.
libudf2
)
functions
=
tdSql
.
getResult
(
"show functions"
)
function_nums
=
len
(
functions
)
...
...
@@ -533,8 +541,8 @@ class TDTestCase:
tdSql
.
query
(
"drop function udf2 "
)
# create function without buffer
tdSql
.
execute
(
"create function udf1 as '
/tmp/udf/libudf1.so' outputtype int"
)
tdSql
.
execute
(
"create aggregate function udf2 as '
/tmp/udf/libudf2.so' outputtype double"
)
tdSql
.
execute
(
"create function udf1 as '
%s' outputtype int"
%
self
.
libudf1
)
tdSql
.
execute
(
"create aggregate function udf2 as '
%s' outputtype double"
%
self
.
libudf2
)
udf1_sqls
,
udf2_sqls
=
self
.
try_query_sql
()
for
scalar_sql
in
udf1_sqls
:
...
...
@@ -549,8 +557,8 @@ class TDTestCase:
tdSql
.
query
(
"drop function udf2 "
)
# create function without buffer
tdSql
.
execute
(
"create aggregate function udf1 as '
/tmp/udf/libudf1.so' outputtype int bufSize 8 "
)
tdSql
.
execute
(
"create function udf2 as '
/tmp/udf/libudf2.so' outputtype double bufSize 8"
)
tdSql
.
execute
(
"create aggregate function udf1 as '
%s' outputtype int bufSize 8 "
%
self
.
libudf1
)
tdSql
.
execute
(
"create function udf2 as '
%s' outputtype double bufSize 8"
%
self
.
libudf2
)
udf1_sqls
,
udf2_sqls
=
self
.
try_query_sql
()
for
scalar_sql
in
udf1_sqls
:
...
...
@@ -558,8 +566,8 @@ class TDTestCase:
for
aggregate_sql
in
udf2_sqls
:
tdSql
.
error
(
aggregate_sql
)
tdSql
.
execute
(
" create function db as '
/tmp/udf/libudf1.so' outputtype int bufSize 8 "
)
tdSql
.
execute
(
" create aggregate function test as '
/tmp/udf/libudf1.so' outputtype int bufSize 8 "
)
tdSql
.
execute
(
" create function db as '
%s' outputtype int bufSize 8 "
%
self
.
libudf1
)
tdSql
.
execute
(
" create aggregate function test as '
%s' outputtype int bufSize 8 "
%
self
.
libudf1
)
tdSql
.
error
(
" select db(c1) from stb1 "
)
tdSql
.
error
(
" select db(c1,c6), db(c6) from stb1 "
)
tdSql
.
error
(
" select db(num1,num2), db(num1) from tb "
)
...
...
@@ -607,17 +615,17 @@ class TDTestCase:
tdLog
.
info
(
" create function name is not build_in functions "
)
tdSql
.
execute
(
" drop function udf1 "
)
tdSql
.
execute
(
" drop function udf2 "
)
tdSql
.
error
(
"create function max as '
/tmp/udf/libudf1.so' outputtype int bufSize 8"
)
tdSql
.
error
(
"create aggregate function sum as '
/tmp/udf/libudf2.so' outputtype double bufSize 8"
)
tdSql
.
error
(
"create function max as '
/tmp/udf/libudf1.so' outputtype int bufSize 8"
)
tdSql
.
error
(
"create aggregate function sum as '
/tmp/udf/libudf2.so' outputtype double bufSize 8"
)
tdSql
.
error
(
"create aggregate function tbname as '
/tmp/udf/libudf2.so' outputtype double bufSize 8"
)
tdSql
.
error
(
"create aggregate function function as '
/tmp/udf/libudf2.so' outputtype double bufSize 8"
)
tdSql
.
error
(
"create aggregate function stable as '
/tmp/udf/libudf2.so' outputtype double bufSize 8"
)
tdSql
.
error
(
"create aggregate function union as '
/tmp/udf/libudf2.so' outputtype double bufSize 8"
)
tdSql
.
error
(
"create aggregate function 123 as '
/tmp/udf/libudf2.so' outputtype double bufSize 8"
)
tdSql
.
error
(
"create aggregate function 123db as '
/tmp/udf/libudf2.so' outputtype double bufSize 8"
)
tdSql
.
error
(
"create aggregate function mnode as '
/tmp/udf/libudf2.so' outputtype double bufSize 8"
)
tdSql
.
error
(
"create function max as '
%s' outputtype int bufSize 8"
%
self
.
libudf1
)
tdSql
.
error
(
"create aggregate function sum as '
%s' outputtype double bufSize 8"
%
self
.
libudf2
)
tdSql
.
error
(
"create function max as '
%s' outputtype int bufSize 8"
%
self
.
libudf1
)
tdSql
.
error
(
"create aggregate function sum as '
%s' outputtype double bufSize 8"
%
self
.
libudf2
)
tdSql
.
error
(
"create aggregate function tbname as '
%s' outputtype double bufSize 8"
%
self
.
libudf2
)
tdSql
.
error
(
"create aggregate function function as '
%s' outputtype double bufSize 8"
%
self
.
libudf2
)
tdSql
.
error
(
"create aggregate function stable as '
%s' outputtype double bufSize 8"
%
self
.
libudf2
)
tdSql
.
error
(
"create aggregate function union as '
%s' outputtype double bufSize 8"
%
self
.
libudf2
)
tdSql
.
error
(
"create aggregate function 123 as '
%s' outputtype double bufSize 8"
%
self
.
libudf2
)
tdSql
.
error
(
"create aggregate function 123db as '
%s' outputtype double bufSize 8"
%
self
.
libudf2
)
tdSql
.
error
(
"create aggregate function mnode as '
%s' outputtype double bufSize 8"
%
self
.
libudf2
)
def
restart_taosd_query_udf
(
self
):
...
...
tests/system-test/0-others/udf_restart_taosd.py
浏览文件 @
461cd037
...
...
@@ -25,7 +25,7 @@ class TDTestCase:
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
if
(
"taosd"
in
files
):
if
(
"taosd"
in
files
or
"taosd.exe"
in
files
):
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
if
(
"packaging"
not
in
rootRealPath
):
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
...
...
@@ -41,11 +41,19 @@ class TDTestCase:
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
print
(
projPath
)
libudf1
=
subprocess
.
Popen
(
'find %s -name "libudf1.so"|grep lib|head -n1'
%
projPath
,
shell
=
True
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
STDOUT
).
stdout
.
read
().
decode
(
"utf-8"
)
libudf2
=
subprocess
.
Popen
(
'find %s -name "libudf2.so"|grep lib|head -n1'
%
projPath
,
shell
=
True
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
STDOUT
).
stdout
.
read
().
decode
(
"utf-8"
)
os
.
system
(
"mkdir /tmp/udf/"
)
os
.
system
(
"cp %s /tmp/udf/ "
%
libudf1
.
replace
(
"
\n
"
,
""
))
os
.
system
(
"cp %s /tmp/udf/ "
%
libudf2
.
replace
(
"
\n
"
,
""
))
if
platform
.
system
().
lower
()
==
'windows'
:
self
.
libudf1
=
subprocess
.
Popen
(
'(for /r %s %%i in ("udf1.d*") do @echo %%i)|grep lib|head -n1'
%
projPath
,
shell
=
True
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
STDOUT
).
stdout
.
read
().
decode
(
"utf-8"
)
self
.
libudf2
=
subprocess
.
Popen
(
'(for /r %s %%i in ("udf2.d*") do @echo %%i)|grep lib|head -n1'
%
projPath
,
shell
=
True
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
STDOUT
).
stdout
.
read
().
decode
(
"utf-8"
)
if
(
not
tdDnodes
.
dnodes
[
0
].
remoteIP
==
""
):
tdDnodes
.
dnodes
[
0
].
remote_conn
.
get
(
tdDnodes
.
dnodes
[
0
].
config
[
"path"
]
+
'/debug/build/lib/libudf1.so'
,
projPath
+
"
\\
debug
\\
build
\\
lib
\\
"
)
tdDnodes
.
dnodes
[
0
].
remote_conn
.
get
(
tdDnodes
.
dnodes
[
0
].
config
[
"path"
]
+
'/debug/build/lib/libudf2.so'
,
projPath
+
"
\\
debug
\\
build
\\
lib
\\
"
)
self
.
libudf1
=
self
.
libudf1
.
replace
(
'udf1.dll'
,
'libudf1.so'
)
self
.
libudf2
=
self
.
libudf2
.
replace
(
'udf2.dll'
,
'libudf2.so'
)
else
:
self
.
libudf1
=
subprocess
.
Popen
(
'find %s -name "libudf1.so"|grep lib|head -n1'
%
projPath
,
shell
=
True
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
STDOUT
).
stdout
.
read
().
decode
(
"utf-8"
)
self
.
libudf2
=
subprocess
.
Popen
(
'find %s -name "libudf2.so"|grep lib|head -n1'
%
projPath
,
shell
=
True
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
STDOUT
).
stdout
.
read
().
decode
(
"utf-8"
)
self
.
libudf1
=
self
.
libudf1
.
replace
(
'
\r
'
,
''
).
replace
(
'
\n
'
,
''
)
self
.
libudf2
=
self
.
libudf2
.
replace
(
'
\r
'
,
''
).
replace
(
'
\n
'
,
''
)
def
prepare_data
(
self
):
...
...
@@ -136,11 +144,11 @@ class TDTestCase:
for
i
in
range
(
5
):
# create scalar functions
tdSql
.
execute
(
"create function udf1 as '
/tmp/udf/libudf1.so' outputtype int bufSize 8;"
)
tdSql
.
execute
(
"create function udf1 as '
%s' outputtype int bufSize 8;"
%
self
.
libudf1
)
# create aggregate functions
tdSql
.
execute
(
"create aggregate function udf2 as '
/tmp/udf/libudf2.so' outputtype double bufSize 8;"
)
tdSql
.
execute
(
"create aggregate function udf2 as '
%s' outputtype double bufSize 8;"
%
self
.
libudf2
)
functions
=
tdSql
.
getResult
(
"show functions"
)
function_nums
=
len
(
functions
)
...
...
@@ -161,11 +169,11 @@ class TDTestCase:
tdLog
.
info
(
"drop two udf functions success "
)
# create scalar functions
tdSql
.
execute
(
"create function udf1 as '
/tmp/udf/libudf1.so' outputtype int bufSize 8;"
)
tdSql
.
execute
(
"create function udf1 as '
%s' outputtype int bufSize 8;"
%
self
.
libudf1
)
# create aggregate functions
tdSql
.
execute
(
"create aggregate function udf2 as '
/tmp/udf/libudf2.so' outputtype double bufSize 8;"
)
tdSql
.
execute
(
"create aggregate function udf2 as '
%s' outputtype double bufSize 8;"
%
self
.
libudf2
)
functions
=
tdSql
.
getResult
(
"show functions"
)
function_nums
=
len
(
functions
)
...
...
@@ -533,8 +541,8 @@ class TDTestCase:
tdSql
.
query
(
"drop function udf2 "
)
# create function without buffer
tdSql
.
execute
(
"create function udf1 as '
/tmp/udf/libudf1.so' outputtype int"
)
tdSql
.
execute
(
"create aggregate function udf2 as '
/tmp/udf/libudf2.so' outputtype double"
)
tdSql
.
execute
(
"create function udf1 as '
%s' outputtype int"
%
self
.
libudf1
)
tdSql
.
execute
(
"create aggregate function udf2 as '
%s' outputtype double"
%
self
.
libudf2
)
udf1_sqls
,
udf2_sqls
=
self
.
try_query_sql
()
for
scalar_sql
in
udf1_sqls
:
...
...
@@ -549,8 +557,8 @@ class TDTestCase:
tdSql
.
query
(
"drop function udf2 "
)
# create function without buffer
tdSql
.
execute
(
"create aggregate function udf1 as '
/tmp/udf/libudf1.so' outputtype int bufSize 8 "
)
tdSql
.
execute
(
"create function udf2 as '
/tmp/udf/libudf2.so' outputtype double bufSize 8"
)
tdSql
.
execute
(
"create aggregate function udf1 as '
%s' outputtype int bufSize 8 "
%
self
.
libudf1
)
tdSql
.
execute
(
"create function udf2 as '
%s' outputtype double bufSize 8"
%
self
.
libudf2
)
udf1_sqls
,
udf2_sqls
=
self
.
try_query_sql
()
for
scalar_sql
in
udf1_sqls
:
...
...
@@ -558,8 +566,8 @@ class TDTestCase:
for
aggregate_sql
in
udf2_sqls
:
tdSql
.
error
(
aggregate_sql
)
tdSql
.
execute
(
" create function db as '
/tmp/udf/libudf1.so' outputtype int bufSize 8 "
)
tdSql
.
execute
(
" create aggregate function test as '
/tmp/udf/libudf1.so' outputtype int bufSize 8 "
)
tdSql
.
execute
(
" create function db as '
%s' outputtype int bufSize 8 "
%
self
.
libudf1
)
tdSql
.
execute
(
" create aggregate function test as '
%s' outputtype int bufSize 8 "
%
self
.
libudf1
)
tdSql
.
error
(
" select db(c1) from stb1 "
)
tdSql
.
error
(
" select db(c1,c6), db(c6) from stb1 "
)
tdSql
.
error
(
" select db(num1,num2), db(num1) from tb "
)
...
...
@@ -607,17 +615,17 @@ class TDTestCase:
tdLog
.
info
(
" create function name is not build_in functions "
)
tdSql
.
execute
(
" drop function udf1 "
)
tdSql
.
execute
(
" drop function udf2 "
)
tdSql
.
error
(
"create function max as '
/tmp/udf/libudf1.so' outputtype int bufSize 8"
)
tdSql
.
error
(
"create aggregate function sum as '
/tmp/udf/libudf2.so' outputtype double bufSize 8"
)
tdSql
.
error
(
"create function max as '
/tmp/udf/libudf1.so' outputtype int bufSize 8"
)
tdSql
.
error
(
"create aggregate function sum as '
/tmp/udf/libudf2.so' outputtype double bufSize 8"
)
tdSql
.
error
(
"create aggregate function tbname as '
/tmp/udf/libudf2.so' outputtype double bufSize 8"
)
tdSql
.
error
(
"create aggregate function function as '
/tmp/udf/libudf2.so' outputtype double bufSize 8"
)
tdSql
.
error
(
"create aggregate function stable as '
/tmp/udf/libudf2.so' outputtype double bufSize 8"
)
tdSql
.
error
(
"create aggregate function union as '
/tmp/udf/libudf2.so' outputtype double bufSize 8"
)
tdSql
.
error
(
"create aggregate function 123 as '
/tmp/udf/libudf2.so' outputtype double bufSize 8"
)
tdSql
.
error
(
"create aggregate function 123db as '
/tmp/udf/libudf2.so' outputtype double bufSize 8"
)
tdSql
.
error
(
"create aggregate function mnode as '
/tmp/udf/libudf2.so' outputtype double bufSize 8"
)
tdSql
.
error
(
"create function max as '
%s' outputtype int bufSize 8"
%
self
.
libudf1
)
tdSql
.
error
(
"create aggregate function sum as '
%s' outputtype double bufSize 8"
%
self
.
libudf2
)
tdSql
.
error
(
"create function max as '
%s' outputtype int bufSize 8"
%
self
.
libudf1
)
tdSql
.
error
(
"create aggregate function sum as '
%s' outputtype double bufSize 8"
%
self
.
libudf2
)
tdSql
.
error
(
"create aggregate function tbname as '
%s' outputtype double bufSize 8"
%
self
.
libudf2
)
tdSql
.
error
(
"create aggregate function function as '
%s' outputtype double bufSize 8"
%
self
.
libudf2
)
tdSql
.
error
(
"create aggregate function stable as '
%s' outputtype double bufSize 8"
%
self
.
libudf2
)
tdSql
.
error
(
"create aggregate function union as '
%s' outputtype double bufSize 8"
%
self
.
libudf2
)
tdSql
.
error
(
"create aggregate function 123 as '
%s' outputtype double bufSize 8"
%
self
.
libudf2
)
tdSql
.
error
(
"create aggregate function 123db as '
%s' outputtype double bufSize 8"
%
self
.
libudf2
)
tdSql
.
error
(
"create aggregate function mnode as '
%s' outputtype double bufSize 8"
%
self
.
libudf2
)
def
restart_taosd_query_udf
(
self
):
...
...
tests/system-test/2-query/json_tag.py
浏览文件 @
461cd037
...
...
@@ -137,9 +137,9 @@ class TDTestCase:
tdSql
.
checkRows
(
9
)
tdSql
.
query
(
"select jtag from jsons1"
)
tdSql
.
checkRows
(
13
)
#
tdSql.query("select jtag from jsons1 where jtag is null")
tdSql
.
query
(
"select jtag from jsons1 where jtag is null"
)
# tdSql.checkRows(5)
#
tdSql.query("select jtag from jsons1 where jtag is not null")
tdSql
.
query
(
"select jtag from jsons1 where jtag is not null"
)
# tdSql.checkRows(8)
# test jtag is NULL
...
...
@@ -260,9 +260,9 @@ class TDTestCase:
# tdSql.checkRows(1)
#
# # where json is null
#
tdSql.query("select * from jsons1 where jtag is null")
tdSql
.
query
(
"select * from jsons1 where jtag is null"
)
# tdSql.checkRows(1)
#
tdSql.query("select * from jsons1 where jtag is not null")
tdSql
.
query
(
"select * from jsons1 where jtag is not null"
)
# tdSql.checkRows(8)
#
# # where json key is null
...
...
@@ -389,8 +389,8 @@ class TDTestCase:
tdSql
.
checkData
(
2
,
1
,
"11.000000000"
)
tdSql
.
checkData
(
5
,
0
,
1
)
tdSql
.
checkData
(
5
,
1
,
"false"
)
#
tdSql.checkData(6, 0, 1)
#
tdSql.checkData(6, 1, "null")
tdSql
.
checkData
(
6
,
0
,
1
)
tdSql
.
checkData
(
6
,
1
,
"null"
)
tdSql
.
checkData
(
7
,
0
,
2
)
tdSql
.
checkData
(
7
,
1
,
None
)
...
...
@@ -409,7 +409,7 @@ class TDTestCase:
tdSql
.
query
(
"select stddev(dataint),jtag->'tag1' from jsons1 group by jtag->'tag1' order by jtag->'tag1'"
)
tdSql
.
checkRows
(
8
)
tdSql
.
checkData
(
0
,
0
,
10
)
#
tdSql.checkData(0, 1, None)
tdSql
.
checkData
(
0
,
1
,
None
)
tdSql
.
checkData
(
4
,
0
,
0
)
tdSql
.
checkData
(
4
,
1
,
"5.000000000"
)
tdSql
.
checkData
(
7
,
0
,
11
)
...
...
@@ -424,10 +424,10 @@ class TDTestCase:
# test top/bottom with group by json tag
tdSql
.
query
(
"select top(dataint,2),jtag->'tag1' from jsons1 group by jtag->'tag1' order by jtag->'tag1'"
)
tdSql
.
checkRows
(
11
)
tdSql
.
checkData
(
0
,
1
,
None
)
tdSql
.
checkData
(
2
,
0
,
4
)
tdSql
.
checkData
(
3
,
0
,
3
)
tdSql
.
checkData
(
3
,
1
,
"false"
)
# tdSql.checkData(3, 0, 24)
# tdSql.checkData(3, 1, None)
tdSql
.
checkData
(
10
,
0
,
23
)
tdSql
.
checkData
(
10
,
1
,
'"femail"'
)
...
...
@@ -436,7 +436,7 @@ class TDTestCase:
# tdSql.checkRows(2)
# subquery with json tag
tdSql
.
query
(
"select * from (select jtag, dataint from jsons1)"
)
tdSql
.
query
(
"select * from (select jtag, dataint from jsons1)
order by dataint
"
)
tdSql
.
checkRows
(
11
)
tdSql
.
checkData
(
1
,
1
,
1
)
tdSql
.
checkData
(
2
,
0
,
'{"tag1":5,"tag2":"beijing"}'
)
...
...
tests/system-test/fulltest.bat
浏览文件 @
461cd037
...
...
@@ -3,3 +3,5 @@ python3 .\test.py -f 0-others\taosShell.py
python3
.\test.py
-f
0
-others
\taosShellError.py
python3
.\test.py
-f
0
-others
\taosShellNetChk.py
python3
.\test.py
-f
0
-others
\udfTest.py
python3
.\test.py
-f
0
-others
\udf_create.py
python3
.\test.py
-f
0
-others
\udf_restart_taosd.py
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录