Merge remote-tracking branch 'origin/3.0' into feature/dnode3
This commit is contained in:
commit
c6e81f925f
|
@ -826,7 +826,8 @@ typedef struct SShowRsp {
|
|||
} SShowRsp;
|
||||
|
||||
typedef struct {
|
||||
char ep[TSDB_EP_LEN]; // end point, hostname:port
|
||||
char ep[TSDB_FQDN_LEN]; // end point, hostname:port
|
||||
int32_t port;
|
||||
} SCreateDnodeMsg;
|
||||
|
||||
typedef struct {
|
||||
|
|
|
@ -124,6 +124,15 @@ int32_t cleanupTaskQueue();
|
|||
*/
|
||||
int32_t taosAsyncExec(__async_exec_fn_t execFn, void* execParam, int32_t* code);
|
||||
|
||||
/**
|
||||
* Asynchronously send message to server, after the response received, the callback will be incured.
|
||||
*
|
||||
* @param pTransporter
|
||||
* @param epSet
|
||||
* @param pTransporterId
|
||||
* @param pInfo
|
||||
* @return
|
||||
*/
|
||||
int32_t asyncSendMsgToServer(void *pTransporter, SEpSet* epSet, int64_t* pTransporterId, const SMsgSendInfo* pInfo);
|
||||
|
||||
const SSchema* tGetTbnameColumnSchema();
|
||||
|
|
|
@ -362,30 +362,6 @@ static void destroySendMsgInfo(SMsgSendInfo* pMsgBody) {
|
|||
tfree(pMsgBody);
|
||||
}
|
||||
|
||||
int32_t asyncSendMsgToServer(void *pTransporter, SEpSet* epSet, int64_t* pTransporterId, const SMsgSendInfo* pInfo) {
|
||||
char *pMsg = rpcMallocCont(pInfo->msgInfo.len);
|
||||
if (NULL == pMsg) {
|
||||
tscError("0x%"PRIx64" msg:%s malloc failed", pInfo->requestId, TMSG_INFO(pInfo->msgType));
|
||||
terrno = TSDB_CODE_TSC_OUT_OF_MEMORY;
|
||||
return -1;
|
||||
}
|
||||
|
||||
memcpy(pMsg, pInfo->msgInfo.pData, pInfo->msgInfo.len);
|
||||
SRpcMsg rpcMsg = {
|
||||
.msgType = pInfo->msgType,
|
||||
.pCont = pMsg,
|
||||
.contLen = pInfo->msgInfo.len,
|
||||
.ahandle = (void*) pInfo,
|
||||
.handle = NULL,
|
||||
.code = 0
|
||||
};
|
||||
|
||||
assert(pInfo->fp != NULL);
|
||||
|
||||
rpcSendRequest(pTransporter, epSet, &rpcMsg, pTransporterId);
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
void processMsgFromServer(void* parent, SRpcMsg* pMsg, SEpSet* pEpSet) {
|
||||
SMsgSendInfo *pSendInfo = (SMsgSendInfo *) pMsg->ahandle;
|
||||
assert(pMsg->ahandle != NULL);
|
||||
|
|
|
@ -173,7 +173,7 @@ TEST(testCase, create_dnode_Test) {
|
|||
TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0);
|
||||
assert(pConn != NULL);
|
||||
|
||||
TAOS_RES* pRes = taos_query(pConn, "create dnode abc1");
|
||||
TAOS_RES* pRes = taos_query(pConn, "create dnode abc1 port 7000");
|
||||
if (taos_errno(pRes) != 0) {
|
||||
printf("error in create dnode, reason:%s\n", taos_errstr(pRes));
|
||||
}
|
||||
|
@ -291,7 +291,24 @@ TEST(testCase, create_table_Test) {
|
|||
// taos_close(pConn);
|
||||
}
|
||||
|
||||
TEST(testCase, create_ctable_Test) {}
|
||||
TEST(testCase, create_ctable_Test) {
|
||||
TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0);
|
||||
assert(pConn != NULL);
|
||||
|
||||
TAOS_RES* pRes = taos_query(pConn, "use abc1");
|
||||
if (taos_errno(pRes) != 0) {
|
||||
printf("failed to use db, reason:%s\n", taos_errstr(pRes));
|
||||
}
|
||||
taos_free_result(pRes);
|
||||
|
||||
pRes = taos_query(pConn, "create table tm0 using st1 tags(1)");
|
||||
if (taos_errno(pRes) != 0) {
|
||||
printf("failed to create child table tm0, reason:%s\n", taos_errstr(pRes));
|
||||
}
|
||||
|
||||
taos_free_result(pRes);
|
||||
taos_close(pConn);
|
||||
}
|
||||
|
||||
TEST(testCase, show_stable_Test) {
|
||||
TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0);
|
||||
|
|
|
@ -200,7 +200,7 @@ ifnotexists(X) ::= . { X.n = 0;}
|
|||
|
||||
/////////////////////////////////THE CREATE STATEMENT///////////////////////////////////////
|
||||
//create option for dnode/db/user/account
|
||||
cmd ::= CREATE DNODE ids(X). { setDCLSqlElems(pInfo, TSDB_SQL_CREATE_DNODE, 1, &X);}
|
||||
cmd ::= CREATE DNODE ids(X) PORT ids(Y). { setDCLSqlElems(pInfo, TSDB_SQL_CREATE_DNODE, 2, &X, &Y);}
|
||||
cmd ::= CREATE ACCOUNT ids(X) PASS ids(Y) acct_optr(Z).
|
||||
{ setCreateAcctSql(pInfo, TSDB_SQL_CREATE_ACCT, &X, &Y, &Z);}
|
||||
cmd ::= CREATE DATABASE ifnotexists(Z) ids(X) db_optr(Y). { setCreateDbInfo(pInfo, TSDB_SQL_CREATE_DB, &X, &Y, &Z);}
|
||||
|
@ -398,13 +398,13 @@ create_stable_args(A) ::= ifnotexists(U) ids(V) cpxName(Z) LP columnlist(X) RP T
|
|||
// create table by using super table
|
||||
// create table table_name using super_table_name tags(tag_values1, tag_values2)
|
||||
%type create_from_stable{SCreatedTableInfo}
|
||||
create_from_stable(A) ::= ifnotexists(U) ids(V) cpxName(Z) USING ids(X) cpxName(F) TAGS LP tagitemlist(Y) RP. {
|
||||
create_from_stable(A) ::= ifnotexists(U) ids(V) cpxName(Z) USING ids(X) cpxName(F) TAGS LP tagitemlist1(Y) RP. {
|
||||
X.n += F.n;
|
||||
V.n += Z.n;
|
||||
A = createNewChildTableInfo(&X, NULL, Y, &V, &U);
|
||||
}
|
||||
|
||||
create_from_stable(A) ::= ifnotexists(U) ids(V) cpxName(Z) USING ids(X) cpxName(F) LP tagNamelist(P) RP TAGS LP tagitemlist(Y) RP. {
|
||||
create_from_stable(A) ::= ifnotexists(U) ids(V) cpxName(Z) USING ids(X) cpxName(F) LP tagNamelist(P) RP TAGS LP tagitemlist1(Y) RP. {
|
||||
X.n += F.n;
|
||||
V.n += Z.n;
|
||||
A = createNewChildTableInfo(&X, P, Y, &V, &U);
|
||||
|
@ -437,6 +437,15 @@ column(A) ::= ids(X) typename(Y). {
|
|||
tSetColumnInfo(&A, &X, &Y);
|
||||
}
|
||||
|
||||
%type tagitemlist1 {SArray*}
|
||||
%destructor tagitemlist1 {taosArrayDestroy($$);}
|
||||
|
||||
tagitemlist1(A) ::= tagitemlist1(X) COMMA tagitem1(Y). { taosArrayPush(X, &Y); A = X;}
|
||||
tagitemlist1(A) ::= tagitem1(Y). { A = taosArrayInit(4, sizeof(SToken)); taosArrayPush(A, &Y); }
|
||||
|
||||
%type tagitem1 {SToken}
|
||||
tagitem1(A) ::= MINUS(X) INTEGER(Y). { A.n = X.n + Y.n; A.type = Y.type; }
|
||||
|
||||
%type tagitemlist {SArray*}
|
||||
%destructor tagitemlist {taosArrayDestroy($$);}
|
||||
|
||||
|
|
|
@ -103,114 +103,115 @@
|
|||
#define TK_RP 85
|
||||
#define TK_IF 86
|
||||
#define TK_EXISTS 87
|
||||
#define TK_AS 88
|
||||
#define TK_OUTPUTTYPE 89
|
||||
#define TK_AGGREGATE 90
|
||||
#define TK_BUFSIZE 91
|
||||
#define TK_PPS 92
|
||||
#define TK_TSERIES 93
|
||||
#define TK_DBS 94
|
||||
#define TK_STORAGE 95
|
||||
#define TK_QTIME 96
|
||||
#define TK_CONNS 97
|
||||
#define TK_STATE 98
|
||||
#define TK_COMMA 99
|
||||
#define TK_KEEP 100
|
||||
#define TK_CACHE 101
|
||||
#define TK_REPLICA 102
|
||||
#define TK_QUORUM 103
|
||||
#define TK_DAYS 104
|
||||
#define TK_MINROWS 105
|
||||
#define TK_MAXROWS 106
|
||||
#define TK_BLOCKS 107
|
||||
#define TK_CTIME 108
|
||||
#define TK_WAL 109
|
||||
#define TK_FSYNC 110
|
||||
#define TK_COMP 111
|
||||
#define TK_PRECISION 112
|
||||
#define TK_UPDATE 113
|
||||
#define TK_CACHELAST 114
|
||||
#define TK_UNSIGNED 115
|
||||
#define TK_TAGS 116
|
||||
#define TK_USING 117
|
||||
#define TK_NULL 118
|
||||
#define TK_NOW 119
|
||||
#define TK_SELECT 120
|
||||
#define TK_UNION 121
|
||||
#define TK_ALL 122
|
||||
#define TK_DISTINCT 123
|
||||
#define TK_FROM 124
|
||||
#define TK_VARIABLE 125
|
||||
#define TK_INTERVAL 126
|
||||
#define TK_EVERY 127
|
||||
#define TK_SESSION 128
|
||||
#define TK_STATE_WINDOW 129
|
||||
#define TK_FILL 130
|
||||
#define TK_SLIDING 131
|
||||
#define TK_ORDER 132
|
||||
#define TK_BY 133
|
||||
#define TK_ASC 134
|
||||
#define TK_GROUP 135
|
||||
#define TK_HAVING 136
|
||||
#define TK_LIMIT 137
|
||||
#define TK_OFFSET 138
|
||||
#define TK_SLIMIT 139
|
||||
#define TK_SOFFSET 140
|
||||
#define TK_WHERE 141
|
||||
#define TK_RESET 142
|
||||
#define TK_QUERY 143
|
||||
#define TK_SYNCDB 144
|
||||
#define TK_ADD 145
|
||||
#define TK_COLUMN 146
|
||||
#define TK_MODIFY 147
|
||||
#define TK_TAG 148
|
||||
#define TK_CHANGE 149
|
||||
#define TK_SET 150
|
||||
#define TK_KILL 151
|
||||
#define TK_CONNECTION 152
|
||||
#define TK_STREAM 153
|
||||
#define TK_COLON 154
|
||||
#define TK_ABORT 155
|
||||
#define TK_AFTER 156
|
||||
#define TK_ATTACH 157
|
||||
#define TK_BEFORE 158
|
||||
#define TK_BEGIN 159
|
||||
#define TK_CASCADE 160
|
||||
#define TK_CLUSTER 161
|
||||
#define TK_CONFLICT 162
|
||||
#define TK_COPY 163
|
||||
#define TK_DEFERRED 164
|
||||
#define TK_DELIMITERS 165
|
||||
#define TK_DETACH 166
|
||||
#define TK_EACH 167
|
||||
#define TK_END 168
|
||||
#define TK_EXPLAIN 169
|
||||
#define TK_FAIL 170
|
||||
#define TK_FOR 171
|
||||
#define TK_IGNORE 172
|
||||
#define TK_IMMEDIATE 173
|
||||
#define TK_INITIALLY 174
|
||||
#define TK_INSTEAD 175
|
||||
#define TK_KEY 176
|
||||
#define TK_OF 177
|
||||
#define TK_RAISE 178
|
||||
#define TK_REPLACE 179
|
||||
#define TK_RESTRICT 180
|
||||
#define TK_ROW 181
|
||||
#define TK_STATEMENT 182
|
||||
#define TK_TRIGGER 183
|
||||
#define TK_VIEW 184
|
||||
#define TK_IPTOKEN 185
|
||||
#define TK_SEMI 186
|
||||
#define TK_NONE 187
|
||||
#define TK_PREV 188
|
||||
#define TK_LINEAR 189
|
||||
#define TK_IMPORT 190
|
||||
#define TK_TBNAME 191
|
||||
#define TK_JOIN 192
|
||||
#define TK_INSERT 193
|
||||
#define TK_INTO 194
|
||||
#define TK_VALUES 195
|
||||
#define TK_PORT 88
|
||||
#define TK_AS 89
|
||||
#define TK_OUTPUTTYPE 90
|
||||
#define TK_AGGREGATE 91
|
||||
#define TK_BUFSIZE 92
|
||||
#define TK_PPS 93
|
||||
#define TK_TSERIES 94
|
||||
#define TK_DBS 95
|
||||
#define TK_STORAGE 96
|
||||
#define TK_QTIME 97
|
||||
#define TK_CONNS 98
|
||||
#define TK_STATE 99
|
||||
#define TK_COMMA 100
|
||||
#define TK_KEEP 101
|
||||
#define TK_CACHE 102
|
||||
#define TK_REPLICA 103
|
||||
#define TK_QUORUM 104
|
||||
#define TK_DAYS 105
|
||||
#define TK_MINROWS 106
|
||||
#define TK_MAXROWS 107
|
||||
#define TK_BLOCKS 108
|
||||
#define TK_CTIME 109
|
||||
#define TK_WAL 110
|
||||
#define TK_FSYNC 111
|
||||
#define TK_COMP 112
|
||||
#define TK_PRECISION 113
|
||||
#define TK_UPDATE 114
|
||||
#define TK_CACHELAST 115
|
||||
#define TK_UNSIGNED 116
|
||||
#define TK_TAGS 117
|
||||
#define TK_USING 118
|
||||
#define TK_NULL 119
|
||||
#define TK_NOW 120
|
||||
#define TK_SELECT 121
|
||||
#define TK_UNION 122
|
||||
#define TK_ALL 123
|
||||
#define TK_DISTINCT 124
|
||||
#define TK_FROM 125
|
||||
#define TK_VARIABLE 126
|
||||
#define TK_INTERVAL 127
|
||||
#define TK_EVERY 128
|
||||
#define TK_SESSION 129
|
||||
#define TK_STATE_WINDOW 130
|
||||
#define TK_FILL 131
|
||||
#define TK_SLIDING 132
|
||||
#define TK_ORDER 133
|
||||
#define TK_BY 134
|
||||
#define TK_ASC 135
|
||||
#define TK_GROUP 136
|
||||
#define TK_HAVING 137
|
||||
#define TK_LIMIT 138
|
||||
#define TK_OFFSET 139
|
||||
#define TK_SLIMIT 140
|
||||
#define TK_SOFFSET 141
|
||||
#define TK_WHERE 142
|
||||
#define TK_RESET 143
|
||||
#define TK_QUERY 144
|
||||
#define TK_SYNCDB 145
|
||||
#define TK_ADD 146
|
||||
#define TK_COLUMN 147
|
||||
#define TK_MODIFY 148
|
||||
#define TK_TAG 149
|
||||
#define TK_CHANGE 150
|
||||
#define TK_SET 151
|
||||
#define TK_KILL 152
|
||||
#define TK_CONNECTION 153
|
||||
#define TK_STREAM 154
|
||||
#define TK_COLON 155
|
||||
#define TK_ABORT 156
|
||||
#define TK_AFTER 157
|
||||
#define TK_ATTACH 158
|
||||
#define TK_BEFORE 159
|
||||
#define TK_BEGIN 160
|
||||
#define TK_CASCADE 161
|
||||
#define TK_CLUSTER 162
|
||||
#define TK_CONFLICT 163
|
||||
#define TK_COPY 164
|
||||
#define TK_DEFERRED 165
|
||||
#define TK_DELIMITERS 166
|
||||
#define TK_DETACH 167
|
||||
#define TK_EACH 168
|
||||
#define TK_END 169
|
||||
#define TK_EXPLAIN 170
|
||||
#define TK_FAIL 171
|
||||
#define TK_FOR 172
|
||||
#define TK_IGNORE 173
|
||||
#define TK_IMMEDIATE 174
|
||||
#define TK_INITIALLY 175
|
||||
#define TK_INSTEAD 176
|
||||
#define TK_KEY 177
|
||||
#define TK_OF 178
|
||||
#define TK_RAISE 179
|
||||
#define TK_REPLACE 180
|
||||
#define TK_RESTRICT 181
|
||||
#define TK_ROW 182
|
||||
#define TK_STATEMENT 183
|
||||
#define TK_TRIGGER 184
|
||||
#define TK_VIEW 185
|
||||
#define TK_IPTOKEN 186
|
||||
#define TK_SEMI 187
|
||||
#define TK_NONE 188
|
||||
#define TK_PREV 189
|
||||
#define TK_LINEAR 190
|
||||
#define TK_IMPORT 191
|
||||
#define TK_TBNAME 192
|
||||
#define TK_JOIN 193
|
||||
#define TK_INSERT 194
|
||||
#define TK_INTO 195
|
||||
#define TK_VALUES 196
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -379,8 +379,10 @@ SDropStbMsg* buildDropStableMsg(SSqlInfo* pInfo, int32_t* len, SParseBasicCtx* p
|
|||
SCreateDnodeMsg *buildCreateDnodeMsg(SSqlInfo* pInfo, int32_t* len, SMsgBuf* pMsgBuf) {
|
||||
const char* msg1 = "invalid host name (name too long, maximum length 128)";
|
||||
const char* msg2 = "dnode name can not be string";
|
||||
const char* msg3 = "port should be an integer that is less than 65535";
|
||||
const char* msg4 = "failed prepare create dnode message";
|
||||
|
||||
if (taosArrayGetSize(pInfo->pMiscInfo->a) > 1) {
|
||||
if (taosArrayGetSize(pInfo->pMiscInfo->a) != 2) {
|
||||
buildInvalidOperationMsg(pMsgBuf, msg1);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -391,10 +393,31 @@ SCreateDnodeMsg *buildCreateDnodeMsg(SSqlInfo* pInfo, int32_t* len, SMsgBuf* pMs
|
|||
return NULL;
|
||||
}
|
||||
|
||||
SCreateDnodeMsg *pCreate = (SCreateDnodeMsg *) calloc(1, sizeof(SCreateDnodeMsg));
|
||||
strncpy(pCreate->ep, id->z, id->n);
|
||||
*len = sizeof(SCreateDnodeMsg);
|
||||
SToken* port = taosArrayGet(pInfo->pMiscInfo->a, 1);
|
||||
if (port->type != TK_INTEGER) {
|
||||
buildInvalidOperationMsg(pMsgBuf, msg3);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool isSign = false;
|
||||
int64_t val = 0;
|
||||
|
||||
toInteger(port->z, port->n, 10, &val, &isSign);
|
||||
if (val >= UINT16_MAX) {
|
||||
buildInvalidOperationMsg(pMsgBuf, msg3);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
SCreateDnodeMsg *pCreate = (SCreateDnodeMsg *) calloc(1, sizeof(SCreateDnodeMsg));
|
||||
if (pCreate == NULL) {
|
||||
buildInvalidOperationMsg(pMsgBuf, msg4);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
strncpy(pCreate->ep, id->z, id->n);
|
||||
pCreate->port = val;
|
||||
|
||||
*len = sizeof(SCreateDnodeMsg);
|
||||
return pCreate;
|
||||
}
|
||||
|
||||
|
|
|
@ -3986,7 +3986,6 @@ int32_t qParserValidateSqlNode(struct SCatalog* pCatalog, SSqlInfo* pInfo, SQuer
|
|||
return buildInvalidOperationMsg(pMsgBuf, "not support sql expression");
|
||||
}
|
||||
|
||||
|
||||
SCatalogReq req = {0};
|
||||
SMetaData data = {0};
|
||||
|
||||
|
@ -4023,6 +4022,5 @@ int32_t qParserValidateSqlNode(struct SCatalog* pCatalog, SSqlInfo* pInfo, SQuer
|
|||
validateSqlNode(p, pQueryInfo, &buf);
|
||||
}
|
||||
|
||||
|
||||
return code;
|
||||
}
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
#include "tglobal.h"
|
||||
#include "parserInt.h"
|
||||
#include <ttime.h>
|
||||
#include "astToMsg.h"
|
||||
#include "parserInt.h"
|
||||
#include "parserUtil.h"
|
||||
#include "queryInfoUtil.h"
|
||||
#include "tglobal.h"
|
||||
|
||||
/* is contained in pFieldList or not */
|
||||
static bool has(SArray* pFieldList, int32_t startIndex, const char* name) {
|
||||
|
@ -293,7 +294,6 @@ int32_t doCheckForCreateCTable(SSqlInfo* pInfo, SParseBasicCtx *pCtx, SMsgBuf* p
|
|||
// super table name, create table by using dst
|
||||
int32_t numOfTables = (int32_t) taosArrayGetSize(pCreateTable->childTableInfo);
|
||||
for(int32_t j = 0; j < numOfTables; ++j) {
|
||||
#if 0
|
||||
SCreatedTableInfo* pCreateTableInfo = taosArrayGet(pCreateTable->childTableInfo, j);
|
||||
|
||||
SToken* pSTableNameToken = &pCreateTableInfo->stbName;
|
||||
|
@ -341,12 +341,7 @@ int32_t doCheckForCreateCTable(SSqlInfo* pInfo, SParseBasicCtx *pCtx, SMsgBuf* p
|
|||
pNameList = pCreateTableInfo->pTagNames;
|
||||
nameSize = taosArrayGetSize(pNameList);
|
||||
|
||||
if (valSize != nameSize) {
|
||||
tdDestroyKVRowBuilder(&kvRowBuilder);
|
||||
return buildInvalidOperationMsg(pMsgBuf, msg2);
|
||||
}
|
||||
|
||||
if (schemaSize < valSize) {
|
||||
if (valSize != nameSize || schemaSize < valSize) {
|
||||
tdDestroyKVRowBuilder(&kvRowBuilder);
|
||||
return buildInvalidOperationMsg(pMsgBuf, msg2);
|
||||
}
|
||||
|
@ -359,15 +354,15 @@ int32_t doCheckForCreateCTable(SSqlInfo* pInfo, SParseBasicCtx *pCtx, SMsgBuf* p
|
|||
strncpy(tmpTokenBuf, sToken->z, sToken->n);
|
||||
sToken->z = tmpTokenBuf;
|
||||
|
||||
if (TK_STRING == sToken->type) {
|
||||
tscDequoteAndTrimToken(sToken);
|
||||
}
|
||||
// if (TK_STRING == sToken->type) {
|
||||
// tscDequoteAndTrimToken(sToken);
|
||||
// }
|
||||
|
||||
if (TK_ID == sToken->type) {
|
||||
tscRmEscapeAndTrimToken(sToken);
|
||||
}
|
||||
// if (TK_ID == sToken->type) {
|
||||
// tscRmEscapeAndTrimToken(sToken);
|
||||
// }
|
||||
|
||||
tVariantListItem* pItem = taosArrayGet(pValList, i);
|
||||
SListItem* pItem = taosArrayGet(pValList, i);
|
||||
|
||||
findColumnIndex = false;
|
||||
|
||||
|
@ -384,16 +379,16 @@ int32_t doCheckForCreateCTable(SSqlInfo* pInfo, SParseBasicCtx *pCtx, SMsgBuf* p
|
|||
}
|
||||
} else if (pSchema->type == TSDB_DATA_TYPE_TIMESTAMP) {
|
||||
if (pItem->pVar.nType == TSDB_DATA_TYPE_BINARY) {
|
||||
ret = convertTimestampStrToInt64(&(pItem->pVar), tinfo.precision);
|
||||
if (ret != TSDB_CODE_SUCCESS) {
|
||||
return buildInvalidOperationMsg(pMsgBuf, msg4);
|
||||
}
|
||||
// code = convertTimestampStrToInt64(&(pItem->pVar), tinfo.precision);
|
||||
// if (code != TSDB_CODE_SUCCESS) {
|
||||
// return buildInvalidOperationMsg(pMsgBuf, msg4);
|
||||
// }
|
||||
} else if (pItem->pVar.nType == TSDB_DATA_TYPE_TIMESTAMP) {
|
||||
pItem->pVar.i64 = convertTimePrecision(pItem->pVar.i64, TSDB_TIME_PRECISION_NANO, tinfo.precision);
|
||||
pItem->pVar.i = convertTimePrecision(pItem->pVar.i, TSDB_TIME_PRECISION_NANO, tinfo.precision);
|
||||
}
|
||||
}
|
||||
|
||||
code = tVariantDump(&(pItem->pVar), tagVal, pSchema->type, true);
|
||||
code = taosVariantDump(&(pItem->pVar), tagVal, pSchema->type, true);
|
||||
|
||||
// check again after the convert since it may be converted from binary to nchar.
|
||||
if (pSchema->type == TSDB_DATA_TYPE_BINARY || pSchema->type == TSDB_DATA_TYPE_NCHAR) {
|
||||
|
@ -428,8 +423,8 @@ int32_t doCheckForCreateCTable(SSqlInfo* pInfo, SParseBasicCtx *pCtx, SMsgBuf* p
|
|||
}
|
||||
|
||||
for (int32_t i = 0; i < valSize; ++i) {
|
||||
SSchema* pSchema = &pTagSchema[i];
|
||||
tVariantListItem* pItem = taosArrayGet(pValList, i);
|
||||
SSchema *pSchema = &pTagSchema[i];
|
||||
SListItem *pItem = taosArrayGet(pValList, i);
|
||||
|
||||
char tagVal[TSDB_MAX_TAGS_LEN];
|
||||
if (pSchema->type == TSDB_DATA_TYPE_BINARY || pSchema->type == TSDB_DATA_TYPE_NCHAR) {
|
||||
|
@ -439,16 +434,16 @@ int32_t doCheckForCreateCTable(SSqlInfo* pInfo, SParseBasicCtx *pCtx, SMsgBuf* p
|
|||
}
|
||||
} else if (pSchema->type == TSDB_DATA_TYPE_TIMESTAMP) {
|
||||
if (pItem->pVar.nType == TSDB_DATA_TYPE_BINARY) {
|
||||
ret = convertTimestampStrToInt64(&(pItem->pVar), tinfo.precision);
|
||||
if (ret != TSDB_CODE_SUCCESS) {
|
||||
// code = convertTimestampStrToInt64(&(pItem->pVar), tinfo.precision);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
return buildInvalidOperationMsg(pMsgBuf, msg4);
|
||||
}
|
||||
} else if (pItem->pVar.nType == TSDB_DATA_TYPE_TIMESTAMP) {
|
||||
pItem->pVar.i64 = convertTimePrecision(pItem->pVar.i64, TSDB_TIME_PRECISION_NANO, tinfo.precision);
|
||||
pItem->pVar.i = convertTimePrecision(pItem->pVar.i, TSDB_TIME_PRECISION_NANO, tinfo.precision);
|
||||
}
|
||||
}
|
||||
|
||||
code = tVariantDump(&(pItem->pVar), tagVal, pSchema->type, true);
|
||||
code = taosVariantDump(&(pItem->pVar), tagVal, pSchema->type, true);
|
||||
|
||||
// check again after the convert since it may be converted from binary to nchar.
|
||||
if (pSchema->type == TSDB_DATA_TYPE_BINARY || pSchema->type == TSDB_DATA_TYPE_NCHAR) {
|
||||
|
@ -485,22 +480,21 @@ int32_t doCheckForCreateCTable(SSqlInfo* pInfo, SParseBasicCtx *pCtx, SMsgBuf* p
|
|||
|
||||
bool dbIncluded2 = false;
|
||||
// table name
|
||||
if (tscValidateName(&(pCreateTableInfo->name), true, &dbIncluded2) != TSDB_CODE_SUCCESS) {
|
||||
return buildInvalidOperationMsg(pMsgBuf, msg1);
|
||||
}
|
||||
// if (tscValidateName(&(pCreateTableInfo->name), true, &dbIncluded2) != TSDB_CODE_SUCCESS) {
|
||||
// return buildInvalidOperationMsg(pMsgBuf, msg1);
|
||||
// }
|
||||
|
||||
STableMetaInfo* pTableMetaInfo = tscGetMetaInfo(pQueryInfo, TABLE_INDEX);
|
||||
code = tscSetTableFullName(&pTableMetaInfo->name, &pCreateTableInfo->name, pSql, dbIncluded2);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
return code;
|
||||
}
|
||||
// STableMetaInfo* pTableMetaInfo = tscGetMetaInfo(pQueryInfo, TABLE_INDEX);
|
||||
// code = tscSetTableFullName(&pTableMetaInfo->name, &pCreateTableInfo->name, pSql, dbIncluded2);
|
||||
// if (code != TSDB_CODE_SUCCESS) {
|
||||
// return code;
|
||||
// }
|
||||
|
||||
pCreateTableInfo->fullname = calloc(1, tNameLen(&pTableMetaInfo->name) + 1);
|
||||
code = tNameExtractFullName(&pTableMetaInfo->name, pCreateTableInfo->fullname);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
return buildInvalidOperationMsg(pMsgBuf, msg1);
|
||||
}
|
||||
#endif
|
||||
// pCreateTableInfo->fullname = calloc(1, tNameLen(&pTableMetaInfo->name) + 1);
|
||||
// code = tNameExtractFullName(&pTableMetaInfo->name, pCreateTableInfo->fullname);
|
||||
// if (code != TSDB_CODE_SUCCESS) {
|
||||
// return buildInvalidOperationMsg(pMsgBuf, msg1);
|
||||
// }
|
||||
}
|
||||
|
||||
return TSDB_CODE_SUCCESS;
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -70,7 +70,7 @@ static SKeyword keywordTable[] = {
|
|||
{"STAR", TK_STAR},
|
||||
{"SLASH", TK_SLASH},
|
||||
{"REM ", TK_REM},
|
||||
{"||", TK_CONCAT},
|
||||
{"||", TK_CONCAT},
|
||||
{"UMINUS", TK_UMINUS},
|
||||
{"UPLUS", TK_UPLUS},
|
||||
{"BITNOT", TK_BITNOT},
|
||||
|
@ -227,6 +227,7 @@ static SKeyword keywordTable[] = {
|
|||
{"OUTPUTTYPE", TK_OUTPUTTYPE},
|
||||
{"AGGREGATE", TK_AGGREGATE},
|
||||
{"BUFSIZE", TK_BUFSIZE},
|
||||
{"PORT", TK_PORT},
|
||||
};
|
||||
|
||||
static const char isIdChar[] = {
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include "query.h"
|
||||
#include "tglobal.h"
|
||||
#include "tsched.h"
|
||||
#include "trpc.h"
|
||||
|
||||
#define VALIDNUMOFCOLS(x) ((x) >= TSDB_MIN_COLUMNS && (x) <= TSDB_MAX_COLUMNS)
|
||||
#define VALIDNUMOFTAGS(x) ((x) >= 0 && (x) <= TSDB_MAX_TAGS)
|
||||
|
@ -121,3 +122,27 @@ int32_t taosAsyncExec(__async_exec_fn_t execFn, void* execParam, int32_t* code)
|
|||
|
||||
taosScheduleTask(pTaskQueue, &schedMsg);
|
||||
}
|
||||
|
||||
int32_t asyncSendMsgToServer(void *pTransporter, SEpSet* epSet, int64_t* pTransporterId, const SMsgSendInfo* pInfo) {
|
||||
char *pMsg = rpcMallocCont(pInfo->msgInfo.len);
|
||||
if (NULL == pMsg) {
|
||||
qError("0x%"PRIx64" msg:%s malloc failed", pInfo->requestId, TMSG_INFO(pInfo->msgType));
|
||||
terrno = TSDB_CODE_TSC_OUT_OF_MEMORY;
|
||||
return -1;
|
||||
}
|
||||
|
||||
memcpy(pMsg, pInfo->msgInfo.pData, pInfo->msgInfo.len);
|
||||
SRpcMsg rpcMsg = {
|
||||
.msgType = pInfo->msgType,
|
||||
.pCont = pMsg,
|
||||
.contLen = pInfo->msgInfo.len,
|
||||
.ahandle = (void*) pInfo,
|
||||
.handle = NULL,
|
||||
.code = 0
|
||||
};
|
||||
|
||||
assert(pInfo->fp != NULL);
|
||||
|
||||
rpcSendRequest(pTransporter, epSet, &rpcMsg, pTransporterId);
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
|
@ -438,6 +438,12 @@ column(A) ::= ids(X) typename(Y). {
|
|||
tSetColumnInfo(&A, &X, &Y);
|
||||
}
|
||||
|
||||
%type tagitemlist1 {SArray*}
|
||||
%destructor tagitemlist1 {taosArrayDestroy($$);}
|
||||
|
||||
%type tagitem1 {SToken}
|
||||
|
||||
|
||||
%type tagitemlist {SArray*}
|
||||
%destructor tagitemlist {taosArrayDestroy($$);}
|
||||
|
||||
|
|
Loading…
Reference in New Issue