Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
db03fcce
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看板
提交
db03fcce
编写于
6月 17, 2020
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[td-225] refactor code and fix bugs in slimit_alter_tags.sim
上级
5fce9c84
变更
17
隐藏空白更改
内联
并排
Showing
17 changed file
with
36 addition
and
157 deletion
+36
-157
src/client/inc/tscLocalMerge.h
src/client/inc/tscLocalMerge.h
+0
-0
src/client/inc/tscUtil.h
src/client/inc/tscUtil.h
+1
-1
src/client/src/tscAsync.c
src/client/src/tscAsync.c
+1
-2
src/client/src/tscFunctionImpl.c
src/client/src/tscFunctionImpl.c
+3
-3
src/client/src/tscLocal.c
src/client/src/tscLocal.c
+0
-1
src/client/src/tscLocalMerge.c
src/client/src/tscLocalMerge.c
+1
-1
src/client/src/tscServer.c
src/client/src/tscServer.c
+3
-112
src/client/src/tscSql.c
src/client/src/tscSql.c
+0
-5
src/client/src/tscSubquery.c
src/client/src/tscSubquery.c
+1
-1
src/client/src/tscUtil.c
src/client/src/tscUtil.c
+2
-2
src/common/src/tdataformat.c
src/common/src/tdataformat.c
+1
-1
src/common/src/ttypes.c
src/common/src/ttypes.c
+2
-10
src/inc/taosdef.h
src/inc/taosdef.h
+1
-1
src/query/src/qExecutor.c
src/query/src/qExecutor.c
+2
-2
src/query/src/tvariant.c
src/query/src/tvariant.c
+3
-2
tests/script/general/parser/slimit_alter_tags.sim
tests/script/general/parser/slimit_alter_tags.sim
+5
-3
tests/script/general/parser/testSuite.sim
tests/script/general/parser/testSuite.sim
+10
-10
未找到文件。
src/client/inc/tsc
Secondary
Merge.h
→
src/client/inc/tsc
Local
Merge.h
浏览文件 @
db03fcce
文件已移动
src/client/inc/tscUtil.h
浏览文件 @
db03fcce
...
...
@@ -28,7 +28,7 @@ extern "C" {
#include "exception.h"
#include "qextbuffer.h"
#include "taosdef.h"
#include "tsc
Secondary
Merge.h"
#include "tsc
Local
Merge.h"
#include "tsclient.h"
#define UTIL_TABLE_IS_SUPER_TABLE(metaInfo) \
...
...
src/client/src/tscAsync.c
浏览文件 @
db03fcce
...
...
@@ -19,9 +19,8 @@
#include "tnote.h"
#include "trpc.h"
#include "tscLog.h"
#include "tscProfile.h"
#include "tscSubquery.h"
#include "tsc
Secondary
Merge.h"
#include "tsc
Local
Merge.h"
#include "tscUtil.h"
#include "tsched.h"
#include "tschemautil.h"
...
...
src/client/src/tscFunctionImpl.c
浏览文件 @
db03fcce
...
...
@@ -153,7 +153,7 @@ typedef struct SRateInfo {
int32_t
getResultDataInfo
(
int32_t
dataType
,
int32_t
dataBytes
,
int32_t
functionId
,
int32_t
param
,
int16_t
*
type
,
int16_t
*
bytes
,
int32_t
*
interBytes
,
int16_t
extLength
,
bool
isSuperTable
)
{
if
(
!
isValidDataType
(
dataType
,
dataBytes
))
{
if
(
!
isValidDataType
(
dataType
))
{
tscError
(
"Illegal data type %d or data type length %d"
,
dataType
,
dataBytes
);
return
TSDB_CODE_TSC_INVALID_SQL
;
}
...
...
@@ -2989,12 +2989,12 @@ static void tag_project_function_f(SQLFunctionCtx *pCtx, int32_t index) {
*/
static
void
tag_function
(
SQLFunctionCtx
*
pCtx
)
{
SET_VAL
(
pCtx
,
1
,
1
);
tVariantDump
(
&
pCtx
->
tag
,
pCtx
->
aOutputBuf
,
pCtx
->
tag
.
n
Type
,
true
);
tVariantDump
(
&
pCtx
->
tag
,
pCtx
->
aOutputBuf
,
pCtx
->
output
Type
,
true
);
}
static
void
tag_function_f
(
SQLFunctionCtx
*
pCtx
,
int32_t
index
)
{
SET_VAL
(
pCtx
,
1
,
1
);
tVariantDump
(
&
pCtx
->
tag
,
pCtx
->
aOutputBuf
,
pCtx
->
tag
.
n
Type
,
true
);
tVariantDump
(
&
pCtx
->
tag
,
pCtx
->
aOutputBuf
,
pCtx
->
output
Type
,
true
);
}
static
void
copy_function
(
SQLFunctionCtx
*
pCtx
)
{
...
...
src/client/src/tscLocal.c
浏览文件 @
db03fcce
...
...
@@ -22,7 +22,6 @@
#include "taosdef.h"
#include "tscLog.h"
#include "qextbuffer.h"
#include "tscSecondaryMerge.h"
#include "tschemautil.h"
#include "tname.h"
...
...
src/client/src/tsc
Secondary
Merge.c
→
src/client/src/tsc
Local
Merge.c
浏览文件 @
db03fcce
...
...
@@ -13,7 +13,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "tscSecondaryMerge.h"
#include "os.h"
#include "tlosertree.h"
#include "tscUtil.h"
...
...
@@ -21,6 +20,7 @@
#include "tsclient.h"
#include "tutil.h"
#include "tscLog.h"
#include "tscLocalMerge.h"
typedef
struct
SCompareParam
{
SLocalDataSource
**
pLocalData
;
...
...
src/client/src/tscServer.c
浏览文件 @
db03fcce
...
...
@@ -14,20 +14,18 @@
*/
#include "os.h"
#include "qsqltype.h"
#include "tcache.h"
#include "trpc.h"
#include "tscLocalMerge.h"
#include "tscLog.h"
#include "tscProfile.h"
#include "tscSecondaryMerge.h"
#include "tscSubquery.h"
#include "tscUtil.h"
#include "tschemautil.h"
#include "tsclient.h"
#include "tsocket.h"
#include "ttime.h"
#include "ttimer.h"
#include "tutil.h"
#include "tscLog.h"
#include "qsqltype.h"
#define TSC_MGMT_VNODE 999
...
...
@@ -1933,113 +1931,6 @@ int tscProcessMultiMeterMetaRsp(SSqlObj *pSql) {
}
int
tscProcessSTableVgroupRsp
(
SSqlObj
*
pSql
)
{
#if 0
void ** metricMetaList = NULL;
int32_t * sizes = NULL;
int32_t num = htons(*(int16_t *)rsp);
rsp += sizeof(int16_t);
metricMetaList = calloc(1, POINTER_BYTES * num);
sizes = calloc(1, sizeof(int32_t) * num);
// return with error code
if (metricMetaList == NULL || sizes == NULL) {
tfree(metricMetaList);
tfree(sizes);
pSql->res.code = TSDB_CODE_TSC_OUT_OF_MEMORY;
return pSql->res.code;
}
for (int32_t k = 0; k < num; ++k) {
pMeta = (SSuperTableMeta *)rsp;
size_t size = (size_t)pSql->res.rspLen - 1;
rsp = rsp + sizeof(SSuperTableMeta);
pMeta->numOfTables = htonl(pMeta->numOfTables);
pMeta->numOfVnodes = htonl(pMeta->numOfVnodes);
pMeta->tagLen = htons(pMeta->tagLen);
size += pMeta->numOfVnodes * sizeof(SVnodeSidList *) + pMeta->numOfTables * sizeof(STableIdInfo *);
char *pBuf = calloc(1, size);
if (pBuf == NULL) {
pSql->res.code = TSDB_CODE_TSC_OUT_OF_MEMORY;
goto _error_clean;
}
SSuperTableMeta *pNewMetricMeta = (SSuperTableMeta *)pBuf;
metricMetaList[k] = pNewMetricMeta;
pNewMetricMeta->numOfTables = pMeta->numOfTables;
pNewMetricMeta->numOfVnodes = pMeta->numOfVnodes;
pNewMetricMeta->tagLen = pMeta->tagLen;
pBuf = pBuf + sizeof(SSuperTableMeta) + pNewMetricMeta->numOfVnodes * sizeof(SVnodeSidList *);
for (int32_t i = 0; i < pMeta->numOfVnodes; ++i) {
SVnodeSidList *pSidLists = (SVnodeSidList *)rsp;
memcpy(pBuf, pSidLists, sizeof(SVnodeSidList));
pNewMetricMeta->list[i] = pBuf - (char *)pNewMetricMeta; // offset value
SVnodeSidList *pLists = (SVnodeSidList *)pBuf;
tscTrace("%p metricmeta:vid:%d,numOfTables:%d", pSql, i, pLists->numOfSids);
pBuf += sizeof(SVnodeSidList) + sizeof(STableIdInfo *) * pSidLists->numOfSids;
rsp += sizeof(SVnodeSidList);
size_t elemSize = sizeof(STableIdInfo) + pNewMetricMeta->tagLen;
for (int32_t j = 0; j < pSidLists->numOfSids; ++j) {
pLists->pSidExtInfoList[j] = pBuf - (char *)pLists;
memcpy(pBuf, rsp, elemSize);
((STableIdInfo *)pBuf)->uid = htobe64(((STableIdInfo *)pBuf)->uid);
((STableIdInfo *)pBuf)->sid = htonl(((STableIdInfo *)pBuf)->sid);
rsp += elemSize;
pBuf += elemSize;
}
}
sizes[k] = pBuf - (char *)pNewMetricMeta;
}
SQueryInfo *pQueryInfo = tscGetQueryInfoDetail(&pSql->cmd, 0);
for (int32_t i = 0; i < num; ++i) {
char name[TSDB_MAX_TAGS_LEN + 1] = {0};
STableMetaInfo *pTableMetaInfo = tscGetMetaInfo(pQueryInfo, i);
tscGetMetricMetaCacheKey(pQueryInfo, name, pTableMetaInfo->pTableMeta->uid);
#ifdef _DEBUG_VIEW
printf("generate the metric key:%s, index:%d\n", name, i);
#endif
// release the used metricmeta
taosCacheRelease(tscCacheHandle, (void **)&(pTableMetaInfo->pMetricMeta), false);
pTableMetaInfo->pMetricMeta = (SSuperTableMeta *)taosCachePut(tscCacheHandle, name, (char *)metricMetaList[i],
sizes[i], tsMetricMetaKeepTimer);
tfree(metricMetaList[i]);
// failed to put into cache
if (pTableMetaInfo->pMetricMeta == NULL) {
pSql->res.code = TSDB_CODE_TSC_OUT_OF_MEMORY;
goto _error_clean;
}
}
_error_clean:
// free allocated resource
for (int32_t i = 0; i < num; ++i) {
tfree(metricMetaList[i]);
}
free(sizes);
free(metricMetaList);
#endif
SSqlRes
*
pRes
=
&
pSql
->
res
;
// NOTE: the order of several table must be preserved.
...
...
src/client/src/tscSql.c
浏览文件 @
db03fcce
...
...
@@ -20,14 +20,9 @@
#include "tnote.h"
#include "trpc.h"
#include "tscLog.h"
#include "tscProfile.h"
#include "tscSecondaryMerge.h"
#include "tscSubquery.h"
#include "tscUtil.h"
#include "tsclient.h"
#include "tscompression.h"
#include "tsocket.h"
#include "ttimer.h"
#include "ttokendef.h"
#include "tutil.h"
...
...
src/client/src/tscSubquery.c
浏览文件 @
db03fcce
...
...
@@ -1193,7 +1193,7 @@ int32_t tscLaunchJoinSubquery(SSqlObj *pSql, int16_t tableIndex, SJoinSupporter
SSchema
s1
=
{.
colId
=
s
->
colId
,
.
type
=
type
,
.
bytes
=
bytes
};
pSupporter
->
tagSize
=
s1
.
bytes
;
assert
(
isValidDataType
(
s1
.
type
,
0
)
&&
s1
.
bytes
>
0
);
assert
(
isValidDataType
(
s1
.
type
)
&&
s1
.
bytes
>
0
);
// set get tags query type
TSDB_QUERY_SET_TYPE
(
pNewQueryInfo
->
type
,
TSDB_QUERY_TYPE_TAG_FILTER_QUERY
);
...
...
src/client/src/tscUtil.c
浏览文件 @
db03fcce
...
...
@@ -22,7 +22,7 @@
#include "tkey.h"
#include "tmd5.h"
#include "tscProfile.h"
#include "tsc
Secondary
Merge.h"
#include "tsc
Local
Merge.h"
#include "tscSubquery.h"
#include "tschemautil.h"
#include "tsclient.h"
...
...
@@ -32,7 +32,7 @@
static
void
freeQueryInfoImpl
(
SQueryInfo
*
pQueryInfo
);
static
void
clearAllTableMetaInfo
(
SQueryInfo
*
pQueryInfo
,
const
char
*
address
,
bool
removeFromCache
);
SCond
*
tsGetSTableQueryCond
(
STagCond
*
pTagCond
,
uint64_t
uid
)
{
if
(
pTagCond
->
pCond
==
NULL
)
{
return
NULL
;
...
...
src/common/src/tdataformat.c
浏览文件 @
db03fcce
...
...
@@ -105,7 +105,7 @@ void tdResetTSchemaBuilder(STSchemaBuilder *pBuilder, int32_t version) {
}
int
tdAddColToSchema
(
STSchemaBuilder
*
pBuilder
,
int8_t
type
,
int16_t
colId
,
int32_t
bytes
)
{
if
(
!
isValidDataType
(
type
,
0
))
return
-
1
;
if
(
!
isValidDataType
(
type
))
return
-
1
;
if
(
pBuilder
->
nCols
>=
pBuilder
->
tCols
)
{
pBuilder
->
tCols
*=
2
;
...
...
src/common/src/ttypes.c
浏览文件 @
db03fcce
...
...
@@ -363,16 +363,8 @@ char tTokenTypeSwitcher[13] = {
TSDB_DATA_TYPE_NCHAR
,
// TK_NCHAR
};
bool
isValidDataType
(
int32_t
type
,
int32_t
length
)
{
if
(
type
<
TSDB_DATA_TYPE_NULL
||
type
>
TSDB_DATA_TYPE_NCHAR
)
{
return
false
;
}
if
(
type
==
TSDB_DATA_TYPE_BINARY
||
type
==
TSDB_DATA_TYPE_NCHAR
)
{
// return length >= 0 && length <= TSDB_MAX_BINARY_LEN;
}
return
true
;
bool
isValidDataType
(
int32_t
type
)
{
return
type
>=
TSDB_DATA_TYPE_NULL
&&
type
<=
TSDB_DATA_TYPE_NCHAR
;
}
bool
isNull
(
const
char
*
val
,
int32_t
type
)
{
...
...
src/inc/taosdef.h
浏览文件 @
db03fcce
...
...
@@ -156,7 +156,7 @@ typedef struct tDataTypeDescriptor {
extern
tDataTypeDescriptor
tDataTypeDesc
[
11
];
#define POINTER_BYTES sizeof(void *) // 8 by default assert(sizeof(ptrdiff_t) == sizseof(void*)
bool
isValidDataType
(
int32_t
type
,
int32_t
length
);
bool
isValidDataType
(
int32_t
type
);
bool
isNull
(
const
char
*
val
,
int32_t
type
);
void
setVardataNull
(
char
*
val
,
int32_t
type
);
...
...
src/query/src/qExecutor.c
浏览文件 @
db03fcce
...
...
@@ -1400,7 +1400,7 @@ static int32_t setupQueryRuntimeEnv(SQueryRuntimeEnv *pRuntimeEnv, int16_t order
pCtx
->
inputType
=
pQuery
->
colList
[
index
].
type
;
}
assert
(
isValidDataType
(
pCtx
->
inputType
,
pCtx
->
inputBytes
));
assert
(
isValidDataType
(
pCtx
->
inputType
));
pCtx
->
ptsOutputBuf
=
NULL
;
pCtx
->
outputBytes
=
pQuery
->
pSelectExpr
[
i
].
bytes
;
...
...
@@ -5315,7 +5315,7 @@ static int32_t createQFunctionExprFromMsg(SQueryTableMsg *pQueryMsg, SExprInfo *
if
(
pExprs
[
i
].
base
.
functionId
==
TSDB_FUNC_TAG_DUMMY
||
pExprs
[
i
].
base
.
functionId
==
TSDB_FUNC_TS_DUMMY
)
{
tagLen
+=
pExprs
[
i
].
bytes
;
}
assert
(
isValidDataType
(
pExprs
[
i
].
type
,
pExprs
[
i
].
bytes
));
assert
(
isValidDataType
(
pExprs
[
i
].
type
));
}
// TODO refactor
...
...
src/query/src/tvariant.c
浏览文件 @
db03fcce
...
...
@@ -474,6 +474,7 @@ static FORCE_INLINE int32_t convertToInteger(tVariant *pVariant, int64_t *result
free
(
pVariant
->
pz
);
pVariant
->
nLen
=
0
;
}
setNull
((
char
*
)
result
,
type
,
tDataTypeDesc
[
type
].
nSize
);
return
0
;
}
...
...
@@ -597,10 +598,10 @@ static int32_t convertToBool(tVariant *pVariant, int64_t *pDest) {
* todo handle the return value
*/
int32_t
tVariantDump
(
tVariant
*
pVariant
,
char
*
payload
,
int16_t
type
,
bool
includeLengthPrefix
)
{
if
(
pVariant
==
NULL
||
(
pVariant
->
nType
!=
0
&&
!
isValidDataType
(
pVariant
->
nType
,
pVariant
->
nLen
)))
{
if
(
pVariant
==
NULL
||
(
pVariant
->
nType
!=
0
&&
!
isValidDataType
(
pVariant
->
nType
)))
{
return
-
1
;
}
errno
=
0
;
// reset global error code
switch
(
type
)
{
...
...
tests/script/general/parser/slimit_alter_tags.sim
浏览文件 @
db03fcce
...
...
@@ -84,11 +84,13 @@ while $i < 10
sql alter table $tb set tag tg_added = $tg_added
$i = $i + 1
endw
sql describe tb0
if $rows != 7 then
sql select t1,t2,tg_added from tb0
if $rows != 1 then
return -1
endi
if $data63 != tb0 then
if $data02 != tb0 then
return -1
endi
...
...
tests/script/general/parser/testSuite.sim
浏览文件 @
db03fcce
#
run general/parser/alter.sim
#
sleep 2000
#
run general/parser/alter1.sim
#
sleep 2000
#
run general/parser/alter_stable.sim
#
sleep 2000
#
run general/parser/auto_create_tb.sim
#
sleep 2000
#
run general/parser/auto_create_tb_drop_tb.sim
run general/parser/alter.sim
sleep 2000
run general/parser/alter1.sim
sleep 2000
run general/parser/alter_stable.sim
sleep 2000
run general/parser/auto_create_tb.sim
sleep 2000
run general/parser/auto_create_tb_drop_tb.sim
sleep 2000
run general/parser/col_arithmetic_operation.sim
...
...
@@ -84,7 +84,7 @@ sleep 2000
run general/parser/set_tag_vals.sim
sleep 2000
run general/parser/slimit_alter_tags.sim
run general/parser/slimit_alter_tags.sim
# persistent failed
sleep 2000
run general/parser/join.sim
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录