support update multi tag
This commit is contained in:
parent
868a1ce80c
commit
3027e377fa
|
@ -178,6 +178,7 @@ typedef enum _mgmt_table {
|
||||||
#define TSDB_ALTER_TABLE_DROP_TAG_INDEX 12
|
#define TSDB_ALTER_TABLE_DROP_TAG_INDEX 12
|
||||||
#define TSDB_ALTER_TABLE_UPDATE_COLUMN_COMPRESS 13
|
#define TSDB_ALTER_TABLE_UPDATE_COLUMN_COMPRESS 13
|
||||||
#define TSDB_ALTER_TABLE_ADD_COLUMN_WITH_COMPRESS_OPTION 14
|
#define TSDB_ALTER_TABLE_ADD_COLUMN_WITH_COMPRESS_OPTION 14
|
||||||
|
#define TSDB_ALTER_TABLE_UPDATE_MULTI_TAG_VAL 15
|
||||||
|
|
||||||
#define TSDB_FILL_NONE 0
|
#define TSDB_FILL_NONE 0
|
||||||
#define TSDB_FILL_NULL 1
|
#define TSDB_FILL_NULL 1
|
||||||
|
@ -351,6 +352,7 @@ typedef enum ENodeType {
|
||||||
QUERY_NODE_CREATE_ANODE_STMT,
|
QUERY_NODE_CREATE_ANODE_STMT,
|
||||||
QUERY_NODE_DROP_ANODE_STMT,
|
QUERY_NODE_DROP_ANODE_STMT,
|
||||||
QUERY_NODE_UPDATE_ANODE_STMT,
|
QUERY_NODE_UPDATE_ANODE_STMT,
|
||||||
|
QUERY_NODE_ALTER_TABLE_MULTI_STMT,
|
||||||
|
|
||||||
// show statement nodes
|
// show statement nodes
|
||||||
// see 'sysTableShowAdapter', 'SYSTABLE_SHOW_TYPE_OFFSET'
|
// see 'sysTableShowAdapter', 'SYSTABLE_SHOW_TYPE_OFFSET'
|
||||||
|
@ -421,7 +423,7 @@ typedef enum ENodeType {
|
||||||
// physical plan node
|
// physical plan node
|
||||||
QUERY_NODE_PHYSICAL_PLAN_TAG_SCAN = 1100,
|
QUERY_NODE_PHYSICAL_PLAN_TAG_SCAN = 1100,
|
||||||
QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN,
|
QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN,
|
||||||
QUERY_NODE_PHYSICAL_PLAN_TABLE_SEQ_SCAN, // INACTIVE
|
QUERY_NODE_PHYSICAL_PLAN_TABLE_SEQ_SCAN, // INACTIVE
|
||||||
QUERY_NODE_PHYSICAL_PLAN_TABLE_MERGE_SCAN,
|
QUERY_NODE_PHYSICAL_PLAN_TABLE_MERGE_SCAN,
|
||||||
QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN,
|
QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN,
|
||||||
QUERY_NODE_PHYSICAL_PLAN_SYSTABLE_SCAN,
|
QUERY_NODE_PHYSICAL_PLAN_SYSTABLE_SCAN,
|
||||||
|
@ -435,7 +437,7 @@ typedef enum ENodeType {
|
||||||
QUERY_NODE_PHYSICAL_PLAN_SORT,
|
QUERY_NODE_PHYSICAL_PLAN_SORT,
|
||||||
QUERY_NODE_PHYSICAL_PLAN_GROUP_SORT,
|
QUERY_NODE_PHYSICAL_PLAN_GROUP_SORT,
|
||||||
QUERY_NODE_PHYSICAL_PLAN_HASH_INTERVAL,
|
QUERY_NODE_PHYSICAL_PLAN_HASH_INTERVAL,
|
||||||
QUERY_NODE_PHYSICAL_PLAN_MERGE_INTERVAL, // INACTIVE
|
QUERY_NODE_PHYSICAL_PLAN_MERGE_INTERVAL, // INACTIVE
|
||||||
QUERY_NODE_PHYSICAL_PLAN_MERGE_ALIGNED_INTERVAL,
|
QUERY_NODE_PHYSICAL_PLAN_MERGE_ALIGNED_INTERVAL,
|
||||||
QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERVAL,
|
QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERVAL,
|
||||||
QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_INTERVAL,
|
QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_INTERVAL,
|
||||||
|
@ -985,7 +987,6 @@ typedef struct SEpSet {
|
||||||
SEp eps[TSDB_MAX_REPLICA];
|
SEp eps[TSDB_MAX_REPLICA];
|
||||||
} SEpSet;
|
} SEpSet;
|
||||||
|
|
||||||
|
|
||||||
int32_t tEncodeSEpSet(SEncoder* pEncoder, const SEpSet* pEp);
|
int32_t tEncodeSEpSet(SEncoder* pEncoder, const SEpSet* pEp);
|
||||||
int32_t tDecodeSEpSet(SDecoder* pDecoder, SEpSet* pEp);
|
int32_t tDecodeSEpSet(SDecoder* pDecoder, SEpSet* pEp);
|
||||||
int32_t taosEncodeSEpSet(void** buf, const SEpSet* pEp);
|
int32_t taosEncodeSEpSet(void** buf, const SEpSet* pEp);
|
||||||
|
@ -3259,6 +3260,16 @@ int32_t tEncodeSVDropTbBatchRsp(SEncoder* pCoder, const SVDropTbBatchRsp* pRsp);
|
||||||
int32_t tDecodeSVDropTbBatchRsp(SDecoder* pCoder, SVDropTbBatchRsp* pRsp);
|
int32_t tDecodeSVDropTbBatchRsp(SDecoder* pCoder, SVDropTbBatchRsp* pRsp);
|
||||||
|
|
||||||
// TDMT_VND_ALTER_TABLE =====================
|
// TDMT_VND_ALTER_TABLE =====================
|
||||||
|
typedef struct SMultiTagUpateVal {
|
||||||
|
char* tagName;
|
||||||
|
int32_t colId;
|
||||||
|
int8_t tagType;
|
||||||
|
int8_t tagFree;
|
||||||
|
uint32_t nTagVal;
|
||||||
|
uint8_t* pTagVal;
|
||||||
|
int8_t isNull;
|
||||||
|
SArray* pTagArray;
|
||||||
|
} SMultiTagUpateVal;
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char* tbName;
|
char* tbName;
|
||||||
int8_t action;
|
int8_t action;
|
||||||
|
@ -3285,9 +3296,10 @@ typedef struct {
|
||||||
int32_t newTTL;
|
int32_t newTTL;
|
||||||
int32_t newCommentLen;
|
int32_t newCommentLen;
|
||||||
char* newComment;
|
char* newComment;
|
||||||
int64_t ctimeMs; // fill by vnode
|
int64_t ctimeMs; // fill by vnode
|
||||||
int8_t source; // TD_REQ_FROM_TAOX-taosX or TD_REQ_FROM_APP-taosClient
|
int8_t source; // TD_REQ_FROM_TAOX-taosX or TD_REQ_FROM_APP-taosClient
|
||||||
uint32_t compress; // TSDB_ALTER_TABLE_UPDATE_COLUMN_COMPRESS
|
uint32_t compress; // TSDB_ALTER_TABLE_UPDATE_COLUMN_COMPRESS
|
||||||
|
SArray* pMultiTag; // TSDB_ALTER_TABLE_ADD_MULTI_TAGS
|
||||||
} SVAlterTbReq;
|
} SVAlterTbReq;
|
||||||
|
|
||||||
int32_t tEncodeSVAlterTbReq(SEncoder* pEncoder, const SVAlterTbReq* pReq);
|
int32_t tEncodeSVAlterTbReq(SEncoder* pEncoder, const SVAlterTbReq* pReq);
|
||||||
|
@ -4143,20 +4155,20 @@ typedef struct {
|
||||||
SArray* blockTbName;
|
SArray* blockTbName;
|
||||||
SArray* blockSchema;
|
SArray* blockSchema;
|
||||||
|
|
||||||
union{
|
union {
|
||||||
struct{
|
struct {
|
||||||
int64_t sleepTime;
|
int64_t sleepTime;
|
||||||
};
|
};
|
||||||
struct{
|
struct {
|
||||||
int32_t createTableNum;
|
int32_t createTableNum;
|
||||||
SArray* createTableLen;
|
SArray* createTableLen;
|
||||||
SArray* createTableReq;
|
SArray* createTableReq;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
} SMqDataRsp;
|
} SMqDataRsp;
|
||||||
|
|
||||||
int32_t tEncodeMqDataRsp(SEncoder *pEncoder, const SMqDataRsp *pObj);
|
int32_t tEncodeMqDataRsp(SEncoder* pEncoder, const SMqDataRsp* pObj);
|
||||||
int32_t tDecodeMqDataRsp(SDecoder* pDecoder, SMqDataRsp* pRsp);
|
int32_t tDecodeMqDataRsp(SDecoder* pDecoder, SMqDataRsp* pRsp);
|
||||||
void tDeleteMqDataRsp(SMqDataRsp* pRsp);
|
void tDeleteMqDataRsp(SMqDataRsp* pRsp);
|
||||||
|
|
||||||
|
|
|
@ -264,8 +264,30 @@ typedef struct SAlterTableStmt {
|
||||||
SDataType dataType;
|
SDataType dataType;
|
||||||
SValueNode* pVal;
|
SValueNode* pVal;
|
||||||
SColumnOptions* pColOptions;
|
SColumnOptions* pColOptions;
|
||||||
|
SNodeList* pNodeListTagValue;
|
||||||
} SAlterTableStmt;
|
} SAlterTableStmt;
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct SAlterTableStmt2 {
|
||||||
|
ENodeType type;
|
||||||
|
int8_t alterType;
|
||||||
|
char colName[TSDB_COL_NAME_LEN];
|
||||||
|
STableOptions* pOptions;
|
||||||
|
SDataType dataType;
|
||||||
|
SValueNode* pVal;
|
||||||
|
SColumnOptions* pColOptions;
|
||||||
|
|
||||||
|
} SAlterTableStmt2;
|
||||||
|
|
||||||
|
typedef struct SAlterTableMultiStmt {
|
||||||
|
ENodeType type;
|
||||||
|
char dbName[TSDB_DB_NAME_LEN];
|
||||||
|
char tableName[TSDB_TABLE_NAME_LEN];
|
||||||
|
int8_t alterType;
|
||||||
|
|
||||||
|
SNodeList* pNodeListTagValue;
|
||||||
|
} SAlterTableMultiStmt;
|
||||||
|
|
||||||
typedef struct SCreateUserStmt {
|
typedef struct SCreateUserStmt {
|
||||||
ENodeType type;
|
ENodeType type;
|
||||||
char userName[TSDB_USER_LEN];
|
char userName[TSDB_USER_LEN];
|
||||||
|
@ -341,7 +363,7 @@ typedef struct SShowStmt {
|
||||||
SNode* pTbName; // SValueNode
|
SNode* pTbName; // SValueNode
|
||||||
EOperatorType tableCondType;
|
EOperatorType tableCondType;
|
||||||
EShowKind showKind; // show databases: user/system, show tables: normal/child, others NULL
|
EShowKind showKind; // show databases: user/system, show tables: normal/child, others NULL
|
||||||
bool withFull; // for show users full;
|
bool withFull; // for show users full;
|
||||||
} SShowStmt;
|
} SShowStmt;
|
||||||
|
|
||||||
typedef struct SShowCreateDatabaseStmt {
|
typedef struct SShowCreateDatabaseStmt {
|
||||||
|
@ -651,7 +673,7 @@ typedef struct SCreateTSMAStmt {
|
||||||
bool ignoreExists;
|
bool ignoreExists;
|
||||||
char tsmaName[TSDB_TABLE_NAME_LEN];
|
char tsmaName[TSDB_TABLE_NAME_LEN];
|
||||||
char dbName[TSDB_DB_NAME_LEN];
|
char dbName[TSDB_DB_NAME_LEN];
|
||||||
char tableName[TSDB_TABLE_NAME_LEN]; // base tb name or base tsma name
|
char tableName[TSDB_TABLE_NAME_LEN]; // base tb name or base tsma name
|
||||||
char originalTbName[TSDB_TABLE_NAME_LEN];
|
char originalTbName[TSDB_TABLE_NAME_LEN];
|
||||||
STSMAOptions* pOptions;
|
STSMAOptions* pOptions;
|
||||||
SNode* pPrevQuery;
|
SNode* pPrevQuery;
|
||||||
|
@ -660,10 +682,10 @@ typedef struct SCreateTSMAStmt {
|
||||||
} SCreateTSMAStmt;
|
} SCreateTSMAStmt;
|
||||||
|
|
||||||
typedef struct SDropTSMAStmt {
|
typedef struct SDropTSMAStmt {
|
||||||
ENodeType type;
|
ENodeType type;
|
||||||
bool ignoreNotExists;
|
bool ignoreNotExists;
|
||||||
char dbName[TSDB_DB_NAME_LEN];
|
char dbName[TSDB_DB_NAME_LEN];
|
||||||
char tsmaName[TSDB_TABLE_NAME_LEN];
|
char tsmaName[TSDB_TABLE_NAME_LEN];
|
||||||
} SDropTSMAStmt;
|
} SDropTSMAStmt;
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
@ -2166,9 +2166,9 @@ int32_t tSerializeRetrieveAnalAlgoRsp(void *buf, int32_t bufLen, SRetrieveAnalAl
|
||||||
int32_t numOfAlgos = 0;
|
int32_t numOfAlgos = 0;
|
||||||
void *pIter = taosHashIterate(pRsp->hash, NULL);
|
void *pIter = taosHashIterate(pRsp->hash, NULL);
|
||||||
while (pIter != NULL) {
|
while (pIter != NULL) {
|
||||||
SAnalyticsUrl *pUrl = pIter;
|
SAnalyticsUrl *pUrl = pIter;
|
||||||
size_t nameLen = 0;
|
size_t nameLen = 0;
|
||||||
const char *name = taosHashGetKey(pIter, &nameLen);
|
const char *name = taosHashGetKey(pIter, &nameLen);
|
||||||
if (nameLen > 0 && nameLen <= TSDB_ANALYTIC_ALGO_KEY_LEN && pUrl->urlLen > 0) {
|
if (nameLen > 0 && nameLen <= TSDB_ANALYTIC_ALGO_KEY_LEN && pUrl->urlLen > 0) {
|
||||||
numOfAlgos++;
|
numOfAlgos++;
|
||||||
}
|
}
|
||||||
|
@ -2181,9 +2181,9 @@ int32_t tSerializeRetrieveAnalAlgoRsp(void *buf, int32_t bufLen, SRetrieveAnalAl
|
||||||
|
|
||||||
pIter = taosHashIterate(pRsp->hash, NULL);
|
pIter = taosHashIterate(pRsp->hash, NULL);
|
||||||
while (pIter != NULL) {
|
while (pIter != NULL) {
|
||||||
SAnalyticsUrl *pUrl = pIter;
|
SAnalyticsUrl *pUrl = pIter;
|
||||||
size_t nameLen = 0;
|
size_t nameLen = 0;
|
||||||
const char *name = taosHashGetKey(pIter, &nameLen);
|
const char *name = taosHashGetKey(pIter, &nameLen);
|
||||||
if (nameLen > 0 && pUrl->urlLen > 0) {
|
if (nameLen > 0 && pUrl->urlLen > 0) {
|
||||||
TAOS_CHECK_EXIT(tEncodeI32(&encoder, nameLen));
|
TAOS_CHECK_EXIT(tEncodeI32(&encoder, nameLen));
|
||||||
TAOS_CHECK_EXIT(tEncodeBinary(&encoder, (const uint8_t *)name, nameLen));
|
TAOS_CHECK_EXIT(tEncodeBinary(&encoder, (const uint8_t *)name, nameLen));
|
||||||
|
@ -2221,10 +2221,10 @@ int32_t tDeserializeRetrieveAnalAlgoRsp(void *buf, int32_t bufLen, SRetrieveAnal
|
||||||
int32_t lino;
|
int32_t lino;
|
||||||
tDecoderInit(&decoder, buf, bufLen);
|
tDecoderInit(&decoder, buf, bufLen);
|
||||||
|
|
||||||
int32_t numOfAlgos = 0;
|
int32_t numOfAlgos = 0;
|
||||||
int32_t nameLen;
|
int32_t nameLen;
|
||||||
int32_t type;
|
int32_t type;
|
||||||
char name[TSDB_ANALYTIC_ALGO_KEY_LEN];
|
char name[TSDB_ANALYTIC_ALGO_KEY_LEN];
|
||||||
SAnalyticsUrl url = {0};
|
SAnalyticsUrl url = {0};
|
||||||
|
|
||||||
TAOS_CHECK_EXIT(tStartDecode(&decoder));
|
TAOS_CHECK_EXIT(tStartDecode(&decoder));
|
||||||
|
@ -10511,6 +10511,20 @@ int32_t tEncodeSVAlterTbReq(SEncoder *pEncoder, const SVAlterTbReq *pReq) {
|
||||||
TAOS_CHECK_EXIT(tEncodeBinary(pEncoder, pReq->pTagVal, pReq->nTagVal));
|
TAOS_CHECK_EXIT(tEncodeBinary(pEncoder, pReq->pTagVal, pReq->nTagVal));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case TSDB_ALTER_TABLE_UPDATE_MULTI_TAG_VAL:
|
||||||
|
int32_t nTags = taosArrayGetSize(pReq->pMultiTag);
|
||||||
|
TAOS_CHECK_EXIT(tEncodeI32v(pEncoder, nTags));
|
||||||
|
for (int32_t i = 0; i < nTags; i++) {
|
||||||
|
SMultiTagUpateVal *pTag = taosArrayGet(pReq->pMultiTag, i);
|
||||||
|
TAOS_CHECK_EXIT(tEncodeI32v(pEncoder, pTag->colId));
|
||||||
|
TAOS_CHECK_EXIT(tEncodeCStr(pEncoder, pTag->tagName));
|
||||||
|
TAOS_CHECK_EXIT(tEncodeI8(pEncoder, pTag->isNull));
|
||||||
|
TAOS_CHECK_EXIT(tEncodeI8(pEncoder, pTag->tagType));
|
||||||
|
if (!pTag->isNull) {
|
||||||
|
TAOS_CHECK_EXIT(tEncodeBinary(pEncoder, pTag->pTagVal, pReq->nTagVal));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
case TSDB_ALTER_TABLE_UPDATE_OPTIONS:
|
case TSDB_ALTER_TABLE_UPDATE_OPTIONS:
|
||||||
TAOS_CHECK_EXIT(tEncodeI8(pEncoder, pReq->updateTTL));
|
TAOS_CHECK_EXIT(tEncodeI8(pEncoder, pReq->updateTTL));
|
||||||
if (pReq->updateTTL) {
|
if (pReq->updateTTL) {
|
||||||
|
@ -10577,6 +10591,27 @@ static int32_t tDecodeSVAlterTbReqCommon(SDecoder *pDecoder, SVAlterTbReq *pReq)
|
||||||
TAOS_CHECK_EXIT(tDecodeBinary(pDecoder, &pReq->pTagVal, &pReq->nTagVal));
|
TAOS_CHECK_EXIT(tDecodeBinary(pDecoder, &pReq->pTagVal, &pReq->nTagVal));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case TSDB_ALTER_TABLE_UPDATE_MULTI_TAG_VAL:
|
||||||
|
int32_t nTags;
|
||||||
|
TAOS_CHECK_EXIT(tDecodeI32v(pDecoder, &nTags));
|
||||||
|
pReq->pMultiTag = taosArrayInit(nTags, sizeof(SMultiTagUpateVal));
|
||||||
|
if (pReq->pMultiTag == NULL) {
|
||||||
|
TAOS_CHECK_EXIT(terrno);
|
||||||
|
}
|
||||||
|
for (int32_t i = 0; i < nTags; i++) {
|
||||||
|
SMultiTagUpateVal tag;
|
||||||
|
TAOS_CHECK_EXIT(tDecodeI32v(pDecoder, &tag.colId));
|
||||||
|
TAOS_CHECK_EXIT(tDecodeCStr(pDecoder, &tag.tagName));
|
||||||
|
TAOS_CHECK_EXIT(tDecodeI8(pDecoder, &tag.isNull));
|
||||||
|
TAOS_CHECK_EXIT(tDecodeI8(pDecoder, &tag.tagType));
|
||||||
|
if (!tag.isNull) {
|
||||||
|
TAOS_CHECK_EXIT(tDecodeBinary(pDecoder, &tag.pTagVal, &tag.nTagVal));
|
||||||
|
}
|
||||||
|
if (taosArrayPush(pReq->pMultiTag, &tag) == NULL) {
|
||||||
|
TAOS_CHECK_EXIT(terrno);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
case TSDB_ALTER_TABLE_UPDATE_OPTIONS:
|
case TSDB_ALTER_TABLE_UPDATE_OPTIONS:
|
||||||
TAOS_CHECK_EXIT(tDecodeI8(pDecoder, &pReq->updateTTL));
|
TAOS_CHECK_EXIT(tDecodeI8(pDecoder, &pReq->updateTTL));
|
||||||
if (pReq->updateTTL) {
|
if (pReq->updateTTL) {
|
||||||
|
|
|
@ -2011,6 +2011,7 @@ _err:
|
||||||
return terrno != 0 ? terrno : TSDB_CODE_FAILED;
|
return terrno != 0 ? terrno : TSDB_CODE_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int metaUpdateTableMultiTagVal(SMeta *pMeta, int64_t version, SVAlterTbReq *pAlterTbReq) { return 0; }
|
||||||
static int metaUpdateTableTagVal(SMeta *pMeta, int64_t version, SVAlterTbReq *pAlterTbReq) {
|
static int metaUpdateTableTagVal(SMeta *pMeta, int64_t version, SVAlterTbReq *pAlterTbReq) {
|
||||||
SMetaEntry ctbEntry = {0};
|
SMetaEntry ctbEntry = {0};
|
||||||
SMetaEntry stbEntry = {0};
|
SMetaEntry stbEntry = {0};
|
||||||
|
@ -2736,6 +2737,9 @@ int metaAlterTable(SMeta *pMeta, int64_t version, SVAlterTbReq *pReq, STableMeta
|
||||||
return metaAlterTableColumn(pMeta, version, pReq, pMetaRsp);
|
return metaAlterTableColumn(pMeta, version, pReq, pMetaRsp);
|
||||||
case TSDB_ALTER_TABLE_UPDATE_TAG_VAL:
|
case TSDB_ALTER_TABLE_UPDATE_TAG_VAL:
|
||||||
return metaUpdateTableTagVal(pMeta, version, pReq);
|
return metaUpdateTableTagVal(pMeta, version, pReq);
|
||||||
|
case TSDB_ALTER_TABLE_UPDATE_MULTI_TAG_VAL:
|
||||||
|
return metaUpdateTableMultiTagVal(pMeta, version, pReq);
|
||||||
|
return terrno = TSDB_CODE_VND_INVALID_TABLE_ACTION;
|
||||||
case TSDB_ALTER_TABLE_UPDATE_OPTIONS:
|
case TSDB_ALTER_TABLE_UPDATE_OPTIONS:
|
||||||
return metaUpdateTableOptions(pMeta, version, pReq);
|
return metaUpdateTableOptions(pMeta, version, pReq);
|
||||||
case TSDB_ALTER_TABLE_ADD_TAG_INDEX:
|
case TSDB_ALTER_TABLE_ADD_TAG_INDEX:
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -165,6 +165,7 @@ SNode* createInterpTimeRange(SAstCreateContext* pCxt, SNode* pStart, SNode*
|
||||||
SNode* createInterpTimePoint(SAstCreateContext* pCxt, SNode* pPoint);
|
SNode* createInterpTimePoint(SAstCreateContext* pCxt, SNode* pPoint);
|
||||||
SNode* createWhenThenNode(SAstCreateContext* pCxt, SNode* pWhen, SNode* pThen);
|
SNode* createWhenThenNode(SAstCreateContext* pCxt, SNode* pWhen, SNode* pThen);
|
||||||
SNode* createCaseWhenNode(SAstCreateContext* pCxt, SNode* pCase, SNodeList* pWhenThenList, SNode* pElse);
|
SNode* createCaseWhenNode(SAstCreateContext* pCxt, SNode* pCase, SNodeList* pWhenThenList, SNode* pElse);
|
||||||
|
SNode* createAlterSingleTagColumnNode(SAstCreateContext* pCtx, SToken* token, SNode* pVal);
|
||||||
|
|
||||||
SNode* addWhereClause(SAstCreateContext* pCxt, SNode* pStmt, SNode* pWhere);
|
SNode* addWhereClause(SAstCreateContext* pCxt, SNode* pStmt, SNode* pWhere);
|
||||||
SNode* addPartitionByClause(SAstCreateContext* pCxt, SNode* pStmt, SNodeList* pPartitionByList);
|
SNode* addPartitionByClause(SAstCreateContext* pCxt, SNode* pStmt, SNodeList* pPartitionByList);
|
||||||
|
@ -228,6 +229,7 @@ SNode* createAlterTableDropCol(SAstCreateContext* pCxt, SNode* pRealTable, int8_
|
||||||
SNode* createAlterTableRenameCol(SAstCreateContext* pCxt, SNode* pRealTable, int8_t alterType, SToken* pOldColName,
|
SNode* createAlterTableRenameCol(SAstCreateContext* pCxt, SNode* pRealTable, int8_t alterType, SToken* pOldColName,
|
||||||
SToken* pNewColName);
|
SToken* pNewColName);
|
||||||
SNode* createAlterTableSetTag(SAstCreateContext* pCxt, SNode* pRealTable, SToken* pTagName, SNode* pVal);
|
SNode* createAlterTableSetTag(SAstCreateContext* pCxt, SNode* pRealTable, SToken* pTagName, SNode* pVal);
|
||||||
|
SNode* createAlterTableSetMultiTagValue(SAstCreateContext* pCxt, SNode* pRealTable, SNodeList* singleNode);
|
||||||
SNode* setAlterSuperTableType(SNode* pStmt);
|
SNode* setAlterSuperTableType(SNode* pStmt);
|
||||||
SNode* createUseDatabaseStmt(SAstCreateContext* pCxt, SToken* pDbName);
|
SNode* createUseDatabaseStmt(SAstCreateContext* pCxt, SToken* pDbName);
|
||||||
SNode* setShowKind(SAstCreateContext* pCxt, SNode* pStmt, EShowKind showKind);
|
SNode* setShowKind(SAstCreateContext* pCxt, SNode* pStmt, EShowKind showKind);
|
||||||
|
|
|
@ -370,6 +370,7 @@ cmd ::= DROP STABLE with_opt(A) exists_opt(B) full_table_name(C).
|
||||||
cmd ::= ALTER TABLE alter_table_clause(A). { pCxt->pRootNode = A; }
|
cmd ::= ALTER TABLE alter_table_clause(A). { pCxt->pRootNode = A; }
|
||||||
cmd ::= ALTER STABLE alter_table_clause(A). { pCxt->pRootNode = setAlterSuperTableType(A); }
|
cmd ::= ALTER STABLE alter_table_clause(A). { pCxt->pRootNode = setAlterSuperTableType(A); }
|
||||||
|
|
||||||
|
|
||||||
alter_table_clause(A) ::= full_table_name(B) alter_table_options(C). { A = createAlterTableModifyOptions(pCxt, B, C); }
|
alter_table_clause(A) ::= full_table_name(B) alter_table_options(C). { A = createAlterTableModifyOptions(pCxt, B, C); }
|
||||||
alter_table_clause(A) ::=
|
alter_table_clause(A) ::=
|
||||||
full_table_name(B) ADD COLUMN column_name(C) type_name(D) column_options(E). { A = createAlterTableAddModifyColOptions2(pCxt, B, TSDB_ALTER_TABLE_ADD_COLUMN, &C, D, E); }
|
full_table_name(B) ADD COLUMN column_name(C) type_name(D) column_options(E). { A = createAlterTableAddModifyColOptions2(pCxt, B, TSDB_ALTER_TABLE_ADD_COLUMN, &C, D, E); }
|
||||||
|
@ -387,8 +388,16 @@ alter_table_clause(A) ::=
|
||||||
full_table_name(B) MODIFY TAG column_name(C) type_name(D). { A = createAlterTableAddModifyCol(pCxt, B, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &C, D); }
|
full_table_name(B) MODIFY TAG column_name(C) type_name(D). { A = createAlterTableAddModifyCol(pCxt, B, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &C, D); }
|
||||||
alter_table_clause(A) ::=
|
alter_table_clause(A) ::=
|
||||||
full_table_name(B) RENAME TAG column_name(C) column_name(D). { A = createAlterTableRenameCol(pCxt, B, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &C, &D); }
|
full_table_name(B) RENAME TAG column_name(C) column_name(D). { A = createAlterTableRenameCol(pCxt, B, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &C, &D); }
|
||||||
|
|
||||||
|
|
||||||
|
%type column_eq_value_list { SNodeList* }
|
||||||
|
%destructor column_eq_value_list { nodesDestroyList($$); }
|
||||||
|
column_eq_value(A) ::= column_name(C) NK_EQ tags_literal(D). { A = createAlterSingleTagColumnNode(pCxt, &C, D); }
|
||||||
|
column_eq_value_list(A) ::= column_eq_value(B). { A = createNodeList(pCxt, B); }
|
||||||
|
column_eq_value_list(A) ::= column_eq_value_list(B) NK_COMMA column_eq_value(C). { A = addNodeToList(pCxt, B, C);}
|
||||||
|
|
||||||
alter_table_clause(A) ::=
|
alter_table_clause(A) ::=
|
||||||
full_table_name(B) SET TAG column_name(C) NK_EQ tags_literal(D). { A = createAlterTableSetTag(pCxt, B, &C, D); }
|
full_table_name(B) SET TAG column_eq_value_list(C). { A = createAlterTableSetMultiTagValue(pCxt, B, C); }
|
||||||
|
|
||||||
%type multi_create_clause { SNodeList* }
|
%type multi_create_clause { SNodeList* }
|
||||||
%destructor multi_create_clause { nodesDestroyList($$); }
|
%destructor multi_create_clause { nodesDestroyList($$); }
|
||||||
|
|
|
@ -1976,7 +1976,7 @@ static SNode* setDatabaseOptionImpl(SAstCreateContext* pCxt, SNode* pOptions, ED
|
||||||
case DB_OPTION_S3_COMPACT:
|
case DB_OPTION_S3_COMPACT:
|
||||||
pDbOptions->s3Compact = taosStr2Int8(((SToken*)pVal)->z, NULL, 10);
|
pDbOptions->s3Compact = taosStr2Int8(((SToken*)pVal)->z, NULL, 10);
|
||||||
break;
|
break;
|
||||||
case DB_OPTION_KEEP_TIME_OFFSET:
|
case DB_OPTION_KEEP_TIME_OFFSET:
|
||||||
pDbOptions->keepTimeOffset = taosStr2Int32(((SToken*)pVal)->z, NULL, 10);
|
pDbOptions->keepTimeOffset = taosStr2Int32(((SToken*)pVal)->z, NULL, 10);
|
||||||
break;
|
break;
|
||||||
case DB_OPTION_ENCRYPT_ALGORITHM:
|
case DB_OPTION_ENCRYPT_ALGORITHM:
|
||||||
|
@ -2427,6 +2427,12 @@ static SNode* createAlterTableStmtFinalize(SNode* pRealTable, SAlterTableStmt* p
|
||||||
nodesDestroyNode(pRealTable);
|
nodesDestroyNode(pRealTable);
|
||||||
return (SNode*)pStmt;
|
return (SNode*)pStmt;
|
||||||
}
|
}
|
||||||
|
static SNode* createAlterTableMultiStmtFinalize(SNode* pRealTable, SAlterTableMultiStmt* pStmt) {
|
||||||
|
strcpy(pStmt->dbName, ((SRealTableNode*)pRealTable)->table.dbName);
|
||||||
|
strcpy(pStmt->tableName, ((SRealTableNode*)pRealTable)->table.tableName);
|
||||||
|
nodesDestroyNode(pRealTable);
|
||||||
|
return (SNode*)pStmt;
|
||||||
|
}
|
||||||
|
|
||||||
SNode* createAlterTableModifyOptions(SAstCreateContext* pCxt, SNode* pRealTable, SNode* pOptions) {
|
SNode* createAlterTableModifyOptions(SAstCreateContext* pCxt, SNode* pRealTable, SNode* pOptions) {
|
||||||
CHECK_PARSER_STATUS(pCxt);
|
CHECK_PARSER_STATUS(pCxt);
|
||||||
|
@ -2541,6 +2547,19 @@ _err:
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SNode* createAlterSingleTagColumnNode(SAstCreateContext* pCtx, SToken* pTagName, SNode* pVal) {
|
||||||
|
CHECK_PARSER_STATUS(pCtx);
|
||||||
|
SAlterTableStmt* pStmt = NULL;
|
||||||
|
pCtx->errCode = nodesMakeNode(QUERY_NODE_ALTER_TABLE_STMT, (SNode**)&pStmt);
|
||||||
|
CHECK_MAKE_NODE(pStmt);
|
||||||
|
pStmt->alterType = TSDB_ALTER_TABLE_UPDATE_TAG_VAL;
|
||||||
|
COPY_STRING_FORM_ID_TOKEN(pStmt->colName, pTagName);
|
||||||
|
pStmt->pVal = (SValueNode*)pVal;
|
||||||
|
return (SNode*)pStmt;
|
||||||
|
_err:
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
SNode* createAlterTableSetTag(SAstCreateContext* pCxt, SNode* pRealTable, SToken* pTagName, SNode* pVal) {
|
SNode* createAlterTableSetTag(SAstCreateContext* pCxt, SNode* pRealTable, SToken* pTagName, SNode* pVal) {
|
||||||
CHECK_PARSER_STATUS(pCxt);
|
CHECK_PARSER_STATUS(pCxt);
|
||||||
CHECK_NAME(checkColumnName(pCxt, pTagName));
|
CHECK_NAME(checkColumnName(pCxt, pTagName));
|
||||||
|
@ -2557,6 +2576,19 @@ _err:
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SNode* createAlterTableSetMultiTagValue(SAstCreateContext* pCxt, SNode* pRealTable, SNodeList* pList) {
|
||||||
|
CHECK_PARSER_STATUS(pCxt);
|
||||||
|
SAlterTableStmt* pStmt = NULL;
|
||||||
|
pCxt->errCode = nodesMakeNode(QUERY_NODE_ALTER_TABLE_STMT, (SNode**)&pStmt);
|
||||||
|
|
||||||
|
CHECK_MAKE_NODE(pStmt);
|
||||||
|
pStmt->alterType = TSDB_ALTER_TABLE_UPDATE_MULTI_TAG_VAL;
|
||||||
|
pStmt->pNodeListTagValue = pList;
|
||||||
|
return createAlterTableStmtFinalize(pRealTable, pStmt);
|
||||||
|
_err:
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
SNode* setAlterSuperTableType(SNode* pStmt) {
|
SNode* setAlterSuperTableType(SNode* pStmt) {
|
||||||
if (!pStmt) return NULL;
|
if (!pStmt) return NULL;
|
||||||
setNodeType(pStmt, QUERY_NODE_ALTER_SUPER_TABLE_STMT);
|
setNodeType(pStmt, QUERY_NODE_ALTER_SUPER_TABLE_STMT);
|
||||||
|
|
|
@ -46,7 +46,7 @@ int32_t buildQueryAfterParse(SQuery** pQuery, SNode* pRootNode, int16_t placehol
|
||||||
int32_t parse(SParseContext* pParseCxt, SQuery** pQuery) {
|
int32_t parse(SParseContext* pParseCxt, SQuery** pQuery) {
|
||||||
SAstCreateContext cxt;
|
SAstCreateContext cxt;
|
||||||
initAstCreateContext(pParseCxt, &cxt);
|
initAstCreateContext(pParseCxt, &cxt);
|
||||||
void* pParser = ParseAlloc((FMalloc)taosMemoryMalloc);
|
void* pParser = ParseAlloc((FMalloc)taosMemoryMalloc);
|
||||||
if (!pParser) return terrno;
|
if (!pParser) return terrno;
|
||||||
int32_t i = 0;
|
int32_t i = 0;
|
||||||
while (1) {
|
while (1) {
|
||||||
|
@ -210,15 +210,15 @@ static int32_t isTbnameEqCondOperator(SOperatorNode* pOperator, char** ppTableNa
|
||||||
if (pOperator->opType != OP_TYPE_EQUAL) {
|
if (pOperator->opType != OP_TYPE_EQUAL) {
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
SValueNode* pValueNode = NULL;
|
SValueNode* pValueNode = NULL;
|
||||||
if (nodeType(pOperator->pLeft) == QUERY_NODE_FUNCTION &&
|
if (nodeType(pOperator->pLeft) == QUERY_NODE_FUNCTION &&
|
||||||
0 == strcasecmp(((SFunctionNode*)(pOperator->pLeft))->functionName, "tbname") &&
|
0 == strcasecmp(((SFunctionNode*)(pOperator->pLeft))->functionName, "tbname") &&
|
||||||
nodeType(pOperator->pRight) == QUERY_NODE_VALUE) {
|
nodeType(pOperator->pRight) == QUERY_NODE_VALUE) {
|
||||||
pValueNode = (SValueNode*)pOperator->pRight;
|
pValueNode = (SValueNode*)pOperator->pRight;
|
||||||
} else if (nodeType(pOperator->pRight) == QUERY_NODE_FUNCTION &&
|
} else if (nodeType(pOperator->pRight) == QUERY_NODE_FUNCTION &&
|
||||||
0 == strcasecmp(((SFunctionNode*)(pOperator->pRight))->functionName, "tbname") &&
|
0 == strcasecmp(((SFunctionNode*)(pOperator->pRight))->functionName, "tbname") &&
|
||||||
nodeType(pOperator->pLeft) == QUERY_NODE_VALUE) {
|
nodeType(pOperator->pLeft) == QUERY_NODE_VALUE) {
|
||||||
pValueNode = (SValueNode*)pOperator->pLeft;
|
pValueNode = (SValueNode*)pOperator->pLeft;
|
||||||
} else {
|
} else {
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
|
@ -233,13 +233,14 @@ static EDealRes collectMetaKeyFromOperator(SCollectMetaKeyFromExprCxt* pCxt, SOp
|
||||||
if (!pCxt->tbnameCollect) {
|
if (!pCxt->tbnameCollect) {
|
||||||
return DEAL_RES_CONTINUE;
|
return DEAL_RES_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
char* pTableName = NULL;
|
char* pTableName = NULL;
|
||||||
int32_t code = isTbnameEqCondOperator((SOperatorNode*)pOpNode, &pTableName);
|
int32_t code = isTbnameEqCondOperator((SOperatorNode*)pOpNode, &pTableName);
|
||||||
if (TSDB_CODE_SUCCESS != code) return DEAL_RES_CONTINUE;
|
if (TSDB_CODE_SUCCESS != code) return DEAL_RES_CONTINUE;
|
||||||
if (pTableName) {
|
if (pTableName) {
|
||||||
SSelectStmt* pSelect = (SSelectStmt*)pCxt->pComCxt->pStmt;
|
SSelectStmt* pSelect = (SSelectStmt*)pCxt->pComCxt->pStmt;
|
||||||
pCxt->errCode = collectMetaKeyFromRealTableImpl(pCxt->pComCxt, ((SRealTableNode*)pSelect->pFromTable)->table.dbName, pTableName, AUTH_TYPE_READ);
|
pCxt->errCode = collectMetaKeyFromRealTableImpl(pCxt->pComCxt, ((SRealTableNode*)pSelect->pFromTable)->table.dbName,
|
||||||
|
pTableName, AUTH_TYPE_READ);
|
||||||
}
|
}
|
||||||
|
|
||||||
return TSDB_CODE_SUCCESS == pCxt->errCode ? DEAL_RES_CONTINUE : DEAL_RES_ERROR;
|
return TSDB_CODE_SUCCESS == pCxt->errCode ? DEAL_RES_CONTINUE : DEAL_RES_ERROR;
|
||||||
|
@ -500,7 +501,7 @@ static int32_t collectMetaKeyFromCreateStream(SCollectMetaKeyCxt* pCxt, SCreateS
|
||||||
reserveTableMetaInCache(pCxt->pParseCxt->acctId, pStmt->targetDbName, pStmt->targetTabName, pCxt->pMetaCache);
|
reserveTableMetaInCache(pCxt->pParseCxt->acctId, pStmt->targetDbName, pStmt->targetTabName, pCxt->pMetaCache);
|
||||||
if (TSDB_CODE_SUCCESS == code && NULL != pStmt->pSubtable && NULL != pStmt->pQuery) {
|
if (TSDB_CODE_SUCCESS == code && NULL != pStmt->pSubtable && NULL != pStmt->pQuery) {
|
||||||
SSelectStmt* pSelect = (SSelectStmt*)pStmt->pQuery;
|
SSelectStmt* pSelect = (SSelectStmt*)pStmt->pQuery;
|
||||||
int32_t code = nodesCloneNode(pStmt->pSubtable, &pSelect->pSubtable);
|
int32_t code = nodesCloneNode(pStmt->pSubtable, &pSelect->pSubtable);
|
||||||
if (NULL == pSelect->pSubtable) {
|
if (NULL == pSelect->pSubtable) {
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
@ -969,6 +970,7 @@ static int32_t collectMetaKeyFromQuery(SCollectMetaKeyCxt* pCxt, SNode* pStmt) {
|
||||||
case QUERY_NODE_DROP_SUPER_TABLE_STMT:
|
case QUERY_NODE_DROP_SUPER_TABLE_STMT:
|
||||||
return collectMetaKeyFromDropStable(pCxt, (SDropSuperTableStmt*)pStmt);
|
return collectMetaKeyFromDropStable(pCxt, (SDropSuperTableStmt*)pStmt);
|
||||||
case QUERY_NODE_ALTER_TABLE_STMT:
|
case QUERY_NODE_ALTER_TABLE_STMT:
|
||||||
|
case QUERY_NODE_ALTER_TABLE_MULTI_STMT:
|
||||||
return collectMetaKeyFromAlterTable(pCxt, (SAlterTableStmt*)pStmt);
|
return collectMetaKeyFromAlterTable(pCxt, (SAlterTableStmt*)pStmt);
|
||||||
case QUERY_NODE_ALTER_SUPER_TABLE_STMT:
|
case QUERY_NODE_ALTER_SUPER_TABLE_STMT:
|
||||||
return collectMetaKeyFromAlterStable(pCxt, (SAlterTableStmt*)pStmt);
|
return collectMetaKeyFromAlterStable(pCxt, (SAlterTableStmt*)pStmt);
|
||||||
|
|
|
@ -97,6 +97,7 @@ static const SSysTableShowAdapter sysTableShowAdapter[] = {
|
||||||
.showType = QUERY_NODE_SHOW_DNODES_STMT,
|
.showType = QUERY_NODE_SHOW_DNODES_STMT,
|
||||||
.pDbName = TSDB_INFORMATION_SCHEMA_DB,
|
.pDbName = TSDB_INFORMATION_SCHEMA_DB,
|
||||||
.pTableName = TSDB_INS_TABLE_DNODES,
|
.pTableName = TSDB_INS_TABLE_DNODES,
|
||||||
|
|
||||||
.numOfShowCols = 1,
|
.numOfShowCols = 1,
|
||||||
.pShowCols = {"*"}
|
.pShowCols = {"*"}
|
||||||
},
|
},
|
||||||
|
@ -1853,7 +1854,7 @@ static bool clauseSupportAlias(ESqlClause clause) {
|
||||||
return SQL_CLAUSE_GROUP_BY == clause || SQL_CLAUSE_PARTITION_BY == clause || SQL_CLAUSE_ORDER_BY == clause;
|
return SQL_CLAUSE_GROUP_BY == clause || SQL_CLAUSE_PARTITION_BY == clause || SQL_CLAUSE_ORDER_BY == clause;
|
||||||
}
|
}
|
||||||
|
|
||||||
static EDealRes translateColumnInGroupByClause(STranslateContext* pCxt, SColumnNode** pCol, bool *translateAsAlias) {
|
static EDealRes translateColumnInGroupByClause(STranslateContext* pCxt, SColumnNode** pCol, bool* translateAsAlias) {
|
||||||
*translateAsAlias = false;
|
*translateAsAlias = false;
|
||||||
// count(*)/first(*)/last(*) and so on
|
// count(*)/first(*)/last(*) and so on
|
||||||
if (0 == strcmp((*pCol)->colName, "*")) {
|
if (0 == strcmp((*pCol)->colName, "*")) {
|
||||||
|
@ -1862,7 +1863,7 @@ static EDealRes translateColumnInGroupByClause(STranslateContext* pCxt, SColumnN
|
||||||
|
|
||||||
if (pCxt->pParseCxt->biMode) {
|
if (pCxt->pParseCxt->biMode) {
|
||||||
SNode** ppNode = (SNode**)pCol;
|
SNode** ppNode = (SNode**)pCol;
|
||||||
bool ret;
|
bool ret;
|
||||||
pCxt->errCode = biRewriteToTbnameFunc(pCxt, ppNode, &ret);
|
pCxt->errCode = biRewriteToTbnameFunc(pCxt, ppNode, &ret);
|
||||||
if (TSDB_CODE_SUCCESS != pCxt->errCode) return DEAL_RES_ERROR;
|
if (TSDB_CODE_SUCCESS != pCxt->errCode) return DEAL_RES_ERROR;
|
||||||
if (ret) {
|
if (ret) {
|
||||||
|
@ -1876,9 +1877,8 @@ static EDealRes translateColumnInGroupByClause(STranslateContext* pCxt, SColumnN
|
||||||
} else {
|
} else {
|
||||||
bool found = false;
|
bool found = false;
|
||||||
res = translateColumnWithoutPrefix(pCxt, pCol);
|
res = translateColumnWithoutPrefix(pCxt, pCol);
|
||||||
if (!(*pCol)->node.asParam &&
|
if (!(*pCol)->node.asParam && res != DEAL_RES_CONTINUE && res != DEAL_RES_END &&
|
||||||
res != DEAL_RES_CONTINUE &&
|
pCxt->errCode != TSDB_CODE_PAR_AMBIGUOUS_COLUMN) {
|
||||||
res != DEAL_RES_END && pCxt->errCode != TSDB_CODE_PAR_AMBIGUOUS_COLUMN) {
|
|
||||||
res = translateColumnUseAlias(pCxt, pCol, &found);
|
res = translateColumnUseAlias(pCxt, pCol, &found);
|
||||||
*translateAsAlias = true;
|
*translateAsAlias = true;
|
||||||
}
|
}
|
||||||
|
@ -3321,9 +3321,11 @@ static int32_t selectCommonType(SDataType* commonType, const SDataType* newType)
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((resultType == TSDB_DATA_TYPE_VARCHAR) && (IS_MATHABLE_TYPE(commonType->type) || IS_MATHABLE_TYPE(newType->type))) {
|
if ((resultType == TSDB_DATA_TYPE_VARCHAR) &&
|
||||||
|
(IS_MATHABLE_TYPE(commonType->type) || IS_MATHABLE_TYPE(newType->type))) {
|
||||||
commonType->bytes = TMAX(TMAX(commonType->bytes, newType->bytes), QUERY_NUMBER_MAX_DISPLAY_LEN);
|
commonType->bytes = TMAX(TMAX(commonType->bytes, newType->bytes), QUERY_NUMBER_MAX_DISPLAY_LEN);
|
||||||
} else if ((resultType == TSDB_DATA_TYPE_NCHAR) && (IS_MATHABLE_TYPE(commonType->type) || IS_MATHABLE_TYPE(newType->type))) {
|
} else if ((resultType == TSDB_DATA_TYPE_NCHAR) &&
|
||||||
|
(IS_MATHABLE_TYPE(commonType->type) || IS_MATHABLE_TYPE(newType->type))) {
|
||||||
commonType->bytes = TMAX(TMAX(commonType->bytes, newType->bytes), QUERY_NUMBER_MAX_DISPLAY_LEN * TSDB_NCHAR_SIZE);
|
commonType->bytes = TMAX(TMAX(commonType->bytes, newType->bytes), QUERY_NUMBER_MAX_DISPLAY_LEN * TSDB_NCHAR_SIZE);
|
||||||
} else {
|
} else {
|
||||||
commonType->bytes = TMAX(TMAX(commonType->bytes, newType->bytes), TYPE_BYTES[resultType]);
|
commonType->bytes = TMAX(TMAX(commonType->bytes, newType->bytes), TYPE_BYTES[resultType]);
|
||||||
|
@ -5480,7 +5482,7 @@ static EDealRes translateGroupPartitionByImpl(SNode** pNode, void* pContext) {
|
||||||
int32_t code = TSDB_CODE_SUCCESS;
|
int32_t code = TSDB_CODE_SUCCESS;
|
||||||
STranslateContext* pTransCxt = pCxt->pTranslateCxt;
|
STranslateContext* pTransCxt = pCxt->pTranslateCxt;
|
||||||
if (QUERY_NODE_VALUE == nodeType(*pNode)) {
|
if (QUERY_NODE_VALUE == nodeType(*pNode)) {
|
||||||
SValueNode* pVal = (SValueNode*) *pNode;
|
SValueNode* pVal = (SValueNode*)*pNode;
|
||||||
if (DEAL_RES_ERROR == translateValue(pTransCxt, pVal)) {
|
if (DEAL_RES_ERROR == translateValue(pTransCxt, pVal)) {
|
||||||
return DEAL_RES_CONTINUE;
|
return DEAL_RES_CONTINUE;
|
||||||
}
|
}
|
||||||
|
@ -5528,8 +5530,7 @@ static int32_t translateGroupByList(STranslateContext* pCxt, SSelectStmt* pSelec
|
||||||
if (NULL == pSelect->pGroupByList) {
|
if (NULL == pSelect->pGroupByList) {
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
SReplaceGroupByAliasCxt cxt = {
|
SReplaceGroupByAliasCxt cxt = {.pTranslateCxt = pCxt, .pProjectionList = pSelect->pProjectionList};
|
||||||
.pTranslateCxt = pCxt, .pProjectionList = pSelect->pProjectionList};
|
|
||||||
nodesRewriteExprsPostOrder(pSelect->pGroupByList, translateGroupPartitionByImpl, &cxt);
|
nodesRewriteExprsPostOrder(pSelect->pGroupByList, translateGroupPartitionByImpl, &cxt);
|
||||||
|
|
||||||
return pCxt->errCode;
|
return pCxt->errCode;
|
||||||
|
@ -5540,8 +5541,7 @@ static int32_t translatePartitionByList(STranslateContext* pCxt, SSelectStmt* pS
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
SReplaceGroupByAliasCxt cxt = {
|
SReplaceGroupByAliasCxt cxt = {.pTranslateCxt = pCxt, .pProjectionList = pSelect->pProjectionList};
|
||||||
.pTranslateCxt = pCxt, .pProjectionList = pSelect->pProjectionList};
|
|
||||||
nodesRewriteExprsPostOrder(pSelect->pPartitionByList, translateGroupPartitionByImpl, &cxt);
|
nodesRewriteExprsPostOrder(pSelect->pPartitionByList, translateGroupPartitionByImpl, &cxt);
|
||||||
|
|
||||||
return pCxt->errCode;
|
return pCxt->errCode;
|
||||||
|
@ -9495,7 +9495,8 @@ static int32_t checkAlterSuperTableBySchema(STranslateContext* pCxt, SAlterTable
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t checkAlterSuperTable(STranslateContext* pCxt, SAlterTableStmt* pStmt) {
|
static int32_t checkAlterSuperTable(STranslateContext* pCxt, SAlterTableStmt* pStmt) {
|
||||||
if (TSDB_ALTER_TABLE_UPDATE_TAG_VAL == pStmt->alterType) {
|
if (TSDB_ALTER_TABLE_UPDATE_TAG_VAL == pStmt->alterType ||
|
||||||
|
TSDB_ALTER_TABLE_UPDATE_MULTI_TAG_VAL == pStmt->alterType) {
|
||||||
return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_ALTER_TABLE,
|
return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_ALTER_TABLE,
|
||||||
"Set tag value only available for child table");
|
"Set tag value only available for child table");
|
||||||
}
|
}
|
||||||
|
@ -10521,7 +10522,8 @@ static void getSourceDatabase(SNode* pStmt, int32_t acctId, char* pDbFName) {
|
||||||
(void)tNameGetFullDbName(&name, pDbFName);
|
(void)tNameGetFullDbName(&name, pDbFName);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void getStreamQueryFirstProjectAliasName(SHashObj* pUserAliasSet, char* aliasName, int32_t len, char* defaultName[]) {
|
static void getStreamQueryFirstProjectAliasName(SHashObj* pUserAliasSet, char* aliasName, int32_t len,
|
||||||
|
char* defaultName[]) {
|
||||||
for (int32_t i = 0; defaultName[i] != NULL; i++) {
|
for (int32_t i = 0; defaultName[i] != NULL; i++) {
|
||||||
if (NULL == taosHashGet(pUserAliasSet, defaultName[i], strlen(defaultName[i]))) {
|
if (NULL == taosHashGet(pUserAliasSet, defaultName[i], strlen(defaultName[i]))) {
|
||||||
snprintf(aliasName, len, "%s", defaultName[i]);
|
snprintf(aliasName, len, "%s", defaultName[i]);
|
||||||
|
@ -10547,8 +10549,8 @@ static int32_t setColumnDefNodePrimaryKey(SColumnDefNode* pNode, bool isPk) {
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t addIrowTsToCreateStreamQueryImpl(STranslateContext* pCxt, SSelectStmt* pSelect,
|
static int32_t addIrowTsToCreateStreamQueryImpl(STranslateContext* pCxt, SSelectStmt* pSelect, SHashObj* pUserAliasSet,
|
||||||
SHashObj* pUserAliasSet, SNodeList* pCols, SCMCreateStreamReq* pReq) {
|
SNodeList* pCols, SCMCreateStreamReq* pReq) {
|
||||||
SNode* pProj = nodesListGetNode(pSelect->pProjectionList, 0);
|
SNode* pProj = nodesListGetNode(pSelect->pProjectionList, 0);
|
||||||
if (!pSelect->hasInterpFunc ||
|
if (!pSelect->hasInterpFunc ||
|
||||||
(QUERY_NODE_FUNCTION == nodeType(pProj) && 0 == strcmp("_irowts", ((SFunctionNode*)pProj)->functionName))) {
|
(QUERY_NODE_FUNCTION == nodeType(pProj) && 0 == strcmp("_irowts", ((SFunctionNode*)pProj)->functionName))) {
|
||||||
|
@ -10595,7 +10597,7 @@ static int32_t addWstartTsToCreateStreamQueryImpl(STranslateContext* pCxt, SSele
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
SFunctionNode* pFunc = NULL;
|
SFunctionNode* pFunc = NULL;
|
||||||
int32_t code = nodesMakeNode(QUERY_NODE_FUNCTION, (SNode**)&pFunc);
|
int32_t code = nodesMakeNode(QUERY_NODE_FUNCTION, (SNode**)&pFunc);
|
||||||
if (NULL == pFunc) {
|
if (NULL == pFunc) {
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
@ -10627,7 +10629,7 @@ static int32_t addWstartTsToCreateStreamQueryImpl(STranslateContext* pCxt, SSele
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t addTsKeyToCreateStreamQuery(STranslateContext* pCxt, SNode* pStmt, SNodeList* pCols,
|
static int32_t addTsKeyToCreateStreamQuery(STranslateContext* pCxt, SNode* pStmt, SNodeList* pCols,
|
||||||
SCMCreateStreamReq* pReq) {
|
SCMCreateStreamReq* pReq) {
|
||||||
SSelectStmt* pSelect = (SSelectStmt*)pStmt;
|
SSelectStmt* pSelect = (SSelectStmt*)pStmt;
|
||||||
SHashObj* pUserAliasSet = NULL;
|
SHashObj* pUserAliasSet = NULL;
|
||||||
int32_t code = checkProjectAlias(pCxt, pSelect->pProjectionList, &pUserAliasSet);
|
int32_t code = checkProjectAlias(pCxt, pSelect->pProjectionList, &pUserAliasSet);
|
||||||
|
@ -10990,21 +10992,18 @@ static int32_t checkStreamQuery(STranslateContext* pCxt, SCreateStreamStmt* pStm
|
||||||
|
|
||||||
if (pStmt->pOptions->triggerType == STREAM_TRIGGER_FORCE_WINDOW_CLOSE) {
|
if (pStmt->pOptions->triggerType == STREAM_TRIGGER_FORCE_WINDOW_CLOSE) {
|
||||||
if (pStmt->pOptions->fillHistory) {
|
if (pStmt->pOptions->fillHistory) {
|
||||||
return generateSyntaxErrMsgExt(
|
return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_STREAM_QUERY,
|
||||||
&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_STREAM_QUERY,
|
"When trigger was force window close, Stream unsupported Fill history");
|
||||||
"When trigger was force window close, Stream unsupported Fill history");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pStmt->pOptions->ignoreExpired != 1) {
|
if (pStmt->pOptions->ignoreExpired != 1) {
|
||||||
return generateSyntaxErrMsgExt(
|
return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_STREAM_QUERY,
|
||||||
&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_STREAM_QUERY,
|
"When trigger was force window close, Stream must not set ignore expired 0");
|
||||||
"When trigger was force window close, Stream must not set ignore expired 0");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pStmt->pOptions->ignoreUpdate != 1) {
|
if (pStmt->pOptions->ignoreUpdate != 1) {
|
||||||
return generateSyntaxErrMsgExt(
|
return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_STREAM_QUERY,
|
||||||
&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_STREAM_QUERY,
|
"When trigger was force window close, Stream must not set ignore update 0");
|
||||||
"When trigger was force window close, Stream must not set ignore update 0");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pSelect->pWindow != NULL && QUERY_NODE_INTERVAL_WINDOW == nodeType(pSelect->pWindow)) {
|
if (pSelect->pWindow != NULL && QUERY_NODE_INTERVAL_WINDOW == nodeType(pSelect->pWindow)) {
|
||||||
|
@ -13127,7 +13126,7 @@ static int32_t extractShowCreateViewResultSchema(int32_t* numOfCols, SSchema** p
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t extractShowVariablesResultSchema(int32_t* numOfCols, SSchema** pSchema) {
|
static int32_t extractShowVariablesResultSchema(int32_t* numOfCols, SSchema** pSchema) {
|
||||||
*numOfCols = SHOW_LOCAL_VARIABLES_RESULT_COLS; // SHOW_VARIABLES_RESULT_COLS
|
*numOfCols = SHOW_LOCAL_VARIABLES_RESULT_COLS; // SHOW_VARIABLES_RESULT_COLS
|
||||||
*pSchema = taosMemoryCalloc((*numOfCols), sizeof(SSchema));
|
*pSchema = taosMemoryCalloc((*numOfCols), sizeof(SSchema));
|
||||||
if (NULL == (*pSchema)) {
|
if (NULL == (*pSchema)) {
|
||||||
return terrno;
|
return terrno;
|
||||||
|
@ -15183,24 +15182,90 @@ static int32_t rewriteDropSuperTable(STranslateContext* pCxt, SQuery* pQuery) {
|
||||||
TAOS_RETURN(0);
|
TAOS_RETURN(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t buildUpdateTagValReq(STranslateContext* pCxt, SAlterTableStmt* pStmt, STableMeta* pTableMeta,
|
static int32_t buildUpdateTagValReqImpl2(STranslateContext* pCxt, SAlterTableStmt* pStmt, STableMeta* pTableMeta,
|
||||||
SVAlterTbReq* pReq) {
|
char* colName, SMultiTagUpateVal* pReq) {
|
||||||
SName tbName = {0};
|
|
||||||
SArray* pTsmas = NULL;
|
|
||||||
int32_t code = TSDB_CODE_SUCCESS;
|
int32_t code = TSDB_CODE_SUCCESS;
|
||||||
if (pCxt->pMetaCache) {
|
if (NULL == pReq->tagName) {
|
||||||
toName(pCxt->pParseCxt->acctId, pStmt->dbName, pStmt->tableName, &tbName);
|
return terrno;
|
||||||
code = getTableTsmasFromCache(pCxt->pMetaCache, &tbName, &pTsmas);
|
|
||||||
if (code != TSDB_CODE_SUCCESS) return code;
|
|
||||||
if (pTsmas && pTsmas->size > 0) return TSDB_CODE_TSMA_MUST_BE_DROPPED;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SSchema* pSchema = getTagSchema(pTableMeta, pStmt->colName);
|
SSchema* pSchema = getTagSchema(pTableMeta, colName);
|
||||||
if (NULL == pSchema) {
|
if (NULL == pSchema) {
|
||||||
return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_ALTER_TABLE, "Invalid tag name: %s",
|
return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_ALTER_TABLE, "Invalid tag name: %s", colName);
|
||||||
pStmt->colName);
|
|
||||||
}
|
}
|
||||||
pReq->tagName = taosStrdup(pStmt->colName);
|
|
||||||
|
pReq->tagName = taosStrdup(colName);
|
||||||
|
if (NULL == pReq->tagName) {
|
||||||
|
return terrno;
|
||||||
|
}
|
||||||
|
pReq->pTagArray = taosArrayInit(1, sizeof(STagVal));
|
||||||
|
if (NULL == pReq->pTagArray) {
|
||||||
|
return terrno;
|
||||||
|
}
|
||||||
|
pReq->colId = pSchema->colId;
|
||||||
|
pReq->tagType = pSchema->type;
|
||||||
|
|
||||||
|
STag* pTag = NULL;
|
||||||
|
SToken token;
|
||||||
|
char tokenBuf[TSDB_MAX_TAGS_LEN];
|
||||||
|
const char* tagStr = pStmt->pVal->literal;
|
||||||
|
NEXT_TOKEN_WITH_PREV(tagStr, token);
|
||||||
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
|
code = checkAndTrimValue(&token, tokenBuf, &pCxt->msgBuf, pSchema->type);
|
||||||
|
if (TSDB_CODE_SUCCESS == code && TK_NK_VARIABLE == token.type) {
|
||||||
|
code = buildSyntaxErrMsg(&pCxt->msgBuf, "not expected tags values", token.z);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
|
code = parseTagValue(&pCxt->msgBuf, &tagStr, pTableMeta->tableInfo.precision, pSchema, &token, NULL,
|
||||||
|
pReq->pTagArray, &pTag);
|
||||||
|
if (pSchema->type == TSDB_DATA_TYPE_JSON && token.type == TK_NULL && code == TSDB_CODE_SUCCESS) {
|
||||||
|
pReq->tagFree = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (TSDB_CODE_SUCCESS == code && tagStr) {
|
||||||
|
NEXT_VALID_TOKEN(tagStr, token);
|
||||||
|
if (token.n != 0) {
|
||||||
|
code = buildSyntaxErrMsg(&pCxt->msgBuf, "not expected tags values", token.z);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
|
if (pSchema->type == TSDB_DATA_TYPE_JSON) {
|
||||||
|
code = buildSyntaxErrMsg(&pCxt->msgBuf, "not expected tags values ", token.z);
|
||||||
|
} else {
|
||||||
|
STagVal* pTagVal = taosArrayGet(pReq->pTagArray, 0);
|
||||||
|
if (pTagVal) {
|
||||||
|
pReq->isNull = false;
|
||||||
|
if (IS_VAR_DATA_TYPE(pSchema->type)) {
|
||||||
|
pReq->nTagVal = pTagVal->nData;
|
||||||
|
pReq->pTagVal = pTagVal->pData;
|
||||||
|
} else {
|
||||||
|
pReq->nTagVal = pSchema->bytes;
|
||||||
|
pReq->pTagVal = (uint8_t*)&pTagVal->i64;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
pReq->isNull = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
static int32_t buildUpdateTagValReqImpl(STranslateContext* pCxt, SAlterTableStmt* pStmt, STableMeta* pTableMeta,
|
||||||
|
char* colName, SVAlterTbReq* pReq) {
|
||||||
|
int32_t code = TSDB_CODE_SUCCESS;
|
||||||
|
// if (NULL == pReq->tagName) {
|
||||||
|
// return terrno;
|
||||||
|
// }
|
||||||
|
|
||||||
|
SSchema* pSchema = getTagSchema(pTableMeta, colName);
|
||||||
|
if (NULL == pSchema) {
|
||||||
|
return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_ALTER_TABLE, "Invalid tag name: %s", colName);
|
||||||
|
}
|
||||||
|
|
||||||
|
pReq->tagName = taosStrdup(colName);
|
||||||
if (NULL == pReq->tagName) {
|
if (NULL == pReq->tagName) {
|
||||||
return terrno;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
@ -15261,6 +15326,62 @@ static int32_t buildUpdateTagValReq(STranslateContext* pCxt, SAlterTableStmt* pS
|
||||||
|
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
static int32_t buildUpdateTagValReq(STranslateContext* pCxt, SAlterTableStmt* pStmt, STableMeta* pTableMeta,
|
||||||
|
SVAlterTbReq* pReq) {
|
||||||
|
SName tbName = {0};
|
||||||
|
SArray* pTsmas = NULL;
|
||||||
|
int32_t code = TSDB_CODE_SUCCESS;
|
||||||
|
if (pCxt->pMetaCache) {
|
||||||
|
toName(pCxt->pParseCxt->acctId, pStmt->dbName, pStmt->tableName, &tbName);
|
||||||
|
code = getTableTsmasFromCache(pCxt->pMetaCache, &tbName, &pTsmas);
|
||||||
|
if (code != TSDB_CODE_SUCCESS) return code;
|
||||||
|
if (pTsmas && pTsmas->size > 0) return TSDB_CODE_TSMA_MUST_BE_DROPPED;
|
||||||
|
}
|
||||||
|
return buildUpdateTagValReqImpl(pCxt, pStmt, pTableMeta, pStmt->colName, pReq);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int32_t buildUpdateMultiTagValReq(STranslateContext* pCxt, SAlterTableStmt* pStmt, STableMeta* pTableMeta,
|
||||||
|
SVAlterTbReq* pReq) {
|
||||||
|
SName tbName = {0};
|
||||||
|
SArray* pTsmas = NULL;
|
||||||
|
int32_t code = TSDB_CODE_SUCCESS;
|
||||||
|
if (pCxt->pMetaCache) {
|
||||||
|
toName(pCxt->pParseCxt->acctId, pStmt->dbName, pStmt->tableName, &tbName);
|
||||||
|
code = getTableTsmasFromCache(pCxt->pMetaCache, &tbName, &pTsmas);
|
||||||
|
if (code != TSDB_CODE_SUCCESS) return code;
|
||||||
|
if (pTsmas && pTsmas->size > 0) return TSDB_CODE_TSMA_MUST_BE_DROPPED;
|
||||||
|
}
|
||||||
|
SNodeList* pNodeList = pStmt->pNodeListTagValue;
|
||||||
|
if (pNodeList == NULL) {
|
||||||
|
return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_ALTER_TABLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t nTagValues = pNodeList->length;
|
||||||
|
if (nTagValues == 1) {
|
||||||
|
SAlterTableStmt* head = (SAlterTableStmt*)pNodeList->pHead->pNode;
|
||||||
|
pReq->action = TSDB_ALTER_TABLE_UPDATE_TAG_VAL;
|
||||||
|
return buildUpdateTagValReqImpl(pCxt, head, pTableMeta, head->colName, pReq);
|
||||||
|
} else {
|
||||||
|
pReq->pMultiTag = taosArrayInit(nTagValues, sizeof(SMultiTagUpateVal));
|
||||||
|
if (NULL == pReq->pTagArray) {
|
||||||
|
return terrno;
|
||||||
|
}
|
||||||
|
|
||||||
|
SAlterTableStmt* pTagStmt = NULL;
|
||||||
|
SNode* pNode = NULL;
|
||||||
|
FOREACH(pNode, pNodeList) {
|
||||||
|
SMultiTagUpateVal val;
|
||||||
|
pTagStmt = (SAlterTableStmt*)pNode;
|
||||||
|
code = buildUpdateTagValReqImpl2(pCxt, pTagStmt, pTableMeta, pTagStmt->colName, &val);
|
||||||
|
if (TSDB_CODE_SUCCESS != code) {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
TAOS_UNUSED(taosArrayPush(pReq->pMultiTag, &val));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
static int32_t buildAddColReq(STranslateContext* pCxt, SAlterTableStmt* pStmt, STableMeta* pTableMeta,
|
static int32_t buildAddColReq(STranslateContext* pCxt, SAlterTableStmt* pStmt, STableMeta* pTableMeta,
|
||||||
SVAlterTbReq* pReq) {
|
SVAlterTbReq* pReq) {
|
||||||
|
@ -15449,6 +15570,8 @@ static int32_t buildAlterTbReq(STranslateContext* pCxt, SAlterTableStmt* pStmt,
|
||||||
case TSDB_ALTER_TABLE_UPDATE_TAG_NAME:
|
case TSDB_ALTER_TABLE_UPDATE_TAG_NAME:
|
||||||
case TSDB_ALTER_TABLE_UPDATE_TAG_BYTES:
|
case TSDB_ALTER_TABLE_UPDATE_TAG_BYTES:
|
||||||
return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_ALTER_TABLE);
|
return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_ALTER_TABLE);
|
||||||
|
case TSDB_ALTER_TABLE_UPDATE_MULTI_TAG_VAL:
|
||||||
|
return buildUpdateMultiTagValReq(pCxt, pStmt, pTableMeta, pReq);
|
||||||
case TSDB_ALTER_TABLE_UPDATE_TAG_VAL:
|
case TSDB_ALTER_TABLE_UPDATE_TAG_VAL:
|
||||||
return buildUpdateTagValReq(pCxt, pStmt, pTableMeta, pReq);
|
return buildUpdateTagValReq(pCxt, pStmt, pTableMeta, pReq);
|
||||||
case TSDB_ALTER_TABLE_ADD_COLUMN:
|
case TSDB_ALTER_TABLE_ADD_COLUMN:
|
||||||
|
@ -16254,6 +16377,7 @@ static int32_t rewriteQuery(STranslateContext* pCxt, SQuery* pQuery) {
|
||||||
case QUERY_NODE_DROP_SUPER_TABLE_STMT:
|
case QUERY_NODE_DROP_SUPER_TABLE_STMT:
|
||||||
code = rewriteDropSuperTable(pCxt, pQuery);
|
code = rewriteDropSuperTable(pCxt, pQuery);
|
||||||
break;
|
break;
|
||||||
|
case QUERY_NODE_ALTER_TABLE_MULTI_STMT:
|
||||||
case QUERY_NODE_ALTER_TABLE_STMT:
|
case QUERY_NODE_ALTER_TABLE_STMT:
|
||||||
code = rewriteAlterTable(pCxt, pQuery);
|
code = rewriteAlterTable(pCxt, pQuery);
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue