Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
dd4dd52e
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看板
提交
dd4dd52e
编写于
12月 29, 2021
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
差异文件
Merge branch '3.0' into feature/vnode
上级
402b851c
ea3f05f6
变更
7
展开全部
隐藏空白更改
内联
并排
Showing
7 changed file
with
502 addition
and
547 deletion
+502
-547
include/libs/parser/parser.h
include/libs/parser/parser.h
+1
-1
source/client/src/clientImpl.c
source/client/src/clientImpl.c
+2
-32
source/client/test/clientTests.cpp
source/client/test/clientTests.cpp
+0
-1
source/libs/parser/inc/parserUtil.h
source/libs/parser/inc/parserUtil.h
+12
-1
source/libs/parser/src/dCDAstProcess.c
source/libs/parser/src/dCDAstProcess.c
+4
-15
source/libs/parser/src/insertParser.c
source/libs/parser/src/insertParser.c
+221
-245
source/libs/parser/src/parserUtil.c
source/libs/parser/src/parserUtil.c
+262
-252
未找到文件。
include/libs/parser/parser.h
浏览文件 @
dd4dd52e
...
@@ -27,7 +27,7 @@ typedef struct SParseContext {
...
@@ -27,7 +27,7 @@ typedef struct SParseContext {
int8_t
schemaAttached
;
// denote if submit block is built with table schema or not
int8_t
schemaAttached
;
// denote if submit block is built with table schema or not
const
char
*
pSql
;
// sql string
const
char
*
pSql
;
// sql string
size_t
sqlLen
;
// length of the sql string
size_t
sqlLen
;
// length of the sql string
char
*
pMsg
;
// extended error message if exists to help
avoid
the problem in sql statement.
char
*
pMsg
;
// extended error message if exists to help
identifying
the problem in sql statement.
int32_t
msgLen
;
// max length of the msg
int32_t
msgLen
;
// max length of the msg
}
SParseContext
;
}
SParseContext
;
...
...
source/client/src/clientImpl.c
浏览文件 @
dd4dd52e
...
@@ -181,43 +181,13 @@ int32_t execDdlQuery(SRequestObj* pRequest, SQueryNode* pQuery) {
...
@@ -181,43 +181,13 @@ int32_t execDdlQuery(SRequestObj* pRequest, SQueryNode* pQuery) {
pRequest
->
body
.
requestMsg
=
(
SDataBuf
){.
pData
=
pDcl
->
pMsg
,
.
len
=
pDcl
->
msgLen
};
pRequest
->
body
.
requestMsg
=
(
SDataBuf
){.
pData
=
pDcl
->
pMsg
,
.
len
=
pDcl
->
msgLen
};
STscObj
*
pTscObj
=
pRequest
->
pTscObj
;
STscObj
*
pTscObj
=
pRequest
->
pTscObj
;
SMsgSendInfo
*
pSendMsg
=
buildSendMsgInfoImpl
(
pRequest
);
SMsgSendInfo
*
pSendMsg
=
buildSendMsgInfoImpl
(
pRequest
);
SEpSet
*
pEpSet
=
&
pTscObj
->
pAppInfo
->
mgmtEp
.
epSet
;
int64_t
transporterId
=
0
;
if
(
pDcl
->
msgType
==
TDMT_VND_CREATE_TABLE
)
{
if
(
pDcl
->
msgType
==
TDMT_VND_CREATE_TABLE
)
{
// struct SCatalog* pCatalog = NULL;
//
// char buf[18] = {0};
// sprintf(buf, "%" PRId64, pRequest->pTscObj->pAppInfo->clusterId);
// int32_t code = catalogGetHandle(buf, &pCatalog);
// if (code != TSDB_CODE_SUCCESS) {
// return code;
// }
//
// SCreateTableMsg* pMsg = pSendMsg->msgInfo.pData;
//
// SName t = {0};
// tNameFromString(&t, pMsg->name, T_NAME_ACCT|T_NAME_DB|T_NAME_TABLE);
//
// char db[TSDB_DB_NAME_LEN + TSDB_NAME_DELIMITER_LEN + TSDB_ACCT_ID_LEN] = {0};
// tNameGetFullDbName(&t, db);
//
// SVgroupInfo info = {0};
// catalogGetTableHashVgroup(pCatalog, pRequest->pTscObj->pTransporter, pEpSet, db, tNameGetTableName(&t), &info);
//
int64_t
transporterId
=
0
;
// SEpSet ep = {0};
// ep.inUse = info.inUse;
// ep.numOfEps = info.numOfEps;
// for(int32_t i = 0; i < ep.numOfEps; ++i) {
// ep.port[i] = info.epAddr[i].port;
// tstrncpy(ep.fqdn[i], info.epAddr[i].fqdn, tListLen(ep.fqdn[i]));
// }
asyncSendMsgToServer
(
pTscObj
->
pTransporter
,
&
pDcl
->
epSet
,
&
transporterId
,
pSendMsg
);
asyncSendMsgToServer
(
pTscObj
->
pTransporter
,
&
pDcl
->
epSet
,
&
transporterId
,
pSendMsg
);
}
else
{
}
else
{
int64_t
transporterId
=
0
;
SEpSet
*
pEpSet
=
&
pTscObj
->
pAppInfo
->
mgmtEp
.
epSet
;
asyncSendMsgToServer
(
pTscObj
->
pTransporter
,
pEpSet
,
&
transporterId
,
pSendMsg
);
asyncSendMsgToServer
(
pTscObj
->
pTransporter
,
pEpSet
,
&
transporterId
,
pSendMsg
);
}
}
...
...
source/client/test/clientTests.cpp
浏览文件 @
dd4dd52e
...
@@ -433,7 +433,6 @@ TEST(testCase, create_topic_Test) {
...
@@ -433,7 +433,6 @@ TEST(testCase, create_topic_Test) {
taos_close
(
pConn
);
taos_close
(
pConn
);
}
}
//TEST(testCase, show_table_Test) {
//TEST(testCase, show_table_Test) {
// TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0);
// TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0);
// assert(pConn != NULL);
// assert(pConn != NULL);
...
...
source/libs/parser/inc/parserUtil.h
浏览文件 @
dd4dd52e
...
@@ -62,7 +62,7 @@ void cleanupTagCond(STagCond* pTagCond);
...
@@ -62,7 +62,7 @@ void cleanupTagCond(STagCond* pTagCond);
void
cleanupColumnCond
(
SArray
**
pCond
);
void
cleanupColumnCond
(
SArray
**
pCond
);
uint32_t
convertRelationalOperator
(
SToken
*
pToken
);
uint32_t
convertRelationalOperator
(
SToken
*
pToken
);
int32_t
getExprFunctionId
(
SExprInfo
*
pExprInfo
);
int32_t
getExprFunctionId
(
SExprInfo
*
pExprInfo
);
STableMeta
*
tableMetaDup
(
const
STableMeta
*
pTableMeta
);
STableMeta
*
tableMetaDup
(
const
STableMeta
*
pTableMeta
);
...
@@ -70,6 +70,17 @@ bool isDclSqlStatement(SSqlInfo* pSqlInfo);
...
@@ -70,6 +70,17 @@ bool isDclSqlStatement(SSqlInfo* pSqlInfo);
bool
isDdlSqlStatement
(
SSqlInfo
*
pSqlInfo
);
bool
isDdlSqlStatement
(
SSqlInfo
*
pSqlInfo
);
bool
isDqlSqlStatement
(
SSqlInfo
*
pSqlInfo
);
bool
isDqlSqlStatement
(
SSqlInfo
*
pSqlInfo
);
typedef
struct
SKvParam
{
SKVRowBuilder
*
builder
;
SSchema
*
schema
;
char
buf
[
TSDB_MAX_TAGS_LEN
];
}
SKvParam
;
int32_t
KvRowAppend
(
const
void
*
value
,
int32_t
len
,
void
*
param
);
typedef
int32_t
(
*
_row_append_fn_t
)(
const
void
*
value
,
int32_t
len
,
void
*
param
);
int32_t
parseValueToken
(
char
**
end
,
SToken
*
pToken
,
SSchema
*
pSchema
,
int16_t
timePrec
,
char
*
tmpTokenBuf
,
_row_append_fn_t
func
,
void
*
param
,
SMsgBuf
*
pMsgBuf
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
#endif
#endif
...
...
source/libs/parser/src/dCDAstProcess.c
浏览文件 @
dd4dd52e
...
@@ -429,7 +429,6 @@ int32_t doCheckForCreateCTable(SSqlInfo* pInfo, SParseBasicCtx *pCtx, SMsgBuf* p
...
@@ -429,7 +429,6 @@ int32_t doCheckForCreateCTable(SSqlInfo* pInfo, SParseBasicCtx *pCtx, SMsgBuf* p
SSchema
*
pSchema
=
&
pTagSchema
[
i
];
SSchema
*
pSchema
=
&
pTagSchema
[
i
];
SToken
*
pItem
=
taosArrayGet
(
pValList
,
i
);
SToken
*
pItem
=
taosArrayGet
(
pValList
,
i
);
char
tagVal
[
TSDB_MAX_TAGS_LEN
];
if
(
pSchema
->
type
==
TSDB_DATA_TYPE_BINARY
||
pSchema
->
type
==
TSDB_DATA_TYPE_NCHAR
)
{
if
(
pSchema
->
type
==
TSDB_DATA_TYPE_BINARY
||
pSchema
->
type
==
TSDB_DATA_TYPE_NCHAR
)
{
if
(
pItem
->
n
>
pSchema
->
bytes
)
{
if
(
pItem
->
n
>
pSchema
->
bytes
)
{
tdDestroyKVRowBuilder
(
&
kvRowBuilder
);
tdDestroyKVRowBuilder
(
&
kvRowBuilder
);
...
@@ -446,26 +445,16 @@ int32_t doCheckForCreateCTable(SSqlInfo* pInfo, SParseBasicCtx *pCtx, SMsgBuf* p
...
@@ -446,26 +445,16 @@ int32_t doCheckForCreateCTable(SSqlInfo* pInfo, SParseBasicCtx *pCtx, SMsgBuf* p
// }
// }
}
}
char
*
endPtr
=
NULL
;
char
tmpTokenBuf
[
TSDB_MAX_TAGS_LEN
]
=
{
0
};
int64_t
v
=
strtoll
(
pItem
->
z
,
&
endPtr
,
10
);
SKvParam
param
=
{.
builder
=
&
kvRowBuilder
,
.
schema
=
pSchema
};
*
(
int32_t
*
)
tagVal
=
v
;
// code = taosVariantDump(&(pItem->pVar), tagVal, pSchema->type, true);
// check again after the convert since it may be converted from binary to nchar.
char
*
endPtr
=
NULL
;
if
(
pSchema
->
type
==
TSDB_DATA_TYPE_BINARY
||
pSchema
->
type
==
TSDB_DATA_TYPE_NCHAR
)
{
code
=
parseValueToken
(
&
endPtr
,
pItem
,
pSchema
,
tinfo
.
precision
,
tmpTokenBuf
,
KvRowAppend
,
&
param
,
pMsgBuf
);
int16_t
len
=
varDataTLen
(
tagVal
);
if
(
len
>
pSchema
->
bytes
)
{
tdDestroyKVRowBuilder
(
&
kvRowBuilder
);
return
buildInvalidOperationMsg
(
pMsgBuf
,
msg3
);
}
}
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
tdDestroyKVRowBuilder
(
&
kvRowBuilder
);
tdDestroyKVRowBuilder
(
&
kvRowBuilder
);
return
buildInvalidOperationMsg
(
pMsgBuf
,
msg4
);
return
buildInvalidOperationMsg
(
pMsgBuf
,
msg4
);
}
}
tdAddColToKVRow
(
&
kvRowBuilder
,
pSchema
->
colId
,
pSchema
->
type
,
tagVal
);
}
}
}
}
...
...
source/libs/parser/src/insertParser.c
浏览文件 @
dd4dd52e
此差异已折叠。
点击以展开。
source/libs/parser/src/parserUtil.c
浏览文件 @
dd4dd52e
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录