Merge pull request #25996 from taosdata/feat/TD-30006-3
Feat/TD-30006-3
This commit is contained in:
commit
6f72fd4170
|
@ -158,19 +158,20 @@ typedef enum _mgmt_table {
|
||||||
TSDB_MGMT_TABLE_MAX,
|
TSDB_MGMT_TABLE_MAX,
|
||||||
} EShowType;
|
} EShowType;
|
||||||
|
|
||||||
#define TSDB_ALTER_TABLE_ADD_TAG 1
|
#define TSDB_ALTER_TABLE_ADD_TAG 1
|
||||||
#define TSDB_ALTER_TABLE_DROP_TAG 2
|
#define TSDB_ALTER_TABLE_DROP_TAG 2
|
||||||
#define TSDB_ALTER_TABLE_UPDATE_TAG_NAME 3
|
#define TSDB_ALTER_TABLE_UPDATE_TAG_NAME 3
|
||||||
#define TSDB_ALTER_TABLE_UPDATE_TAG_VAL 4
|
#define TSDB_ALTER_TABLE_UPDATE_TAG_VAL 4
|
||||||
#define TSDB_ALTER_TABLE_ADD_COLUMN 5
|
#define TSDB_ALTER_TABLE_ADD_COLUMN 5
|
||||||
#define TSDB_ALTER_TABLE_DROP_COLUMN 6
|
#define TSDB_ALTER_TABLE_DROP_COLUMN 6
|
||||||
#define TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES 7
|
#define TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES 7
|
||||||
#define TSDB_ALTER_TABLE_UPDATE_TAG_BYTES 8
|
#define TSDB_ALTER_TABLE_UPDATE_TAG_BYTES 8
|
||||||
#define TSDB_ALTER_TABLE_UPDATE_OPTIONS 9
|
#define TSDB_ALTER_TABLE_UPDATE_OPTIONS 9
|
||||||
#define TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME 10
|
#define TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME 10
|
||||||
#define TSDB_ALTER_TABLE_ADD_TAG_INDEX 11
|
#define TSDB_ALTER_TABLE_ADD_TAG_INDEX 11
|
||||||
#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_FILL_NONE 0
|
#define TSDB_FILL_NONE 0
|
||||||
#define TSDB_FILL_NULL 1
|
#define TSDB_FILL_NULL 1
|
||||||
|
@ -2313,10 +2314,10 @@ int32_t tDeserializeSVArbHeartBeatRsp(void* buf, int32_t bufLen, SVArbHeartBeatR
|
||||||
void tFreeSVArbHeartBeatRsp(SVArbHeartBeatRsp* pRsp);
|
void tFreeSVArbHeartBeatRsp(SVArbHeartBeatRsp* pRsp);
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char* arbToken;
|
char* arbToken;
|
||||||
int64_t arbTerm;
|
int64_t arbTerm;
|
||||||
char* member0Token;
|
char* member0Token;
|
||||||
char* member1Token;
|
char* member1Token;
|
||||||
} SVArbCheckSyncReq;
|
} SVArbCheckSyncReq;
|
||||||
|
|
||||||
int32_t tSerializeSVArbCheckSyncReq(void* buf, int32_t bufLen, SVArbCheckSyncReq* pReq);
|
int32_t tSerializeSVArbCheckSyncReq(void* buf, int32_t bufLen, SVArbCheckSyncReq* pReq);
|
||||||
|
@ -2336,9 +2337,9 @@ int32_t tDeserializeSVArbCheckSyncRsp(void* buf, int32_t bufLen, SVArbCheckSyncR
|
||||||
void tFreeSVArbCheckSyncRsp(SVArbCheckSyncRsp* pRsp);
|
void tFreeSVArbCheckSyncRsp(SVArbCheckSyncRsp* pRsp);
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char* arbToken;
|
char* arbToken;
|
||||||
int64_t arbTerm;
|
int64_t arbTerm;
|
||||||
char* memberToken;
|
char* memberToken;
|
||||||
} SVArbSetAssignedLeaderReq;
|
} SVArbSetAssignedLeaderReq;
|
||||||
|
|
||||||
int32_t tSerializeSVArbSetAssignedLeaderReq(void* buf, int32_t bufLen, SVArbSetAssignedLeaderReq* pReq);
|
int32_t tSerializeSVArbSetAssignedLeaderReq(void* buf, int32_t bufLen, SVArbSetAssignedLeaderReq* pReq);
|
||||||
|
@ -2707,8 +2708,8 @@ typedef struct {
|
||||||
int64_t lastTs;
|
int64_t lastTs;
|
||||||
SArray* pVgroupVerList;
|
SArray* pVgroupVerList;
|
||||||
// 3.3.0.0
|
// 3.3.0.0
|
||||||
SArray* pCols; // array of SField
|
SArray* pCols; // array of SField
|
||||||
int64_t smaId;
|
int64_t smaId;
|
||||||
} SCMCreateStreamReq;
|
} SCMCreateStreamReq;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -3580,7 +3581,7 @@ static FORCE_INLINE void tqOffsetResetToData(STqOffsetVal* pOffsetVal, int64_t u
|
||||||
pOffsetVal->type = TMQ_OFFSET__SNAPSHOT_DATA;
|
pOffsetVal->type = TMQ_OFFSET__SNAPSHOT_DATA;
|
||||||
pOffsetVal->uid = uid;
|
pOffsetVal->uid = uid;
|
||||||
pOffsetVal->ts = ts;
|
pOffsetVal->ts = ts;
|
||||||
if(IS_VAR_DATA_TYPE(pOffsetVal->primaryKey.type)){
|
if (IS_VAR_DATA_TYPE(pOffsetVal->primaryKey.type)) {
|
||||||
taosMemoryFree(pOffsetVal->primaryKey.pData);
|
taosMemoryFree(pOffsetVal->primaryKey.pData);
|
||||||
}
|
}
|
||||||
pOffsetVal->primaryKey = primaryKey;
|
pOffsetVal->primaryKey = primaryKey;
|
||||||
|
@ -3680,10 +3681,10 @@ typedef struct {
|
||||||
char* ast;
|
char* ast;
|
||||||
int64_t deleteMark;
|
int64_t deleteMark;
|
||||||
int64_t lastTs;
|
int64_t lastTs;
|
||||||
int64_t normSourceTbUid; // the Uid of source tb if its a normal table, otherwise 0
|
int64_t normSourceTbUid; // the Uid of source tb if its a normal table, otherwise 0
|
||||||
SArray* pVgroupVerList;
|
SArray* pVgroupVerList;
|
||||||
int8_t recursiveTsma;
|
int8_t recursiveTsma;
|
||||||
char baseTsmaName[TSDB_TABLE_FNAME_LEN]; // base tsma name for recursively created tsma
|
char baseTsmaName[TSDB_TABLE_FNAME_LEN]; // base tsma name for recursively created tsma
|
||||||
} SMCreateSmaReq;
|
} SMCreateSmaReq;
|
||||||
|
|
||||||
int32_t tSerializeSMCreateSmaReq(void* buf, int32_t bufLen, SMCreateSmaReq* pReq);
|
int32_t tSerializeSMCreateSmaReq(void* buf, int32_t bufLen, SMCreateSmaReq* pReq);
|
||||||
|
@ -3913,7 +3914,7 @@ typedef struct {
|
||||||
|
|
||||||
int32_t tSerializeSMqPollReq(void* buf, int32_t bufLen, SMqPollReq* pReq);
|
int32_t tSerializeSMqPollReq(void* buf, int32_t bufLen, SMqPollReq* pReq);
|
||||||
int32_t tDeserializeSMqPollReq(void* buf, int32_t bufLen, SMqPollReq* pReq);
|
int32_t tDeserializeSMqPollReq(void* buf, int32_t bufLen, SMqPollReq* pReq);
|
||||||
void tDestroySMqPollReq(SMqPollReq *pReq);
|
void tDestroySMqPollReq(SMqPollReq* pReq);
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int32_t vgId;
|
int32_t vgId;
|
||||||
|
@ -3957,7 +3958,7 @@ typedef struct {
|
||||||
|
|
||||||
int32_t tEncodeMqMetaRsp(SEncoder* pEncoder, const SMqMetaRsp* pRsp);
|
int32_t tEncodeMqMetaRsp(SEncoder* pEncoder, const SMqMetaRsp* pRsp);
|
||||||
int32_t tDecodeMqMetaRsp(SDecoder* pDecoder, SMqMetaRsp* pRsp);
|
int32_t tDecodeMqMetaRsp(SDecoder* pDecoder, SMqMetaRsp* pRsp);
|
||||||
void tDeleteMqMetaRsp(SMqMetaRsp *pRsp);
|
void tDeleteMqMetaRsp(SMqMetaRsp* pRsp);
|
||||||
|
|
||||||
#define MQ_DATA_RSP_VERSION 100
|
#define MQ_DATA_RSP_VERSION 100
|
||||||
|
|
||||||
|
@ -4318,9 +4319,9 @@ int32_t tSerializeSViewMetaRsp(void* buf, int32_t bufLen, const SViewMetaRsp* pR
|
||||||
int32_t tDeserializeSViewMetaRsp(void* buf, int32_t bufLen, SViewMetaRsp* pRsp);
|
int32_t tDeserializeSViewMetaRsp(void* buf, int32_t bufLen, SViewMetaRsp* pRsp);
|
||||||
void tFreeSViewMetaRsp(SViewMetaRsp* pRsp);
|
void tFreeSViewMetaRsp(SViewMetaRsp* pRsp);
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char name[TSDB_TABLE_FNAME_LEN]; // table name or tsma name
|
char name[TSDB_TABLE_FNAME_LEN]; // table name or tsma name
|
||||||
bool fetchingWithTsmaName; // if we are fetching with tsma name
|
bool fetchingWithTsmaName; // if we are fetching with tsma name
|
||||||
}STableTSMAInfoReq;
|
} STableTSMAInfoReq;
|
||||||
|
|
||||||
int32_t tSerializeTableTSMAInfoReq(void* buf, int32_t bufLen, const STableTSMAInfoReq* pReq);
|
int32_t tSerializeTableTSMAInfoReq(void* buf, int32_t bufLen, const STableTSMAInfoReq* pReq);
|
||||||
int32_t tDeserializeTableTSMAInfoReq(void* buf, int32_t bufLen, STableTSMAInfoReq* pReq);
|
int32_t tDeserializeTableTSMAInfoReq(void* buf, int32_t bufLen, STableTSMAInfoReq* pReq);
|
||||||
|
@ -4343,15 +4344,15 @@ typedef struct {
|
||||||
int32_t version;
|
int32_t version;
|
||||||
int64_t interval;
|
int64_t interval;
|
||||||
int8_t unit;
|
int8_t unit;
|
||||||
SArray* pFuncs; // SArray<STableTSMAFuncInfo>
|
SArray* pFuncs; // SArray<STableTSMAFuncInfo>
|
||||||
SArray* pTags; // SArray<SSchema>
|
SArray* pTags; // SArray<SSchema>
|
||||||
SArray* pUsedCols; // SArray<SSchema>
|
SArray* pUsedCols; // SArray<SSchema>
|
||||||
char* ast;
|
char* ast;
|
||||||
|
|
||||||
int64_t streamUid;
|
int64_t streamUid;
|
||||||
int64_t reqTs;
|
int64_t reqTs;
|
||||||
int64_t rspTs;
|
int64_t rspTs;
|
||||||
int64_t delayDuration; // ms
|
int64_t delayDuration; // ms
|
||||||
bool fillHistoryFinished;
|
bool fillHistoryFinished;
|
||||||
} STableTSMAInfo;
|
} STableTSMAInfo;
|
||||||
|
|
||||||
|
@ -4362,10 +4363,10 @@ void tFreeTableTSMAInfo(void* p);
|
||||||
void tFreeAndClearTableTSMAInfo(void* p);
|
void tFreeAndClearTableTSMAInfo(void* p);
|
||||||
void tFreeTableTSMAInfoRsp(STableTSMAInfoRsp* pRsp);
|
void tFreeTableTSMAInfoRsp(STableTSMAInfoRsp* pRsp);
|
||||||
|
|
||||||
#define STSMAHbRsp STableTSMAInfoRsp
|
#define STSMAHbRsp STableTSMAInfoRsp
|
||||||
#define tSerializeTSMAHbRsp tSerializeTableTSMAInfoRsp
|
#define tSerializeTSMAHbRsp tSerializeTableTSMAInfoRsp
|
||||||
#define tDeserializeTSMAHbRsp tDeserializeTableTSMAInfoRsp
|
#define tDeserializeTSMAHbRsp tDeserializeTableTSMAInfoRsp
|
||||||
#define tFreeTSMAHbRsp tFreeTableTSMAInfoRsp
|
#define tFreeTSMAHbRsp tFreeTableTSMAInfoRsp
|
||||||
|
|
||||||
typedef struct SStreamProgressReq {
|
typedef struct SStreamProgressReq {
|
||||||
int64_t streamId;
|
int64_t streamId;
|
||||||
|
@ -4391,7 +4392,7 @@ int32_t tDeserializeSStreamProgressRsp(void* buf, int32_t bufLen, SStreamProgres
|
||||||
|
|
||||||
typedef struct SDropCtbWithTsmaSingleVgReq {
|
typedef struct SDropCtbWithTsmaSingleVgReq {
|
||||||
SVgroupInfo vgInfo;
|
SVgroupInfo vgInfo;
|
||||||
SArray* pTbs; // SVDropTbReq
|
SArray* pTbs; // SVDropTbReq
|
||||||
} SMDropTbReqsOnSingleVg;
|
} SMDropTbReqsOnSingleVg;
|
||||||
|
|
||||||
int32_t tEncodeSMDropTbReqOnSingleVg(SEncoder* pEncoder, const SMDropTbReqsOnSingleVg* pReq);
|
int32_t tEncodeSMDropTbReqOnSingleVg(SEncoder* pEncoder, const SMDropTbReqsOnSingleVg* pReq);
|
||||||
|
@ -4399,7 +4400,7 @@ int32_t tDecodeSMDropTbReqOnSingleVg(SDecoder* pDecoder, SMDropTbReqsOnSingleVg*
|
||||||
void tFreeSMDropTbReqOnSingleVg(void* p);
|
void tFreeSMDropTbReqOnSingleVg(void* p);
|
||||||
|
|
||||||
typedef struct SDropTbsReq {
|
typedef struct SDropTbsReq {
|
||||||
SArray* pVgReqs; // SMDropTbReqsOnSingleVg
|
SArray* pVgReqs; // SMDropTbReqsOnSingleVg
|
||||||
} SMDropTbsReq;
|
} SMDropTbsReq;
|
||||||
|
|
||||||
int32_t tSerializeSMDropTbsReq(void* buf, int32_t bufLen, const SMDropTbsReq* pReq);
|
int32_t tSerializeSMDropTbsReq(void* buf, int32_t bufLen, const SMDropTbsReq* pReq);
|
||||||
|
|
|
@ -16,381 +16,381 @@
|
||||||
#ifndef _TD_COMMON_TOKEN_H_
|
#ifndef _TD_COMMON_TOKEN_H_
|
||||||
#define _TD_COMMON_TOKEN_H_
|
#define _TD_COMMON_TOKEN_H_
|
||||||
|
|
||||||
#define TK_OR 1
|
#define TK_OR 1
|
||||||
#define TK_AND 2
|
#define TK_AND 2
|
||||||
#define TK_UNION 3
|
#define TK_UNION 3
|
||||||
#define TK_ALL 4
|
#define TK_ALL 4
|
||||||
#define TK_MINUS 5
|
#define TK_MINUS 5
|
||||||
#define TK_EXCEPT 6
|
#define TK_EXCEPT 6
|
||||||
#define TK_INTERSECT 7
|
#define TK_INTERSECT 7
|
||||||
#define TK_NK_BITAND 8
|
#define TK_NK_BITAND 8
|
||||||
#define TK_NK_BITOR 9
|
#define TK_NK_BITOR 9
|
||||||
#define TK_NK_LSHIFT 10
|
#define TK_NK_LSHIFT 10
|
||||||
#define TK_NK_RSHIFT 11
|
#define TK_NK_RSHIFT 11
|
||||||
#define TK_NK_PLUS 12
|
#define TK_NK_PLUS 12
|
||||||
#define TK_NK_MINUS 13
|
#define TK_NK_MINUS 13
|
||||||
#define TK_NK_STAR 14
|
#define TK_NK_STAR 14
|
||||||
#define TK_NK_SLASH 15
|
#define TK_NK_SLASH 15
|
||||||
#define TK_NK_REM 16
|
#define TK_NK_REM 16
|
||||||
#define TK_NK_CONCAT 17
|
#define TK_NK_CONCAT 17
|
||||||
#define TK_CREATE 18
|
#define TK_CREATE 18
|
||||||
#define TK_ACCOUNT 19
|
#define TK_ACCOUNT 19
|
||||||
#define TK_NK_ID 20
|
#define TK_NK_ID 20
|
||||||
#define TK_PASS 21
|
#define TK_PASS 21
|
||||||
#define TK_NK_STRING 22
|
#define TK_NK_STRING 22
|
||||||
#define TK_ALTER 23
|
#define TK_ALTER 23
|
||||||
#define TK_PPS 24
|
#define TK_PPS 24
|
||||||
#define TK_TSERIES 25
|
#define TK_TSERIES 25
|
||||||
#define TK_STORAGE 26
|
#define TK_STORAGE 26
|
||||||
#define TK_STREAMS 27
|
#define TK_STREAMS 27
|
||||||
#define TK_QTIME 28
|
#define TK_QTIME 28
|
||||||
#define TK_DBS 29
|
#define TK_DBS 29
|
||||||
#define TK_USERS 30
|
#define TK_USERS 30
|
||||||
#define TK_CONNS 31
|
#define TK_CONNS 31
|
||||||
#define TK_STATE 32
|
#define TK_STATE 32
|
||||||
#define TK_NK_COMMA 33
|
#define TK_NK_COMMA 33
|
||||||
#define TK_HOST 34
|
#define TK_HOST 34
|
||||||
#define TK_USER 35
|
#define TK_USER 35
|
||||||
#define TK_ENABLE 36
|
#define TK_ENABLE 36
|
||||||
#define TK_NK_INTEGER 37
|
#define TK_NK_INTEGER 37
|
||||||
#define TK_SYSINFO 38
|
#define TK_SYSINFO 38
|
||||||
#define TK_ADD 39
|
#define TK_ADD 39
|
||||||
#define TK_DROP 40
|
#define TK_DROP 40
|
||||||
#define TK_GRANT 41
|
#define TK_GRANT 41
|
||||||
#define TK_ON 42
|
#define TK_ON 42
|
||||||
#define TK_TO 43
|
#define TK_TO 43
|
||||||
#define TK_REVOKE 44
|
#define TK_REVOKE 44
|
||||||
#define TK_FROM 45
|
#define TK_FROM 45
|
||||||
#define TK_SUBSCRIBE 46
|
#define TK_SUBSCRIBE 46
|
||||||
#define TK_READ 47
|
#define TK_READ 47
|
||||||
#define TK_WRITE 48
|
#define TK_WRITE 48
|
||||||
#define TK_NK_DOT 49
|
#define TK_NK_DOT 49
|
||||||
#define TK_WITH 50
|
#define TK_WITH 50
|
||||||
#define TK_ENCRYPT_KEY 51
|
#define TK_ENCRYPT_KEY 51
|
||||||
#define TK_DNODE 52
|
#define TK_DNODE 52
|
||||||
#define TK_PORT 53
|
#define TK_PORT 53
|
||||||
#define TK_DNODES 54
|
#define TK_DNODES 54
|
||||||
#define TK_RESTORE 55
|
#define TK_RESTORE 55
|
||||||
#define TK_NK_IPTOKEN 56
|
#define TK_NK_IPTOKEN 56
|
||||||
#define TK_FORCE 57
|
#define TK_FORCE 57
|
||||||
#define TK_UNSAFE 58
|
#define TK_UNSAFE 58
|
||||||
#define TK_CLUSTER 59
|
#define TK_CLUSTER 59
|
||||||
#define TK_LOCAL 60
|
#define TK_LOCAL 60
|
||||||
#define TK_QNODE 61
|
#define TK_QNODE 61
|
||||||
#define TK_BNODE 62
|
#define TK_BNODE 62
|
||||||
#define TK_SNODE 63
|
#define TK_SNODE 63
|
||||||
#define TK_MNODE 64
|
#define TK_MNODE 64
|
||||||
#define TK_VNODE 65
|
#define TK_VNODE 65
|
||||||
#define TK_DATABASE 66
|
#define TK_DATABASE 66
|
||||||
#define TK_USE 67
|
#define TK_USE 67
|
||||||
#define TK_FLUSH 68
|
#define TK_FLUSH 68
|
||||||
#define TK_TRIM 69
|
#define TK_TRIM 69
|
||||||
#define TK_S3MIGRATE 70
|
#define TK_S3MIGRATE 70
|
||||||
#define TK_COMPACT 71
|
#define TK_COMPACT 71
|
||||||
#define TK_IF 72
|
#define TK_IF 72
|
||||||
#define TK_NOT 73
|
#define TK_NOT 73
|
||||||
#define TK_EXISTS 74
|
#define TK_EXISTS 74
|
||||||
#define TK_BUFFER 75
|
#define TK_BUFFER 75
|
||||||
#define TK_CACHEMODEL 76
|
#define TK_CACHEMODEL 76
|
||||||
#define TK_CACHESIZE 77
|
#define TK_CACHESIZE 77
|
||||||
#define TK_COMP 78
|
#define TK_COMP 78
|
||||||
#define TK_DURATION 79
|
#define TK_DURATION 79
|
||||||
#define TK_NK_VARIABLE 80
|
#define TK_NK_VARIABLE 80
|
||||||
#define TK_MAXROWS 81
|
#define TK_MAXROWS 81
|
||||||
#define TK_MINROWS 82
|
#define TK_MINROWS 82
|
||||||
#define TK_KEEP 83
|
#define TK_KEEP 83
|
||||||
#define TK_PAGES 84
|
#define TK_PAGES 84
|
||||||
#define TK_PAGESIZE 85
|
#define TK_PAGESIZE 85
|
||||||
#define TK_TSDB_PAGESIZE 86
|
#define TK_TSDB_PAGESIZE 86
|
||||||
#define TK_PRECISION 87
|
#define TK_PRECISION 87
|
||||||
#define TK_REPLICA 88
|
#define TK_REPLICA 88
|
||||||
#define TK_VGROUPS 89
|
#define TK_VGROUPS 89
|
||||||
#define TK_SINGLE_STABLE 90
|
#define TK_SINGLE_STABLE 90
|
||||||
#define TK_RETENTIONS 91
|
#define TK_RETENTIONS 91
|
||||||
#define TK_SCHEMALESS 92
|
#define TK_SCHEMALESS 92
|
||||||
#define TK_WAL_LEVEL 93
|
#define TK_WAL_LEVEL 93
|
||||||
#define TK_WAL_FSYNC_PERIOD 94
|
#define TK_WAL_FSYNC_PERIOD 94
|
||||||
#define TK_WAL_RETENTION_PERIOD 95
|
#define TK_WAL_RETENTION_PERIOD 95
|
||||||
#define TK_WAL_RETENTION_SIZE 96
|
#define TK_WAL_RETENTION_SIZE 96
|
||||||
#define TK_WAL_ROLL_PERIOD 97
|
#define TK_WAL_ROLL_PERIOD 97
|
||||||
#define TK_WAL_SEGMENT_SIZE 98
|
#define TK_WAL_SEGMENT_SIZE 98
|
||||||
#define TK_STT_TRIGGER 99
|
#define TK_STT_TRIGGER 99
|
||||||
#define TK_TABLE_PREFIX 100
|
#define TK_TABLE_PREFIX 100
|
||||||
#define TK_TABLE_SUFFIX 101
|
#define TK_TABLE_SUFFIX 101
|
||||||
#define TK_S3_CHUNKSIZE 102
|
#define TK_S3_CHUNKSIZE 102
|
||||||
#define TK_S3_KEEPLOCAL 103
|
#define TK_S3_KEEPLOCAL 103
|
||||||
#define TK_S3_COMPACT 104
|
#define TK_S3_COMPACT 104
|
||||||
#define TK_KEEP_TIME_OFFSET 105
|
#define TK_KEEP_TIME_OFFSET 105
|
||||||
#define TK_ENCRYPT_ALGORITHM 106
|
#define TK_ENCRYPT_ALGORITHM 106
|
||||||
#define TK_NK_COLON 107
|
#define TK_NK_COLON 107
|
||||||
#define TK_BWLIMIT 108
|
#define TK_BWLIMIT 108
|
||||||
#define TK_START 109
|
#define TK_START 109
|
||||||
#define TK_TIMESTAMP 110
|
#define TK_TIMESTAMP 110
|
||||||
#define TK_END 111
|
#define TK_END 111
|
||||||
#define TK_TABLE 112
|
#define TK_TABLE 112
|
||||||
#define TK_NK_LP 113
|
#define TK_NK_LP 113
|
||||||
#define TK_NK_RP 114
|
#define TK_NK_RP 114
|
||||||
#define TK_STABLE 115
|
#define TK_STABLE 115
|
||||||
#define TK_COLUMN 116
|
#define TK_COLUMN 116
|
||||||
#define TK_MODIFY 117
|
#define TK_MODIFY 117
|
||||||
#define TK_RENAME 118
|
#define TK_RENAME 118
|
||||||
#define TK_TAG 119
|
#define TK_TAG 119
|
||||||
#define TK_SET 120
|
#define TK_SET 120
|
||||||
#define TK_NK_EQ 121
|
#define TK_NK_EQ 121
|
||||||
#define TK_USING 122
|
#define TK_USING 122
|
||||||
#define TK_TAGS 123
|
#define TK_TAGS 123
|
||||||
#define TK_BOOL 124
|
#define TK_BOOL 124
|
||||||
#define TK_TINYINT 125
|
#define TK_TINYINT 125
|
||||||
#define TK_SMALLINT 126
|
#define TK_SMALLINT 126
|
||||||
#define TK_INT 127
|
#define TK_INT 127
|
||||||
#define TK_INTEGER 128
|
#define TK_INTEGER 128
|
||||||
#define TK_BIGINT 129
|
#define TK_BIGINT 129
|
||||||
#define TK_FLOAT 130
|
#define TK_FLOAT 130
|
||||||
#define TK_DOUBLE 131
|
#define TK_DOUBLE 131
|
||||||
#define TK_BINARY 132
|
#define TK_BINARY 132
|
||||||
#define TK_NCHAR 133
|
#define TK_NCHAR 133
|
||||||
#define TK_UNSIGNED 134
|
#define TK_UNSIGNED 134
|
||||||
#define TK_JSON 135
|
#define TK_JSON 135
|
||||||
#define TK_VARCHAR 136
|
#define TK_VARCHAR 136
|
||||||
#define TK_MEDIUMBLOB 137
|
#define TK_MEDIUMBLOB 137
|
||||||
#define TK_BLOB 138
|
#define TK_BLOB 138
|
||||||
#define TK_VARBINARY 139
|
#define TK_VARBINARY 139
|
||||||
#define TK_GEOMETRY 140
|
#define TK_GEOMETRY 140
|
||||||
#define TK_DECIMAL 141
|
#define TK_DECIMAL 141
|
||||||
#define TK_COMMENT 142
|
#define TK_COMMENT 142
|
||||||
#define TK_MAX_DELAY 143
|
#define TK_MAX_DELAY 143
|
||||||
#define TK_WATERMARK 144
|
#define TK_WATERMARK 144
|
||||||
#define TK_ROLLUP 145
|
#define TK_ROLLUP 145
|
||||||
#define TK_TTL 146
|
#define TK_TTL 146
|
||||||
#define TK_SMA 147
|
#define TK_SMA 147
|
||||||
#define TK_DELETE_MARK 148
|
#define TK_DELETE_MARK 148
|
||||||
#define TK_FIRST 149
|
#define TK_FIRST 149
|
||||||
#define TK_LAST 150
|
#define TK_LAST 150
|
||||||
#define TK_SHOW 151
|
#define TK_SHOW 151
|
||||||
#define TK_PRIVILEGES 152
|
#define TK_PRIVILEGES 152
|
||||||
#define TK_DATABASES 153
|
#define TK_DATABASES 153
|
||||||
#define TK_TABLES 154
|
#define TK_TABLES 154
|
||||||
#define TK_STABLES 155
|
#define TK_STABLES 155
|
||||||
#define TK_MNODES 156
|
#define TK_MNODES 156
|
||||||
#define TK_QNODES 157
|
#define TK_QNODES 157
|
||||||
#define TK_ARBGROUPS 158
|
#define TK_ARBGROUPS 158
|
||||||
#define TK_FUNCTIONS 159
|
#define TK_FUNCTIONS 159
|
||||||
#define TK_INDEXES 160
|
#define TK_INDEXES 160
|
||||||
#define TK_ACCOUNTS 161
|
#define TK_ACCOUNTS 161
|
||||||
#define TK_APPS 162
|
#define TK_APPS 162
|
||||||
#define TK_CONNECTIONS 163
|
#define TK_CONNECTIONS 163
|
||||||
#define TK_LICENCES 164
|
#define TK_LICENCES 164
|
||||||
#define TK_GRANTS 165
|
#define TK_GRANTS 165
|
||||||
#define TK_FULL 166
|
#define TK_FULL 166
|
||||||
#define TK_LOGS 167
|
#define TK_LOGS 167
|
||||||
#define TK_MACHINES 168
|
#define TK_MACHINES 168
|
||||||
#define TK_ENCRYPTIONS 169
|
#define TK_ENCRYPTIONS 169
|
||||||
#define TK_QUERIES 170
|
#define TK_QUERIES 170
|
||||||
#define TK_SCORES 171
|
#define TK_SCORES 171
|
||||||
#define TK_TOPICS 172
|
#define TK_TOPICS 172
|
||||||
#define TK_VARIABLES 173
|
#define TK_VARIABLES 173
|
||||||
#define TK_BNODES 174
|
#define TK_BNODES 174
|
||||||
#define TK_SNODES 175
|
#define TK_SNODES 175
|
||||||
#define TK_TRANSACTIONS 176
|
#define TK_TRANSACTIONS 176
|
||||||
#define TK_DISTRIBUTED 177
|
#define TK_DISTRIBUTED 177
|
||||||
#define TK_CONSUMERS 178
|
#define TK_CONSUMERS 178
|
||||||
#define TK_SUBSCRIPTIONS 179
|
#define TK_SUBSCRIPTIONS 179
|
||||||
#define TK_VNODES 180
|
#define TK_VNODES 180
|
||||||
#define TK_ALIVE 181
|
#define TK_ALIVE 181
|
||||||
#define TK_VIEWS 182
|
#define TK_VIEWS 182
|
||||||
#define TK_VIEW 183
|
#define TK_VIEW 183
|
||||||
#define TK_COMPACTS 184
|
#define TK_COMPACTS 184
|
||||||
#define TK_NORMAL 185
|
#define TK_NORMAL 185
|
||||||
#define TK_CHILD 186
|
#define TK_CHILD 186
|
||||||
#define TK_LIKE 187
|
#define TK_LIKE 187
|
||||||
#define TK_TBNAME 188
|
#define TK_TBNAME 188
|
||||||
#define TK_QTAGS 189
|
#define TK_QTAGS 189
|
||||||
#define TK_AS 190
|
#define TK_AS 190
|
||||||
#define TK_SYSTEM 191
|
#define TK_SYSTEM 191
|
||||||
#define TK_TSMA 192
|
#define TK_TSMA 192
|
||||||
#define TK_INTERVAL 193
|
#define TK_INTERVAL 193
|
||||||
#define TK_RECURSIVE 194
|
#define TK_RECURSIVE 194
|
||||||
#define TK_TSMAS 195
|
#define TK_TSMAS 195
|
||||||
#define TK_FUNCTION 196
|
#define TK_FUNCTION 196
|
||||||
#define TK_INDEX 197
|
#define TK_INDEX 197
|
||||||
#define TK_COUNT 198
|
#define TK_COUNT 198
|
||||||
#define TK_LAST_ROW 199
|
#define TK_LAST_ROW 199
|
||||||
#define TK_META 200
|
#define TK_META 200
|
||||||
#define TK_ONLY 201
|
#define TK_ONLY 201
|
||||||
#define TK_TOPIC 202
|
#define TK_TOPIC 202
|
||||||
#define TK_CONSUMER 203
|
#define TK_CONSUMER 203
|
||||||
#define TK_GROUP 204
|
#define TK_GROUP 204
|
||||||
#define TK_DESC 205
|
#define TK_DESC 205
|
||||||
#define TK_DESCRIBE 206
|
#define TK_DESCRIBE 206
|
||||||
#define TK_RESET 207
|
#define TK_RESET 207
|
||||||
#define TK_QUERY 208
|
#define TK_QUERY 208
|
||||||
#define TK_CACHE 209
|
#define TK_CACHE 209
|
||||||
#define TK_EXPLAIN 210
|
#define TK_EXPLAIN 210
|
||||||
#define TK_ANALYZE 211
|
#define TK_ANALYZE 211
|
||||||
#define TK_VERBOSE 212
|
#define TK_VERBOSE 212
|
||||||
#define TK_NK_BOOL 213
|
#define TK_NK_BOOL 213
|
||||||
#define TK_RATIO 214
|
#define TK_RATIO 214
|
||||||
#define TK_NK_FLOAT 215
|
#define TK_NK_FLOAT 215
|
||||||
#define TK_OUTPUTTYPE 216
|
#define TK_OUTPUTTYPE 216
|
||||||
#define TK_AGGREGATE 217
|
#define TK_AGGREGATE 217
|
||||||
#define TK_BUFSIZE 218
|
#define TK_BUFSIZE 218
|
||||||
#define TK_LANGUAGE 219
|
#define TK_LANGUAGE 219
|
||||||
#define TK_REPLACE 220
|
#define TK_REPLACE 220
|
||||||
#define TK_STREAM 221
|
#define TK_STREAM 221
|
||||||
#define TK_INTO 222
|
#define TK_INTO 222
|
||||||
#define TK_PAUSE 223
|
#define TK_PAUSE 223
|
||||||
#define TK_RESUME 224
|
#define TK_RESUME 224
|
||||||
#define TK_PRIMARY 225
|
#define TK_PRIMARY 225
|
||||||
#define TK_KEY 226
|
#define TK_KEY 226
|
||||||
#define TK_TRIGGER 227
|
#define TK_TRIGGER 227
|
||||||
#define TK_AT_ONCE 228
|
#define TK_AT_ONCE 228
|
||||||
#define TK_WINDOW_CLOSE 229
|
#define TK_WINDOW_CLOSE 229
|
||||||
#define TK_IGNORE 230
|
#define TK_IGNORE 230
|
||||||
#define TK_EXPIRED 231
|
#define TK_EXPIRED 231
|
||||||
#define TK_FILL_HISTORY 232
|
#define TK_FILL_HISTORY 232
|
||||||
#define TK_UPDATE 233
|
#define TK_UPDATE 233
|
||||||
#define TK_SUBTABLE 234
|
#define TK_SUBTABLE 234
|
||||||
#define TK_UNTREATED 235
|
#define TK_UNTREATED 235
|
||||||
#define TK_KILL 236
|
#define TK_KILL 236
|
||||||
#define TK_CONNECTION 237
|
#define TK_CONNECTION 237
|
||||||
#define TK_TRANSACTION 238
|
#define TK_TRANSACTION 238
|
||||||
#define TK_BALANCE 239
|
#define TK_BALANCE 239
|
||||||
#define TK_VGROUP 240
|
#define TK_VGROUP 240
|
||||||
#define TK_LEADER 241
|
#define TK_LEADER 241
|
||||||
#define TK_MERGE 242
|
#define TK_MERGE 242
|
||||||
#define TK_REDISTRIBUTE 243
|
#define TK_REDISTRIBUTE 243
|
||||||
#define TK_SPLIT 244
|
#define TK_SPLIT 244
|
||||||
#define TK_DELETE 245
|
#define TK_DELETE 245
|
||||||
#define TK_INSERT 246
|
#define TK_INSERT 246
|
||||||
#define TK_NK_BIN 247
|
#define TK_NK_BIN 247
|
||||||
#define TK_NK_HEX 248
|
#define TK_NK_HEX 248
|
||||||
#define TK_NULL 249
|
#define TK_NULL 249
|
||||||
#define TK_NK_QUESTION 250
|
#define TK_NK_QUESTION 250
|
||||||
#define TK_NK_ALIAS 251
|
#define TK_NK_ALIAS 251
|
||||||
#define TK_NK_ARROW 252
|
#define TK_NK_ARROW 252
|
||||||
#define TK_ROWTS 253
|
#define TK_ROWTS 253
|
||||||
#define TK_QSTART 254
|
#define TK_QSTART 254
|
||||||
#define TK_QEND 255
|
#define TK_QEND 255
|
||||||
#define TK_QDURATION 256
|
#define TK_QDURATION 256
|
||||||
#define TK_WSTART 257
|
#define TK_WSTART 257
|
||||||
#define TK_WEND 258
|
#define TK_WEND 258
|
||||||
#define TK_WDURATION 259
|
#define TK_WDURATION 259
|
||||||
#define TK_IROWTS 260
|
#define TK_IROWTS 260
|
||||||
#define TK_ISFILLED 261
|
#define TK_ISFILLED 261
|
||||||
#define TK_CAST 262
|
#define TK_CAST 262
|
||||||
#define TK_NOW 263
|
#define TK_NOW 263
|
||||||
#define TK_TODAY 264
|
#define TK_TODAY 264
|
||||||
#define TK_TIMEZONE 265
|
#define TK_TIMEZONE 265
|
||||||
#define TK_CLIENT_VERSION 266
|
#define TK_CLIENT_VERSION 266
|
||||||
#define TK_SERVER_VERSION 267
|
#define TK_SERVER_VERSION 267
|
||||||
#define TK_SERVER_STATUS 268
|
#define TK_SERVER_STATUS 268
|
||||||
#define TK_CURRENT_USER 269
|
#define TK_CURRENT_USER 269
|
||||||
#define TK_CASE 270
|
#define TK_CASE 270
|
||||||
#define TK_WHEN 271
|
#define TK_WHEN 271
|
||||||
#define TK_THEN 272
|
#define TK_THEN 272
|
||||||
#define TK_ELSE 273
|
#define TK_ELSE 273
|
||||||
#define TK_BETWEEN 274
|
#define TK_BETWEEN 274
|
||||||
#define TK_IS 275
|
#define TK_IS 275
|
||||||
#define TK_NK_LT 276
|
#define TK_NK_LT 276
|
||||||
#define TK_NK_GT 277
|
#define TK_NK_GT 277
|
||||||
#define TK_NK_LE 278
|
#define TK_NK_LE 278
|
||||||
#define TK_NK_GE 279
|
#define TK_NK_GE 279
|
||||||
#define TK_NK_NE 280
|
#define TK_NK_NE 280
|
||||||
#define TK_MATCH 281
|
#define TK_MATCH 281
|
||||||
#define TK_NMATCH 282
|
#define TK_NMATCH 282
|
||||||
#define TK_CONTAINS 283
|
#define TK_CONTAINS 283
|
||||||
#define TK_IN 284
|
#define TK_IN 284
|
||||||
#define TK_JOIN 285
|
#define TK_JOIN 285
|
||||||
#define TK_INNER 286
|
#define TK_INNER 286
|
||||||
#define TK_LEFT 287
|
#define TK_LEFT 287
|
||||||
#define TK_RIGHT 288
|
#define TK_RIGHT 288
|
||||||
#define TK_OUTER 289
|
#define TK_OUTER 289
|
||||||
#define TK_SEMI 290
|
#define TK_SEMI 290
|
||||||
#define TK_ANTI 291
|
#define TK_ANTI 291
|
||||||
#define TK_ASOF 292
|
#define TK_ASOF 292
|
||||||
#define TK_WINDOW 293
|
#define TK_WINDOW 293
|
||||||
#define TK_WINDOW_OFFSET 294
|
#define TK_WINDOW_OFFSET 294
|
||||||
#define TK_JLIMIT 295
|
#define TK_JLIMIT 295
|
||||||
#define TK_SELECT 296
|
#define TK_SELECT 296
|
||||||
#define TK_NK_HINT 297
|
#define TK_NK_HINT 297
|
||||||
#define TK_DISTINCT 298
|
#define TK_DISTINCT 298
|
||||||
#define TK_WHERE 299
|
#define TK_WHERE 299
|
||||||
#define TK_PARTITION 300
|
#define TK_PARTITION 300
|
||||||
#define TK_BY 301
|
#define TK_BY 301
|
||||||
#define TK_SESSION 302
|
#define TK_SESSION 302
|
||||||
#define TK_STATE_WINDOW 303
|
#define TK_STATE_WINDOW 303
|
||||||
#define TK_EVENT_WINDOW 304
|
#define TK_EVENT_WINDOW 304
|
||||||
#define TK_COUNT_WINDOW 305
|
#define TK_COUNT_WINDOW 305
|
||||||
#define TK_SLIDING 306
|
#define TK_SLIDING 306
|
||||||
#define TK_FILL 307
|
#define TK_FILL 307
|
||||||
#define TK_VALUE 308
|
#define TK_VALUE 308
|
||||||
#define TK_VALUE_F 309
|
#define TK_VALUE_F 309
|
||||||
#define TK_NONE 310
|
#define TK_NONE 310
|
||||||
#define TK_PREV 311
|
#define TK_PREV 311
|
||||||
#define TK_NULL_F 312
|
#define TK_NULL_F 312
|
||||||
#define TK_LINEAR 313
|
#define TK_LINEAR 313
|
||||||
#define TK_NEXT 314
|
#define TK_NEXT 314
|
||||||
#define TK_HAVING 315
|
#define TK_HAVING 315
|
||||||
#define TK_RANGE 316
|
#define TK_RANGE 316
|
||||||
#define TK_EVERY 317
|
#define TK_EVERY 317
|
||||||
#define TK_ORDER 318
|
#define TK_ORDER 318
|
||||||
#define TK_SLIMIT 319
|
#define TK_SLIMIT 319
|
||||||
#define TK_SOFFSET 320
|
#define TK_SOFFSET 320
|
||||||
#define TK_LIMIT 321
|
#define TK_LIMIT 321
|
||||||
#define TK_OFFSET 322
|
#define TK_OFFSET 322
|
||||||
#define TK_ASC 323
|
#define TK_ASC 323
|
||||||
#define TK_NULLS 324
|
#define TK_NULLS 324
|
||||||
#define TK_ABORT 325
|
#define TK_ABORT 325
|
||||||
#define TK_AFTER 326
|
#define TK_AFTER 326
|
||||||
#define TK_ATTACH 327
|
#define TK_ATTACH 327
|
||||||
#define TK_BEFORE 328
|
#define TK_BEFORE 328
|
||||||
#define TK_BEGIN 329
|
#define TK_BEGIN 329
|
||||||
#define TK_BITAND 330
|
#define TK_BITAND 330
|
||||||
#define TK_BITNOT 331
|
#define TK_BITNOT 331
|
||||||
#define TK_BITOR 332
|
#define TK_BITOR 332
|
||||||
#define TK_BLOCKS 333
|
#define TK_BLOCKS 333
|
||||||
#define TK_CHANGE 334
|
#define TK_CHANGE 334
|
||||||
#define TK_COMMA 335
|
#define TK_COMMA 335
|
||||||
#define TK_CONCAT 336
|
#define TK_CONCAT 336
|
||||||
#define TK_CONFLICT 337
|
#define TK_CONFLICT 337
|
||||||
#define TK_COPY 338
|
#define TK_COPY 338
|
||||||
#define TK_DEFERRED 339
|
#define TK_DEFERRED 339
|
||||||
#define TK_DELIMITERS 340
|
#define TK_DELIMITERS 340
|
||||||
#define TK_DETACH 341
|
#define TK_DETACH 341
|
||||||
#define TK_DIVIDE 342
|
#define TK_DIVIDE 342
|
||||||
#define TK_DOT 343
|
#define TK_DOT 343
|
||||||
#define TK_EACH 344
|
#define TK_EACH 344
|
||||||
#define TK_FAIL 345
|
#define TK_FAIL 345
|
||||||
#define TK_FILE 346
|
#define TK_FILE 346
|
||||||
#define TK_FOR 347
|
#define TK_FOR 347
|
||||||
#define TK_GLOB 348
|
#define TK_GLOB 348
|
||||||
#define TK_ID 349
|
#define TK_ID 349
|
||||||
#define TK_IMMEDIATE 350
|
#define TK_IMMEDIATE 350
|
||||||
#define TK_IMPORT 351
|
#define TK_IMPORT 351
|
||||||
#define TK_INITIALLY 352
|
#define TK_INITIALLY 352
|
||||||
#define TK_INSTEAD 353
|
#define TK_INSTEAD 353
|
||||||
#define TK_ISNULL 354
|
#define TK_ISNULL 354
|
||||||
#define TK_MODULES 355
|
#define TK_MODULES 355
|
||||||
#define TK_NK_BITNOT 356
|
#define TK_NK_BITNOT 356
|
||||||
#define TK_NK_SEMI 357
|
#define TK_NK_SEMI 357
|
||||||
#define TK_NOTNULL 358
|
#define TK_NOTNULL 358
|
||||||
#define TK_OF 359
|
#define TK_OF 359
|
||||||
#define TK_PLUS 360
|
#define TK_PLUS 360
|
||||||
#define TK_PRIVILEGE 361
|
#define TK_PRIVILEGE 361
|
||||||
#define TK_RAISE 362
|
#define TK_RAISE 362
|
||||||
#define TK_RESTRICT 363
|
#define TK_RESTRICT 363
|
||||||
#define TK_ROW 364
|
#define TK_ROW 364
|
||||||
#define TK_STAR 365
|
#define TK_STAR 365
|
||||||
#define TK_STATEMENT 366
|
#define TK_STATEMENT 366
|
||||||
#define TK_STRICT 367
|
#define TK_STRICT 367
|
||||||
#define TK_STRING 368
|
#define TK_STRING 368
|
||||||
#define TK_TIMES 369
|
#define TK_TIMES 369
|
||||||
#define TK_VALUES 370
|
#define TK_VALUES 370
|
||||||
#define TK_VARIABLE 371
|
#define TK_VARIABLE 371
|
||||||
#define TK_WAL 372
|
#define TK_WAL 372
|
||||||
#define TK_ENCODE 373
|
#define TK_ENCODE 373
|
||||||
#define TK_COMPRESS 374
|
#define TK_COMPRESS 374
|
||||||
#define TK_LEVEL 375
|
#define TK_LEVEL 375
|
||||||
|
|
||||||
#define TK_NK_SPACE 600
|
#define TK_NK_SPACE 600
|
||||||
#define TK_NK_COMMENT 601
|
#define TK_NK_COMMENT 601
|
||||||
|
|
|
@ -201,6 +201,26 @@ static cJSON* buildAlterSTableJson(void* alterData, int32_t alterDataLen) {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case TSDB_ALTER_TABLE_ADD_COLUMN_WITH_COMPRESS_OPTION: {
|
||||||
|
SFieldWithOptions* field = taosArrayGet(req.pFields, 0);
|
||||||
|
cJSON* colName = cJSON_CreateString(field->name);
|
||||||
|
cJSON_AddItemToObject(json, "colName", colName);
|
||||||
|
cJSON* colType = cJSON_CreateNumber(field->type);
|
||||||
|
cJSON_AddItemToObject(json, "colType", colType);
|
||||||
|
|
||||||
|
if (field->type == TSDB_DATA_TYPE_BINARY || field->type == TSDB_DATA_TYPE_VARBINARY ||
|
||||||
|
field->type == TSDB_DATA_TYPE_GEOMETRY) {
|
||||||
|
int32_t length = field->bytes - VARSTR_HEADER_SIZE;
|
||||||
|
cJSON* cbytes = cJSON_CreateNumber(length);
|
||||||
|
cJSON_AddItemToObject(json, "colLength", cbytes);
|
||||||
|
} else if (field->type == TSDB_DATA_TYPE_NCHAR) {
|
||||||
|
int32_t length = (field->bytes - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE;
|
||||||
|
cJSON* cbytes = cJSON_CreateNumber(length);
|
||||||
|
cJSON_AddItemToObject(json, "colLength", cbytes);
|
||||||
|
}
|
||||||
|
setCompressOption(json, field->compress);
|
||||||
|
break;
|
||||||
|
}
|
||||||
case TSDB_ALTER_TABLE_DROP_TAG:
|
case TSDB_ALTER_TABLE_DROP_TAG:
|
||||||
case TSDB_ALTER_TABLE_DROP_COLUMN: {
|
case TSDB_ALTER_TABLE_DROP_COLUMN: {
|
||||||
TAOS_FIELD* field = taosArrayGet(req.pFields, 0);
|
TAOS_FIELD* field = taosArrayGet(req.pFields, 0);
|
||||||
|
@ -539,6 +559,25 @@ static cJSON* processAlterTable(SMqMetaRsp* metaRsp) {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case TSDB_ALTER_TABLE_ADD_COLUMN_WITH_COMPRESS_OPTION: {
|
||||||
|
cJSON* colName = cJSON_CreateString(vAlterTbReq.colName);
|
||||||
|
cJSON_AddItemToObject(json, "colName", colName);
|
||||||
|
cJSON* colType = cJSON_CreateNumber(vAlterTbReq.type);
|
||||||
|
cJSON_AddItemToObject(json, "colType", colType);
|
||||||
|
|
||||||
|
if (vAlterTbReq.type == TSDB_DATA_TYPE_BINARY || vAlterTbReq.type == TSDB_DATA_TYPE_VARBINARY ||
|
||||||
|
vAlterTbReq.type == TSDB_DATA_TYPE_GEOMETRY) {
|
||||||
|
int32_t length = vAlterTbReq.bytes - VARSTR_HEADER_SIZE;
|
||||||
|
cJSON* cbytes = cJSON_CreateNumber(length);
|
||||||
|
cJSON_AddItemToObject(json, "colLength", cbytes);
|
||||||
|
} else if (vAlterTbReq.type == TSDB_DATA_TYPE_NCHAR) {
|
||||||
|
int32_t length = (vAlterTbReq.bytes - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE;
|
||||||
|
cJSON* cbytes = cJSON_CreateNumber(length);
|
||||||
|
cJSON_AddItemToObject(json, "colLength", cbytes);
|
||||||
|
}
|
||||||
|
setCompressOption(json, vAlterTbReq.compress);
|
||||||
|
break;
|
||||||
|
}
|
||||||
case TSDB_ALTER_TABLE_DROP_COLUMN: {
|
case TSDB_ALTER_TABLE_DROP_COLUMN: {
|
||||||
cJSON* colName = cJSON_CreateString(vAlterTbReq.colName);
|
cJSON* colName = cJSON_CreateString(vAlterTbReq.colName);
|
||||||
cJSON_AddItemToObject(json, "colName", colName);
|
cJSON_AddItemToObject(json, "colName", colName);
|
||||||
|
|
|
@ -131,6 +131,7 @@ const char* columnEncodeStr(uint8_t type) {
|
||||||
encode = TSDB_COLUMN_ENCODE_DISABLED;
|
encode = TSDB_COLUMN_ENCODE_DISABLED;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
encode = TSDB_COLUMN_ENCODE_UNKNOWN;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return encode;
|
return encode;
|
||||||
|
@ -157,8 +158,8 @@ const char* columnCompressStr(uint16_t type) {
|
||||||
case TSDB_COLVAL_COMPRESS_DISABLED:
|
case TSDB_COLVAL_COMPRESS_DISABLED:
|
||||||
compress = TSDB_COLUMN_COMPRESS_DISABLED;
|
compress = TSDB_COLUMN_COMPRESS_DISABLED;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
compress = TSDB_COLUMN_COMPRESS_UNKNOWN;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return compress;
|
return compress;
|
||||||
|
|
|
@ -768,11 +768,22 @@ int32_t tSerializeSMAlterStbReq(void *buf, int32_t bufLen, SMAlterStbReq *pReq)
|
||||||
if (tEncodeCStr(&encoder, pReq->name) < 0) return -1;
|
if (tEncodeCStr(&encoder, pReq->name) < 0) return -1;
|
||||||
if (tEncodeI8(&encoder, pReq->alterType) < 0) return -1;
|
if (tEncodeI8(&encoder, pReq->alterType) < 0) return -1;
|
||||||
if (tEncodeI32(&encoder, pReq->numOfFields) < 0) return -1;
|
if (tEncodeI32(&encoder, pReq->numOfFields) < 0) return -1;
|
||||||
|
|
||||||
|
// if (pReq->alterType == )
|
||||||
for (int32_t i = 0; i < pReq->numOfFields; ++i) {
|
for (int32_t i = 0; i < pReq->numOfFields; ++i) {
|
||||||
SField *pField = taosArrayGet(pReq->pFields, i);
|
if (pReq->alterType == TSDB_ALTER_TABLE_ADD_COLUMN_WITH_COMPRESS_OPTION) {
|
||||||
if (tEncodeI8(&encoder, pField->type) < 0) return -1;
|
SFieldWithOptions *pField = taosArrayGet(pReq->pFields, i);
|
||||||
if (tEncodeI32(&encoder, pField->bytes) < 0) return -1;
|
if (tEncodeI8(&encoder, pField->type) < 0) return -1;
|
||||||
if (tEncodeCStr(&encoder, pField->name) < 0) return -1;
|
if (tEncodeI32(&encoder, pField->bytes) < 0) return -1;
|
||||||
|
if (tEncodeCStr(&encoder, pField->name) < 0) return -1;
|
||||||
|
if (tEncodeU32(&encoder, pField->compress) < 0) return -1;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
SField *pField = taosArrayGet(pReq->pFields, i);
|
||||||
|
if (tEncodeI8(&encoder, pField->type) < 0) return -1;
|
||||||
|
if (tEncodeI32(&encoder, pField->bytes) < 0) return -1;
|
||||||
|
if (tEncodeCStr(&encoder, pField->name) < 0) return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (tEncodeI32(&encoder, pReq->ttl) < 0) return -1;
|
if (tEncodeI32(&encoder, pReq->ttl) < 0) return -1;
|
||||||
if (tEncodeI32(&encoder, pReq->commentLen) < 0) return -1;
|
if (tEncodeI32(&encoder, pReq->commentLen) < 0) return -1;
|
||||||
|
@ -802,13 +813,28 @@ int32_t tDeserializeSMAlterStbReq(void *buf, int32_t bufLen, SMAlterStbReq *pReq
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int32_t i = 0; i < pReq->numOfFields; ++i) {
|
for (int32_t i = 0; i < pReq->numOfFields; ++i) {
|
||||||
SField field = {0};
|
if (pReq->alterType == TSDB_ALTER_TABLE_ADD_COLUMN_WITH_COMPRESS_OPTION) {
|
||||||
if (tDecodeI8(&decoder, &field.type) < 0) return -1;
|
|
||||||
if (tDecodeI32(&decoder, &field.bytes) < 0) return -1;
|
taosArrayDestroy(pReq->pFields);
|
||||||
if (tDecodeCStrTo(&decoder, field.name) < 0) return -1;
|
pReq->pFields = taosArrayInit(pReq->numOfFields, sizeof(SFieldWithOptions));
|
||||||
if (taosArrayPush(pReq->pFields, &field) == NULL) {
|
SFieldWithOptions field = {0};
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
if (tDecodeI8(&decoder, &field.type) < 0) return -1;
|
||||||
return -1;
|
if (tDecodeI32(&decoder, &field.bytes) < 0) return -1;
|
||||||
|
if (tDecodeCStrTo(&decoder, field.name) < 0) return -1;
|
||||||
|
if (tDecodeU32(&decoder, &field.compress) < 0) return -1;
|
||||||
|
if (taosArrayPush(pReq->pFields, &field) == NULL) {
|
||||||
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
SField field = {0};
|
||||||
|
if (tDecodeI8(&decoder, &field.type) < 0) return -1;
|
||||||
|
if (tDecodeI32(&decoder, &field.bytes) < 0) return -1;
|
||||||
|
if (tDecodeCStrTo(&decoder, field.name) < 0) return -1;
|
||||||
|
if (taosArrayPush(pReq->pFields, &field) == NULL) {
|
||||||
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8792,6 +8818,13 @@ int32_t tEncodeSVAlterTbReq(SEncoder *pEncoder, const SVAlterTbReq *pReq) {
|
||||||
if (tEncodeCStr(pEncoder, pReq->colName) < 0) return -1;
|
if (tEncodeCStr(pEncoder, pReq->colName) < 0) return -1;
|
||||||
if (tEncodeU32(pEncoder, pReq->compress) < 0) return -1;
|
if (tEncodeU32(pEncoder, pReq->compress) < 0) return -1;
|
||||||
break;
|
break;
|
||||||
|
case TSDB_ALTER_TABLE_ADD_COLUMN_WITH_COMPRESS_OPTION:
|
||||||
|
if (tEncodeCStr(pEncoder, pReq->colName) < 0) return -1;
|
||||||
|
if (tEncodeI8(pEncoder, pReq->type) < 0) return -1;
|
||||||
|
if (tEncodeI8(pEncoder, pReq->flags) < 0) return -1;
|
||||||
|
if (tEncodeI32v(pEncoder, pReq->bytes) < 0) return -1;
|
||||||
|
if (tEncodeU32(pEncoder, pReq->compress) < 0) return -1;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -8847,6 +8880,12 @@ static int32_t tDecodeSVAlterTbReqCommon(SDecoder *pDecoder, SVAlterTbReq *pReq)
|
||||||
if (tDecodeCStr(pDecoder, &pReq->colName) < 0) return -1;
|
if (tDecodeCStr(pDecoder, &pReq->colName) < 0) return -1;
|
||||||
if (tDecodeU32(pDecoder, &pReq->compress) < 0) return -1;
|
if (tDecodeU32(pDecoder, &pReq->compress) < 0) return -1;
|
||||||
break;
|
break;
|
||||||
|
case TSDB_ALTER_TABLE_ADD_COLUMN_WITH_COMPRESS_OPTION:
|
||||||
|
if (tDecodeCStr(pDecoder, &pReq->colName) < 0) return -1;
|
||||||
|
if (tDecodeI8(pDecoder, &pReq->type) < 0) return -1;
|
||||||
|
if (tDecodeI8(pDecoder, &pReq->flags) < 0) return -1;
|
||||||
|
if (tDecodeI32v(pDecoder, &pReq->bytes) < 0) return -1;
|
||||||
|
if (tDecodeU32(pDecoder, &pReq->compress) < 0) return -1;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1779,7 +1779,8 @@ static int32_t mndUpdateSuperTableColumnCompress(SMnode *pMnode, const SStbObj *
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
static int32_t mndAddSuperTableColumn(const SStbObj *pOld, SStbObj *pNew, SArray *pFields, int32_t ncols) {
|
static int32_t mndAddSuperTableColumn(const SStbObj *pOld, SStbObj *pNew, SArray *pFields, int32_t ncols,
|
||||||
|
int8_t withCompress) {
|
||||||
if (pOld->numOfColumns + ncols + pOld->numOfTags > TSDB_MAX_COLUMNS) {
|
if (pOld->numOfColumns + ncols + pOld->numOfTags > TSDB_MAX_COLUMNS) {
|
||||||
terrno = TSDB_CODE_MND_TOO_MANY_COLUMNS;
|
terrno = TSDB_CODE_MND_TOO_MANY_COLUMNS;
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -1806,29 +1807,53 @@ static int32_t mndAddSuperTableColumn(const SStbObj *pOld, SStbObj *pNew, SArray
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int32_t i = 0; i < ncols; i++) {
|
for (int32_t i = 0; i < ncols; i++) {
|
||||||
SField *pField = taosArrayGet(pFields, i);
|
if (withCompress) {
|
||||||
if (mndFindSuperTableColumnIndex(pOld, pField->name) >= 0) {
|
SFieldWithOptions *pField = taosArrayGet(pFields, i);
|
||||||
terrno = TSDB_CODE_MND_COLUMN_ALREADY_EXIST;
|
if (mndFindSuperTableColumnIndex(pOld, pField->name) >= 0) {
|
||||||
return -1;
|
terrno = TSDB_CODE_MND_COLUMN_ALREADY_EXIST;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mndFindSuperTableTagIndex(pOld, pField->name) >= 0) {
|
||||||
|
terrno = TSDB_CODE_MND_TAG_ALREADY_EXIST;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
SSchema *pSchema = &pNew->pColumns[pOld->numOfColumns + i];
|
||||||
|
pSchema->bytes = pField->bytes;
|
||||||
|
pSchema->type = pField->type;
|
||||||
|
memcpy(pSchema->name, pField->name, TSDB_COL_NAME_LEN);
|
||||||
|
pSchema->colId = pNew->nextColId;
|
||||||
|
pNew->nextColId++;
|
||||||
|
|
||||||
|
SColCmpr *pCmpr = &pNew->pCmpr[pOld->numOfColumns + i];
|
||||||
|
pCmpr->id = pSchema->colId;
|
||||||
|
pCmpr->alg = pField->compress;
|
||||||
|
mInfo("stb:%s, start to add column %s", pNew->name, pSchema->name);
|
||||||
|
} else {
|
||||||
|
SField *pField = taosArrayGet(pFields, i);
|
||||||
|
if (mndFindSuperTableColumnIndex(pOld, pField->name) >= 0) {
|
||||||
|
terrno = TSDB_CODE_MND_COLUMN_ALREADY_EXIST;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mndFindSuperTableTagIndex(pOld, pField->name) >= 0) {
|
||||||
|
terrno = TSDB_CODE_MND_TAG_ALREADY_EXIST;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
SSchema *pSchema = &pNew->pColumns[pOld->numOfColumns + i];
|
||||||
|
pSchema->bytes = pField->bytes;
|
||||||
|
pSchema->type = pField->type;
|
||||||
|
memcpy(pSchema->name, pField->name, TSDB_COL_NAME_LEN);
|
||||||
|
pSchema->colId = pNew->nextColId;
|
||||||
|
pNew->nextColId++;
|
||||||
|
|
||||||
|
SColCmpr *pCmpr = &pNew->pCmpr[pOld->numOfColumns + i];
|
||||||
|
pCmpr->id = pSchema->colId;
|
||||||
|
pCmpr->alg = createDefaultColCmprByType(pSchema->type);
|
||||||
|
mInfo("stb:%s, start to add column %s", pNew->name, pSchema->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mndFindSuperTableTagIndex(pOld, pField->name) >= 0) {
|
|
||||||
terrno = TSDB_CODE_MND_TAG_ALREADY_EXIST;
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
SSchema *pSchema = &pNew->pColumns[pOld->numOfColumns + i];
|
|
||||||
pSchema->bytes = pField->bytes;
|
|
||||||
pSchema->type = pField->type;
|
|
||||||
memcpy(pSchema->name, pField->name, TSDB_COL_NAME_LEN);
|
|
||||||
pSchema->colId = pNew->nextColId;
|
|
||||||
pNew->nextColId++;
|
|
||||||
|
|
||||||
SColCmpr *pCmpr = &pNew->pCmpr[pOld->numOfColumns + i];
|
|
||||||
pCmpr->id = pSchema->colId;
|
|
||||||
pCmpr->alg = createDefaultColCmprByType(pSchema->type);
|
|
||||||
|
|
||||||
mInfo("stb:%s, start to add column %s", pNew->name, pSchema->name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pNew->colVer++;
|
pNew->colVer++;
|
||||||
|
@ -2461,7 +2486,7 @@ static int32_t mndAlterStb(SMnode *pMnode, SRpcMsg *pReq, const SMAlterStbReq *p
|
||||||
code = mndAlterStbTagBytes(pMnode, pOld, &stbObj, pField0);
|
code = mndAlterStbTagBytes(pMnode, pOld, &stbObj, pField0);
|
||||||
break;
|
break;
|
||||||
case TSDB_ALTER_TABLE_ADD_COLUMN:
|
case TSDB_ALTER_TABLE_ADD_COLUMN:
|
||||||
code = mndAddSuperTableColumn(pOld, &stbObj, pAlter->pFields, pAlter->numOfFields);
|
code = mndAddSuperTableColumn(pOld, &stbObj, pAlter->pFields, pAlter->numOfFields, 0);
|
||||||
break;
|
break;
|
||||||
case TSDB_ALTER_TABLE_DROP_COLUMN:
|
case TSDB_ALTER_TABLE_DROP_COLUMN:
|
||||||
pField0 = taosArrayGet(pAlter->pFields, 0);
|
pField0 = taosArrayGet(pAlter->pFields, 0);
|
||||||
|
@ -2478,6 +2503,9 @@ static int32_t mndAlterStb(SMnode *pMnode, SRpcMsg *pReq, const SMAlterStbReq *p
|
||||||
case TSDB_ALTER_TABLE_UPDATE_COLUMN_COMPRESS:
|
case TSDB_ALTER_TABLE_UPDATE_COLUMN_COMPRESS:
|
||||||
code = mndUpdateSuperTableColumnCompress(pMnode, pOld, &stbObj, pAlter->pFields, pAlter->numOfFields);
|
code = mndUpdateSuperTableColumnCompress(pMnode, pOld, &stbObj, pAlter->pFields, pAlter->numOfFields);
|
||||||
break;
|
break;
|
||||||
|
case TSDB_ALTER_TABLE_ADD_COLUMN_WITH_COMPRESS_OPTION:
|
||||||
|
code = mndAddSuperTableColumn(pOld, &stbObj, pAlter->pFields, pAlter->numOfFields, 1);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
needRsp = false;
|
needRsp = false;
|
||||||
terrno = TSDB_CODE_OPS_NOT_SUPPORT;
|
terrno = TSDB_CODE_OPS_NOT_SUPPORT;
|
||||||
|
|
|
@ -36,7 +36,7 @@ static int metaDeleteBtimeIdx(SMeta *pMeta, const SMetaEntry *pME);
|
||||||
static int metaUpdateNcolIdx(SMeta *pMeta, const SMetaEntry *pME);
|
static int metaUpdateNcolIdx(SMeta *pMeta, const SMetaEntry *pME);
|
||||||
static int metaDeleteNcolIdx(SMeta *pMeta, const SMetaEntry *pME);
|
static int metaDeleteNcolIdx(SMeta *pMeta, const SMetaEntry *pME);
|
||||||
|
|
||||||
int8_t updataTableColCmpr(SColCmprWrapper *pWp, SSchema *pSchema, int8_t add) {
|
int8_t updataTableColCmpr(SColCmprWrapper *pWp, SSchema *pSchema, int8_t add, uint32_t compress) {
|
||||||
int32_t nCols = pWp->nCols;
|
int32_t nCols = pWp->nCols;
|
||||||
int32_t ver = pWp->version;
|
int32_t ver = pWp->version;
|
||||||
if (add) {
|
if (add) {
|
||||||
|
@ -45,7 +45,7 @@ int8_t updataTableColCmpr(SColCmprWrapper *pWp, SSchema *pSchema, int8_t add) {
|
||||||
|
|
||||||
SColCmpr *pCol = p + nCols;
|
SColCmpr *pCol = p + nCols;
|
||||||
pCol->id = pSchema->colId;
|
pCol->id = pSchema->colId;
|
||||||
pCol->alg = createDefaultColCmprByType(pSchema->type);
|
pCol->alg = compress;
|
||||||
pWp->nCols = nCols + 1;
|
pWp->nCols = nCols + 1;
|
||||||
pWp->version = ver;
|
pWp->version = ver;
|
||||||
pWp->pColCmpr = p;
|
pWp->pColCmpr = p;
|
||||||
|
@ -1491,6 +1491,7 @@ static int metaAlterTableColumn(SMeta *pMeta, int64_t version, SVAlterTbReq *pAl
|
||||||
SSchema tScheam;
|
SSchema tScheam;
|
||||||
switch (pAlterTbReq->action) {
|
switch (pAlterTbReq->action) {
|
||||||
case TSDB_ALTER_TABLE_ADD_COLUMN:
|
case TSDB_ALTER_TABLE_ADD_COLUMN:
|
||||||
|
case TSDB_ALTER_TABLE_ADD_COLUMN_WITH_COMPRESS_OPTION:
|
||||||
if (pColumn) {
|
if (pColumn) {
|
||||||
terrno = TSDB_CODE_VND_COL_ALREADY_EXISTS;
|
terrno = TSDB_CODE_VND_COL_ALREADY_EXISTS;
|
||||||
goto _err;
|
goto _err;
|
||||||
|
@ -1522,7 +1523,9 @@ static int metaAlterTableColumn(SMeta *pMeta, int64_t version, SVAlterTbReq *pAl
|
||||||
(void)tsdbCacheNewNTableColumn(pMeta->pVnode->pTsdb, entry.uid, cid, col_type);
|
(void)tsdbCacheNewNTableColumn(pMeta->pVnode->pTsdb, entry.uid, cid, col_type);
|
||||||
}
|
}
|
||||||
SSchema *pCol = &pSchema->pSchema[entry.ntbEntry.schemaRow.nCols - 1];
|
SSchema *pCol = &pSchema->pSchema[entry.ntbEntry.schemaRow.nCols - 1];
|
||||||
updataTableColCmpr(&entry.colCmpr, pCol, 1);
|
uint32_t compress = pAlterTbReq->action == TSDB_ALTER_TABLE_ADD_COLUMN ? createDefaultColCmprByType(pCol->type)
|
||||||
|
: pAlterTbReq->compress;
|
||||||
|
updataTableColCmpr(&entry.colCmpr, pCol, 1, compress);
|
||||||
freeColCmpr = true;
|
freeColCmpr = true;
|
||||||
ASSERT(entry.colCmpr.nCols == pSchema->nCols);
|
ASSERT(entry.colCmpr.nCols == pSchema->nCols);
|
||||||
break;
|
break;
|
||||||
|
@ -1560,7 +1563,7 @@ static int metaAlterTableColumn(SMeta *pMeta, int64_t version, SVAlterTbReq *pAl
|
||||||
(void)tsdbCacheDropNTableColumn(pMeta->pVnode->pTsdb, entry.uid, cid, hasPrimayKey);
|
(void)tsdbCacheDropNTableColumn(pMeta->pVnode->pTsdb, entry.uid, cid, hasPrimayKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
updataTableColCmpr(&entry.colCmpr, &tScheam, 0);
|
updataTableColCmpr(&entry.colCmpr, &tScheam, 0, 0);
|
||||||
ASSERT(entry.colCmpr.nCols == pSchema->nCols);
|
ASSERT(entry.colCmpr.nCols == pSchema->nCols);
|
||||||
break;
|
break;
|
||||||
case TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES:
|
case TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES:
|
||||||
|
@ -2269,6 +2272,7 @@ int metaAlterTable(SMeta *pMeta, int64_t version, SVAlterTbReq *pReq, STableMeta
|
||||||
pMeta->changed = true;
|
pMeta->changed = true;
|
||||||
switch (pReq->action) {
|
switch (pReq->action) {
|
||||||
case TSDB_ALTER_TABLE_ADD_COLUMN:
|
case TSDB_ALTER_TABLE_ADD_COLUMN:
|
||||||
|
case TSDB_ALTER_TABLE_ADD_COLUMN_WITH_COMPRESS_OPTION:
|
||||||
case TSDB_ALTER_TABLE_DROP_COLUMN:
|
case TSDB_ALTER_TABLE_DROP_COLUMN:
|
||||||
case TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES:
|
case TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES:
|
||||||
case TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME:
|
case TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME:
|
||||||
|
|
|
@ -118,44 +118,46 @@ SToken getTokenFromRawExprNode(SAstCreateContext* pCxt, SNode* pNode);
|
||||||
SNodeList* createNodeList(SAstCreateContext* pCxt, SNode* pNode);
|
SNodeList* createNodeList(SAstCreateContext* pCxt, SNode* pNode);
|
||||||
SNodeList* addNodeToList(SAstCreateContext* pCxt, SNodeList* pList, SNode* pNode);
|
SNodeList* addNodeToList(SAstCreateContext* pCxt, SNodeList* pList, SNode* pNode);
|
||||||
|
|
||||||
SNode* createColumnNode(SAstCreateContext* pCxt, SToken* pTableAlias, SToken* pColumnName);
|
SNode* createColumnNode(SAstCreateContext* pCxt, SToken* pTableAlias, SToken* pColumnName);
|
||||||
SNode* createValueNode(SAstCreateContext* pCxt, int32_t dataType, const SToken* pLiteral);
|
SNode* createValueNode(SAstCreateContext* pCxt, int32_t dataType, const SToken* pLiteral);
|
||||||
SNode* createRawValueNode(SAstCreateContext* pCxt, int32_t dataType, const SToken* pLiteral, SNode *pNode);
|
SNode* createRawValueNode(SAstCreateContext* pCxt, int32_t dataType, const SToken* pLiteral, SNode* pNode);
|
||||||
SNode* createRawValueNodeExt(SAstCreateContext* pCxt, int32_t dataType, const SToken* pLiteral, SNode *pLeft, SNode *pRight);
|
SNode* createRawValueNodeExt(SAstCreateContext* pCxt, int32_t dataType, const SToken* pLiteral, SNode* pLeft,
|
||||||
|
SNode* pRight);
|
||||||
SNodeList* createHintNodeList(SAstCreateContext* pCxt, const SToken* pLiteral);
|
SNodeList* createHintNodeList(SAstCreateContext* pCxt, const SToken* pLiteral);
|
||||||
SNode* createIdentifierValueNode(SAstCreateContext* pCxt, SToken* pLiteral);
|
SNode* createIdentifierValueNode(SAstCreateContext* pCxt, SToken* pLiteral);
|
||||||
SNode* createDurationValueNode(SAstCreateContext* pCxt, const SToken* pLiteral);
|
SNode* createDurationValueNode(SAstCreateContext* pCxt, const SToken* pLiteral);
|
||||||
SNode* createTimeOffsetValueNode(SAstCreateContext* pCxt, const SToken* pLiteral);
|
SNode* createTimeOffsetValueNode(SAstCreateContext* pCxt, const SToken* pLiteral);
|
||||||
SNode* createDefaultDatabaseCondValue(SAstCreateContext* pCxt);
|
SNode* createDefaultDatabaseCondValue(SAstCreateContext* pCxt);
|
||||||
SNode* createPlaceholderValueNode(SAstCreateContext* pCxt, const SToken* pLiteral);
|
SNode* createPlaceholderValueNode(SAstCreateContext* pCxt, const SToken* pLiteral);
|
||||||
SNode* setProjectionAlias(SAstCreateContext* pCxt, SNode* pNode, SToken* pAlias);
|
SNode* setProjectionAlias(SAstCreateContext* pCxt, SNode* pNode, SToken* pAlias);
|
||||||
SNode* createLogicConditionNode(SAstCreateContext* pCxt, ELogicConditionType type, SNode* pParam1, SNode* pParam2);
|
SNode* createLogicConditionNode(SAstCreateContext* pCxt, ELogicConditionType type, SNode* pParam1, SNode* pParam2);
|
||||||
SNode* createOperatorNode(SAstCreateContext* pCxt, EOperatorType type, SNode* pLeft, SNode* pRight);
|
SNode* createOperatorNode(SAstCreateContext* pCxt, EOperatorType type, SNode* pLeft, SNode* pRight);
|
||||||
SNode* createBetweenAnd(SAstCreateContext* pCxt, SNode* pExpr, SNode* pLeft, SNode* pRight);
|
SNode* createBetweenAnd(SAstCreateContext* pCxt, SNode* pExpr, SNode* pLeft, SNode* pRight);
|
||||||
SNode* createNotBetweenAnd(SAstCreateContext* pCxt, SNode* pExpr, SNode* pLeft, SNode* pRight);
|
SNode* createNotBetweenAnd(SAstCreateContext* pCxt, SNode* pExpr, SNode* pLeft, SNode* pRight);
|
||||||
SNode* createFunctionNode(SAstCreateContext* pCxt, const SToken* pFuncName, SNodeList* pParameterList);
|
SNode* createFunctionNode(SAstCreateContext* pCxt, const SToken* pFuncName, SNodeList* pParameterList);
|
||||||
SNode* createCastFunctionNode(SAstCreateContext* pCxt, SNode* pExpr, SDataType dt);
|
SNode* createCastFunctionNode(SAstCreateContext* pCxt, SNode* pExpr, SDataType dt);
|
||||||
SNode* createNodeListNode(SAstCreateContext* pCxt, SNodeList* pList);
|
SNode* createNodeListNode(SAstCreateContext* pCxt, SNodeList* pList);
|
||||||
SNode* createNodeListNodeEx(SAstCreateContext* pCxt, SNode* p1, SNode* p2);
|
SNode* createNodeListNodeEx(SAstCreateContext* pCxt, SNode* p1, SNode* p2);
|
||||||
SNode* createRealTableNode(SAstCreateContext* pCxt, SToken* pDbName, SToken* pTableName, SToken* pTableAlias);
|
SNode* createRealTableNode(SAstCreateContext* pCxt, SToken* pDbName, SToken* pTableName, SToken* pTableAlias);
|
||||||
SNode* createTempTableNode(SAstCreateContext* pCxt, SNode* pSubquery, const SToken* pTableAlias);
|
SNode* createTempTableNode(SAstCreateContext* pCxt, SNode* pSubquery, const SToken* pTableAlias);
|
||||||
SNode* createJoinTableNode(SAstCreateContext* pCxt, EJoinType type, EJoinSubType stype, SNode* pLeft, SNode* pRight, SNode* pJoinCond);
|
SNode* createJoinTableNode(SAstCreateContext* pCxt, EJoinType type, EJoinSubType stype, SNode* pLeft, SNode* pRight,
|
||||||
SNode* createViewNode(SAstCreateContext* pCxt, SToken* pDbName, SToken* pViewName);
|
SNode* pJoinCond);
|
||||||
SNode* createLimitNode(SAstCreateContext* pCxt, const SToken* pLimit, const SToken* pOffset);
|
SNode* createViewNode(SAstCreateContext* pCxt, SToken* pDbName, SToken* pViewName);
|
||||||
SNode* createOrderByExprNode(SAstCreateContext* pCxt, SNode* pExpr, EOrder order, ENullOrder nullOrder);
|
SNode* createLimitNode(SAstCreateContext* pCxt, const SToken* pLimit, const SToken* pOffset);
|
||||||
SNode* createSessionWindowNode(SAstCreateContext* pCxt, SNode* pCol, SNode* pGap);
|
SNode* createOrderByExprNode(SAstCreateContext* pCxt, SNode* pExpr, EOrder order, ENullOrder nullOrder);
|
||||||
SNode* createStateWindowNode(SAstCreateContext* pCxt, SNode* pExpr);
|
SNode* createSessionWindowNode(SAstCreateContext* pCxt, SNode* pCol, SNode* pGap);
|
||||||
SNode* createEventWindowNode(SAstCreateContext* pCxt, SNode* pStartCond, SNode* pEndCond);
|
SNode* createStateWindowNode(SAstCreateContext* pCxt, SNode* pExpr);
|
||||||
SNode* createCountWindowNode(SAstCreateContext* pCxt, const SToken* pCountToken, const SToken* pSlidingToken);
|
SNode* createEventWindowNode(SAstCreateContext* pCxt, SNode* pStartCond, SNode* pEndCond);
|
||||||
SNode* createIntervalWindowNode(SAstCreateContext* pCxt, SNode* pInterval, SNode* pOffset, SNode* pSliding,
|
SNode* createCountWindowNode(SAstCreateContext* pCxt, const SToken* pCountToken, const SToken* pSlidingToken);
|
||||||
SNode* pFill);
|
SNode* createIntervalWindowNode(SAstCreateContext* pCxt, SNode* pInterval, SNode* pOffset, SNode* pSliding,
|
||||||
SNode* createWindowOffsetNode(SAstCreateContext* pCxt, SNode* pStartOffset, SNode* pEndOffset);
|
SNode* pFill);
|
||||||
SNode* createFillNode(SAstCreateContext* pCxt, EFillMode mode, SNode* pValues);
|
SNode* createWindowOffsetNode(SAstCreateContext* pCxt, SNode* pStartOffset, SNode* pEndOffset);
|
||||||
SNode* createGroupingSetNode(SAstCreateContext* pCxt, SNode* pNode);
|
SNode* createFillNode(SAstCreateContext* pCxt, EFillMode mode, SNode* pValues);
|
||||||
SNode* createInterpTimeRange(SAstCreateContext* pCxt, SNode* pStart, SNode* pEnd);
|
SNode* createGroupingSetNode(SAstCreateContext* pCxt, SNode* pNode);
|
||||||
SNode* createInterpTimePoint(SAstCreateContext* pCxt, SNode* pPoint);
|
SNode* createInterpTimeRange(SAstCreateContext* pCxt, SNode* pStart, SNode* pEnd);
|
||||||
SNode* createWhenThenNode(SAstCreateContext* pCxt, SNode* pWhen, SNode* pThen);
|
SNode* createInterpTimePoint(SAstCreateContext* pCxt, SNode* pPoint);
|
||||||
SNode* createCaseWhenNode(SAstCreateContext* pCxt, SNode* pCase, SNodeList* pWhenThenList, SNode* pElse);
|
SNode* createWhenThenNode(SAstCreateContext* pCxt, SNode* pWhen, SNode* pThen);
|
||||||
|
SNode* createCaseWhenNode(SAstCreateContext* pCxt, SNode* pCase, SNodeList* pWhenThenList, SNode* pElse);
|
||||||
|
|
||||||
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);
|
||||||
|
@ -170,7 +172,8 @@ SNode* addEveryClause(SAstCreateContext* pCxt, SNode* pStmt, SNode* pEvery);
|
||||||
SNode* addFillClause(SAstCreateContext* pCxt, SNode* pStmt, SNode* pFill);
|
SNode* addFillClause(SAstCreateContext* pCxt, SNode* pStmt, SNode* pFill);
|
||||||
SNode* addJLimitClause(SAstCreateContext* pCxt, SNode* pJoin, SNode* pJLimit);
|
SNode* addJLimitClause(SAstCreateContext* pCxt, SNode* pJoin, SNode* pJLimit);
|
||||||
SNode* addWindowOffsetClause(SAstCreateContext* pCxt, SNode* pJoin, SNode* pWinOffset);
|
SNode* addWindowOffsetClause(SAstCreateContext* pCxt, SNode* pJoin, SNode* pWinOffset);
|
||||||
SNode* createSelectStmt(SAstCreateContext* pCxt, bool isDistinct, SNodeList* pProjectionList, SNode* pTable, SNodeList* pHint);
|
SNode* createSelectStmt(SAstCreateContext* pCxt, bool isDistinct, SNodeList* pProjectionList, SNode* pTable,
|
||||||
|
SNodeList* pHint);
|
||||||
SNode* setSelectStmtTagMode(SAstCreateContext* pCxt, SNode* pStmt, bool bSelectTags);
|
SNode* setSelectStmtTagMode(SAstCreateContext* pCxt, SNode* pStmt, bool bSelectTags);
|
||||||
SNode* createSetOperator(SAstCreateContext* pCxt, ESetOperatorType type, SNode* pLeft, SNode* pRight);
|
SNode* createSetOperator(SAstCreateContext* pCxt, ESetOperatorType type, SNode* pLeft, SNode* pRight);
|
||||||
|
|
||||||
|
@ -205,8 +208,12 @@ SNode* createDropSuperTableStmt(SAstCreateContext* pCxt, bool ignoreNotExists, S
|
||||||
SNode* createAlterTableModifyOptions(SAstCreateContext* pCxt, SNode* pRealTable, SNode* pOptions);
|
SNode* createAlterTableModifyOptions(SAstCreateContext* pCxt, SNode* pRealTable, SNode* pOptions);
|
||||||
SNode* createAlterTableAddModifyCol(SAstCreateContext* pCxt, SNode* pRealTable, int8_t alterType, SToken* pColName,
|
SNode* createAlterTableAddModifyCol(SAstCreateContext* pCxt, SNode* pRealTable, int8_t alterType, SToken* pColName,
|
||||||
SDataType dataType);
|
SDataType dataType);
|
||||||
SNode* createAlterTableAddModifyColOptions(SAstCreateContext* pCxt, SNode* pRealTable, int8_t alterType, SToken* pColName,
|
|
||||||
SNode* pOptions);
|
SNode* createAlterTableAddModifyColOptions2(SAstCreateContext* pCxt, SNode* pRealTable, int8_t alterType,
|
||||||
|
SToken* pColName, SDataType dataType, SNode* pOptions);
|
||||||
|
|
||||||
|
SNode* createAlterTableAddModifyColOptions(SAstCreateContext* pCxt, SNode* pRealTable, int8_t alterType,
|
||||||
|
SToken* pColName, SNode* pOptions);
|
||||||
SNode* createAlterTableDropCol(SAstCreateContext* pCxt, SNode* pRealTable, int8_t alterType, SToken* pColName);
|
SNode* createAlterTableDropCol(SAstCreateContext* pCxt, SNode* pRealTable, int8_t alterType, SToken* pColName);
|
||||||
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);
|
||||||
|
@ -217,7 +224,8 @@ SNode* setShowKind(SAstCreateContext* pCxt, SNode* pStmt, EShowKind showKind);
|
||||||
SNode* createShowStmt(SAstCreateContext* pCxt, ENodeType type);
|
SNode* createShowStmt(SAstCreateContext* pCxt, ENodeType type);
|
||||||
SNode* createShowStmtWithCond(SAstCreateContext* pCxt, ENodeType type, SNode* pDbName, SNode* pTbName,
|
SNode* createShowStmtWithCond(SAstCreateContext* pCxt, ENodeType type, SNode* pDbName, SNode* pTbName,
|
||||||
EOperatorType tableCondType);
|
EOperatorType tableCondType);
|
||||||
SNode* createShowTablesStmt(SAstCreateContext* pCxt, SShowTablesOption option, SNode* pTbName, EOperatorType tableCondType);
|
SNode* createShowTablesStmt(SAstCreateContext* pCxt, SShowTablesOption option, SNode* pTbName,
|
||||||
|
EOperatorType tableCondType);
|
||||||
SNode* createShowCreateDatabaseStmt(SAstCreateContext* pCxt, SToken* pDbName);
|
SNode* createShowCreateDatabaseStmt(SAstCreateContext* pCxt, SToken* pDbName);
|
||||||
SNode* createShowAliveStmt(SAstCreateContext* pCxt, SNode* pDbName, ENodeType type);
|
SNode* createShowAliveStmt(SAstCreateContext* pCxt, SNode* pDbName, ENodeType type);
|
||||||
SNode* createShowCreateTableStmt(SAstCreateContext* pCxt, ENodeType type, SNode* pRealTable);
|
SNode* createShowCreateTableStmt(SAstCreateContext* pCxt, ENodeType type, SNode* pRealTable);
|
||||||
|
|
|
@ -353,7 +353,7 @@ cmd ::= ALTER STABLE alter_table_clause(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). { A = createAlterTableAddModifyCol(pCxt, B, TSDB_ALTER_TABLE_ADD_COLUMN, &C, D); }
|
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); }
|
||||||
alter_table_clause(A) ::= full_table_name(B) DROP COLUMN column_name(C). { A = createAlterTableDropCol(pCxt, B, TSDB_ALTER_TABLE_DROP_COLUMN, &C); }
|
alter_table_clause(A) ::= full_table_name(B) DROP COLUMN column_name(C). { A = createAlterTableDropCol(pCxt, B, TSDB_ALTER_TABLE_DROP_COLUMN, &C); }
|
||||||
alter_table_clause(A) ::=
|
alter_table_clause(A) ::=
|
||||||
full_table_name(B) MODIFY COLUMN column_name(C) type_name(D). { A = createAlterTableAddModifyCol(pCxt, B, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &C, D); }
|
full_table_name(B) MODIFY COLUMN column_name(C) type_name(D). { A = createAlterTableAddModifyCol(pCxt, B, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &C, D); }
|
||||||
|
|
|
@ -176,7 +176,8 @@ static bool checkDbName(SAstCreateContext* pCxt, SToken* pDbName, bool demandDb)
|
||||||
|
|
||||||
static bool checkTableName(SAstCreateContext* pCxt, SToken* pTableName) {
|
static bool checkTableName(SAstCreateContext* pCxt, SToken* pTableName) {
|
||||||
trimEscape(pTableName);
|
trimEscape(pTableName);
|
||||||
if (NULL != pTableName && pTableName->type != TK_NK_NIL && (pTableName->n >= TSDB_TABLE_NAME_LEN || pTableName->n == 0)) {
|
if (NULL != pTableName && pTableName->type != TK_NK_NIL &&
|
||||||
|
(pTableName->n >= TSDB_TABLE_NAME_LEN || pTableName->n == 0)) {
|
||||||
pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_IDENTIFIER_NAME, pTableName->z);
|
pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_IDENTIFIER_NAME, pTableName->z);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -185,7 +186,8 @@ static bool checkTableName(SAstCreateContext* pCxt, SToken* pTableName) {
|
||||||
|
|
||||||
static bool checkColumnName(SAstCreateContext* pCxt, SToken* pColumnName) {
|
static bool checkColumnName(SAstCreateContext* pCxt, SToken* pColumnName) {
|
||||||
trimEscape(pColumnName);
|
trimEscape(pColumnName);
|
||||||
if (NULL != pColumnName && pColumnName->type != TK_NK_NIL && (pColumnName->n >= TSDB_COL_NAME_LEN || pColumnName->n == 0)) {
|
if (NULL != pColumnName && pColumnName->type != TK_NK_NIL &&
|
||||||
|
(pColumnName->n >= TSDB_COL_NAME_LEN || pColumnName->n == 0)) {
|
||||||
pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_IDENTIFIER_NAME, pColumnName->z);
|
pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_IDENTIFIER_NAME, pColumnName->z);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1893,6 +1895,38 @@ SNode* createAlterTableAddModifyCol(SAstCreateContext* pCxt, SNode* pRealTable,
|
||||||
pStmt->dataType = dataType;
|
pStmt->dataType = dataType;
|
||||||
return createAlterTableStmtFinalize(pRealTable, pStmt);
|
return createAlterTableStmtFinalize(pRealTable, pStmt);
|
||||||
}
|
}
|
||||||
|
SNode* createAlterTableAddModifyColOptions2(SAstCreateContext* pCxt, SNode* pRealTable, int8_t alterType,
|
||||||
|
SToken* pColName, SDataType dataType, SNode* pOptions) {
|
||||||
|
CHECK_PARSER_STATUS(pCxt);
|
||||||
|
if (!checkColumnName(pCxt, pColName)) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
SAlterTableStmt* pStmt = (SAlterTableStmt*)nodesMakeNode(QUERY_NODE_ALTER_TABLE_STMT);
|
||||||
|
CHECK_OUT_OF_MEM(pStmt);
|
||||||
|
pStmt->alterType = alterType;
|
||||||
|
COPY_STRING_FORM_ID_TOKEN(pStmt->colName, pColName);
|
||||||
|
pStmt->dataType = dataType;
|
||||||
|
pStmt->pColOptions = (SColumnOptions*)pOptions;
|
||||||
|
|
||||||
|
if (pOptions != NULL) {
|
||||||
|
SColumnOptions* pOption = (SColumnOptions*)pOptions;
|
||||||
|
if (pOption->bPrimaryKey == false && pOption->commentNull == true) {
|
||||||
|
if (strlen(pOption->compress) != 0 || strlen(pOption->compressLevel) || strlen(pOption->encode) != 0) {
|
||||||
|
pStmt->alterType = TSDB_ALTER_TABLE_ADD_COLUMN_WITH_COMPRESS_OPTION;
|
||||||
|
} else {
|
||||||
|
// pCxt->errCode = generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_SYNTAX_ERROR,
|
||||||
|
// "not support alter column with option except compress");
|
||||||
|
// return NULL;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
pCxt->errCode = generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_SYNTAX_ERROR,
|
||||||
|
"not support alter column with option except compress");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return createAlterTableStmtFinalize(pRealTable, pStmt);
|
||||||
|
}
|
||||||
|
|
||||||
SNode* createAlterTableAddModifyColOptions(SAstCreateContext* pCxt, SNode* pRealTable, int8_t alterType,
|
SNode* createAlterTableAddModifyColOptions(SAstCreateContext* pCxt, SNode* pRealTable, int8_t alterType,
|
||||||
SToken* pColName, SNode* pOptions) {
|
SToken* pColName, SNode* pOptions) {
|
||||||
|
@ -2816,9 +2850,10 @@ SNode* createBalanceVgroupLeaderStmt(SAstCreateContext* pCxt, const SToken* pVgI
|
||||||
return (SNode*)pStmt;
|
return (SNode*)pStmt;
|
||||||
}
|
}
|
||||||
|
|
||||||
SNode* createBalanceVgroupLeaderDBNameStmt(SAstCreateContext* pCxt, const SToken* pDbName){
|
SNode* createBalanceVgroupLeaderDBNameStmt(SAstCreateContext* pCxt, const SToken* pDbName) {
|
||||||
CHECK_PARSER_STATUS(pCxt);
|
CHECK_PARSER_STATUS(pCxt);
|
||||||
SBalanceVgroupLeaderStmt* pStmt = (SBalanceVgroupLeaderStmt*)nodesMakeNode(QUERY_NODE_BALANCE_VGROUP_LEADER_DATABASE_STMT);
|
SBalanceVgroupLeaderStmt* pStmt =
|
||||||
|
(SBalanceVgroupLeaderStmt*)nodesMakeNode(QUERY_NODE_BALANCE_VGROUP_LEADER_DATABASE_STMT);
|
||||||
CHECK_OUT_OF_MEM(pStmt);
|
CHECK_OUT_OF_MEM(pStmt);
|
||||||
if (NULL != pDbName) {
|
if (NULL != pDbName) {
|
||||||
COPY_STRING_FORM_ID_TOKEN(pStmt->dbName, pDbName);
|
COPY_STRING_FORM_ID_TOKEN(pStmt->dbName, pDbName);
|
||||||
|
|
|
@ -1003,7 +1003,7 @@ static bool isBlockTimeLineAlignedQuery(SNode* pStmt) {
|
||||||
|
|
||||||
SNodeList* buildPartitionListFromOrderList(SNodeList* pOrderList, int32_t nodesNum) {
|
SNodeList* buildPartitionListFromOrderList(SNodeList* pOrderList, int32_t nodesNum) {
|
||||||
SNodeList* pPartitionList = NULL;
|
SNodeList* pPartitionList = NULL;
|
||||||
SNode* pNode = NULL;
|
SNode* pNode = NULL;
|
||||||
if (pOrderList->length <= nodesNum) {
|
if (pOrderList->length <= nodesNum) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -1023,7 +1023,6 @@ SNodeList* buildPartitionListFromOrderList(SNodeList* pOrderList, int32_t nodesN
|
||||||
return pPartitionList;
|
return pPartitionList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static bool isTimeLineAlignedQuery(SNode* pStmt) {
|
static bool isTimeLineAlignedQuery(SNode* pStmt) {
|
||||||
SSelectStmt* pSelect = (SSelectStmt*)pStmt;
|
SSelectStmt* pSelect = (SSelectStmt*)pStmt;
|
||||||
if (!isTimeLineQuery(((STempTableNode*)pSelect->pFromTable)->pSubquery)) {
|
if (!isTimeLineQuery(((STempTableNode*)pSelect->pFromTable)->pSubquery)) {
|
||||||
|
@ -1036,7 +1035,8 @@ static bool isTimeLineAlignedQuery(SNode* pStmt) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (pSub->timeLineFromOrderBy && pSub->pOrderByList->length > 1) {
|
if (pSub->timeLineFromOrderBy && pSub->pOrderByList->length > 1) {
|
||||||
SNodeList* pPartitionList = buildPartitionListFromOrderList(pSub->pOrderByList, pSelect->pPartitionByList->length);
|
SNodeList* pPartitionList =
|
||||||
|
buildPartitionListFromOrderList(pSub->pOrderByList, pSelect->pPartitionByList->length);
|
||||||
bool match = nodesListMatch(pSelect->pPartitionByList, pPartitionList);
|
bool match = nodesListMatch(pSelect->pPartitionByList, pPartitionList);
|
||||||
nodesDestroyList(pPartitionList);
|
nodesDestroyList(pPartitionList);
|
||||||
|
|
||||||
|
@ -1049,7 +1049,8 @@ static bool isTimeLineAlignedQuery(SNode* pStmt) {
|
||||||
if (QUERY_NODE_SET_OPERATOR == nodeType(((STempTableNode*)pSelect->pFromTable)->pSubquery)) {
|
if (QUERY_NODE_SET_OPERATOR == nodeType(((STempTableNode*)pSelect->pFromTable)->pSubquery)) {
|
||||||
SSetOperator* pSub = (SSetOperator*)((STempTableNode*)pSelect->pFromTable)->pSubquery;
|
SSetOperator* pSub = (SSetOperator*)((STempTableNode*)pSelect->pFromTable)->pSubquery;
|
||||||
if (pSelect->pPartitionByList && pSub->timeLineFromOrderBy && pSub->pOrderByList->length > 1) {
|
if (pSelect->pPartitionByList && pSub->timeLineFromOrderBy && pSub->pOrderByList->length > 1) {
|
||||||
SNodeList* pPartitionList = buildPartitionListFromOrderList(pSub->pOrderByList, pSelect->pPartitionByList->length);
|
SNodeList* pPartitionList =
|
||||||
|
buildPartitionListFromOrderList(pSub->pOrderByList, pSelect->pPartitionByList->length);
|
||||||
bool match = nodesListMatch(pSelect->pPartitionByList, pPartitionList);
|
bool match = nodesListMatch(pSelect->pPartitionByList, pPartitionList);
|
||||||
nodesDestroyList(pPartitionList);
|
nodesDestroyList(pPartitionList);
|
||||||
|
|
||||||
|
@ -6237,8 +6238,8 @@ static int32_t translateSetOperProject(STranslateContext* pCxt, SSetOperator* pS
|
||||||
}
|
}
|
||||||
snprintf(pRightExpr->aliasName, sizeof(pRightExpr->aliasName), "%s", pLeftExpr->aliasName);
|
snprintf(pRightExpr->aliasName, sizeof(pRightExpr->aliasName), "%s", pLeftExpr->aliasName);
|
||||||
SNode* pProj = createSetOperProject(pSetOperator->stmtName, pLeft);
|
SNode* pProj = createSetOperProject(pSetOperator->stmtName, pLeft);
|
||||||
bool isLeftPrimTs = isPrimaryKeyImpl(pLeft);
|
bool isLeftPrimTs = isPrimaryKeyImpl(pLeft);
|
||||||
bool isRightPrimTs = isPrimaryKeyImpl(pRight);
|
bool isRightPrimTs = isPrimaryKeyImpl(pRight);
|
||||||
|
|
||||||
if (isLeftPrimTs && isRightPrimTs) {
|
if (isLeftPrimTs && isRightPrimTs) {
|
||||||
SColumnNode* pFCol = (SColumnNode*)pProj;
|
SColumnNode* pFCol = (SColumnNode*)pProj;
|
||||||
|
@ -6288,7 +6289,7 @@ static int32_t translateSetOperOrderBy(STranslateContext* pCxt, SSetOperator* pS
|
||||||
pSetOperator->timeLineFromOrderBy = true;
|
pSetOperator->timeLineFromOrderBy = true;
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pSetOperator->timeLineResMode = TIME_LINE_NONE;
|
pSetOperator->timeLineResMode = TIME_LINE_NONE;
|
||||||
|
@ -8156,9 +8157,9 @@ static int32_t buildAlterSuperTableReq(STranslateContext* pCxt, SAlterTableStmt*
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (pStmt->alterType) {
|
switch (pStmt->alterType) {
|
||||||
|
case TSDB_ALTER_TABLE_ADD_COLUMN:
|
||||||
case TSDB_ALTER_TABLE_ADD_TAG:
|
case TSDB_ALTER_TABLE_ADD_TAG:
|
||||||
case TSDB_ALTER_TABLE_DROP_TAG:
|
case TSDB_ALTER_TABLE_DROP_TAG:
|
||||||
case TSDB_ALTER_TABLE_ADD_COLUMN:
|
|
||||||
case TSDB_ALTER_TABLE_DROP_COLUMN:
|
case TSDB_ALTER_TABLE_DROP_COLUMN:
|
||||||
case TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES:
|
case TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES:
|
||||||
case TSDB_ALTER_TABLE_UPDATE_TAG_BYTES: {
|
case TSDB_ALTER_TABLE_UPDATE_TAG_BYTES: {
|
||||||
|
@ -8193,6 +8194,31 @@ static int32_t buildAlterSuperTableReq(STranslateContext* pCxt, SAlterTableStmt*
|
||||||
taosArrayPush(pAlterReq->pFields, &field);
|
taosArrayPush(pAlterReq->pFields, &field);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case TSDB_ALTER_TABLE_ADD_COLUMN_WITH_COMPRESS_OPTION: {
|
||||||
|
taosArrayDestroy(pAlterReq->pFields);
|
||||||
|
|
||||||
|
pAlterReq->pFields = taosArrayInit(1, sizeof(SFieldWithOptions));
|
||||||
|
SFieldWithOptions field = {.type = pStmt->dataType.type, .bytes = calcTypeBytes(pStmt->dataType)};
|
||||||
|
// TAOS_FIELD field = {.type = pStmt->dataType.type, .bytes = calcTypeBytes(pStmt->dataType)};
|
||||||
|
strcpy(field.name, pStmt->colName);
|
||||||
|
if (pStmt->pColOptions != NULL) {
|
||||||
|
if (!checkColumnEncodeOrSetDefault(pStmt->dataType.type, pStmt->pColOptions->encode))
|
||||||
|
return TSDB_CODE_TSC_ENCODE_PARAM_ERROR;
|
||||||
|
if (!checkColumnCompressOrSetDefault(pStmt->dataType.type, pStmt->pColOptions->compress))
|
||||||
|
return TSDB_CODE_TSC_COMPRESS_PARAM_ERROR;
|
||||||
|
if (!checkColumnLevelOrSetDefault(pStmt->dataType.type, pStmt->pColOptions->compressLevel))
|
||||||
|
return TSDB_CODE_TSC_COMPRESS_LEVEL_ERROR;
|
||||||
|
int32_t code = setColCompressByOption(pStmt->dataType.type, columnEncodeVal(pStmt->pColOptions->encode),
|
||||||
|
columnCompressVal(pStmt->pColOptions->compress),
|
||||||
|
columnLevelVal(pStmt->pColOptions->compressLevel), false,
|
||||||
|
(uint32_t*)&field.compress);
|
||||||
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
taosArrayPush(pAlterReq->pFields, &field);
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -10642,7 +10668,7 @@ static int32_t translateBalanceVgroup(STranslateContext* pCxt, SBalanceVgroupStm
|
||||||
static int32_t translateBalanceVgroupLeader(STranslateContext* pCxt, SBalanceVgroupLeaderStmt* pStmt) {
|
static int32_t translateBalanceVgroupLeader(STranslateContext* pCxt, SBalanceVgroupLeaderStmt* pStmt) {
|
||||||
SBalanceVgroupLeaderReq req = {0};
|
SBalanceVgroupLeaderReq req = {0};
|
||||||
req.vgId = pStmt->vgId;
|
req.vgId = pStmt->vgId;
|
||||||
if(pStmt->dbName != NULL) strcpy(req.db, pStmt->dbName);
|
if (pStmt->dbName != NULL) strcpy(req.db, pStmt->dbName);
|
||||||
int32_t code =
|
int32_t code =
|
||||||
buildCmdMsg(pCxt, TDMT_MND_BALANCE_VGROUP_LEADER, (FSerializeFunc)tSerializeSBalanceVgroupLeaderReq, &req);
|
buildCmdMsg(pCxt, TDMT_MND_BALANCE_VGROUP_LEADER, (FSerializeFunc)tSerializeSBalanceVgroupLeaderReq, &req);
|
||||||
tFreeSBalanceVgroupLeaderReq(&req);
|
tFreeSBalanceVgroupLeaderReq(&req);
|
||||||
|
@ -11057,7 +11083,8 @@ static int32_t buildCreateTSMAReq(STranslateContext* pCxt, SCreateTSMAStmt* pStm
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
pReq->deleteMark = convertTimePrecision(tsmaDataDeleteMark, TSDB_TIME_PRECISION_MILLI, pTableMeta->tableInfo.precision);
|
pReq->deleteMark =
|
||||||
|
convertTimePrecision(tsmaDataDeleteMark, TSDB_TIME_PRECISION_MILLI, pTableMeta->tableInfo.precision);
|
||||||
code = getSmaIndexSql(pCxt, &pReq->sql, &pReq->sqlLen);
|
code = getSmaIndexSql(pCxt, &pReq->sql, &pReq->sqlLen);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12857,6 +12884,11 @@ static int32_t buildAddColReq(STranslateContext* pCxt, SAlterTableStmt* pStmt, S
|
||||||
return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_ROW_LENGTH, TSDB_MAX_BYTES_PER_ROW);
|
return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_ROW_LENGTH, TSDB_MAX_BYTES_PER_ROW);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// only super and normal support
|
||||||
|
if (pStmt->pColOptions != NULL && TSDB_CHILD_TABLE == pTableMeta->tableType) {
|
||||||
|
return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_ALTER_TABLE);
|
||||||
|
}
|
||||||
|
|
||||||
pReq->colName = taosStrdup(pStmt->colName);
|
pReq->colName = taosStrdup(pStmt->colName);
|
||||||
if (NULL == pReq->colName) {
|
if (NULL == pReq->colName) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
@ -12865,6 +12897,17 @@ static int32_t buildAddColReq(STranslateContext* pCxt, SAlterTableStmt* pStmt, S
|
||||||
pReq->type = pStmt->dataType.type;
|
pReq->type = pStmt->dataType.type;
|
||||||
pReq->flags = COL_SMA_ON;
|
pReq->flags = COL_SMA_ON;
|
||||||
pReq->bytes = calcTypeBytes(pStmt->dataType);
|
pReq->bytes = calcTypeBytes(pStmt->dataType);
|
||||||
|
if (pStmt->pColOptions != NULL) {
|
||||||
|
if (!checkColumnEncodeOrSetDefault(pReq->type, pStmt->pColOptions->encode)) return TSDB_CODE_TSC_ENCODE_PARAM_ERROR;
|
||||||
|
if (!checkColumnCompressOrSetDefault(pReq->type, pStmt->pColOptions->compress))
|
||||||
|
return TSDB_CODE_TSC_COMPRESS_PARAM_ERROR;
|
||||||
|
if (!checkColumnLevelOrSetDefault(pReq->type, pStmt->pColOptions->compressLevel))
|
||||||
|
return TSDB_CODE_TSC_COMPRESS_LEVEL_ERROR;
|
||||||
|
int8_t code = setColCompressByOption(pReq->type, columnEncodeVal(pStmt->pColOptions->encode),
|
||||||
|
columnCompressVal(pStmt->pColOptions->compress),
|
||||||
|
columnLevelVal(pStmt->pColOptions->compressLevel), true, &pReq->compress);
|
||||||
|
}
|
||||||
|
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13011,6 +13054,7 @@ static int32_t buildAlterTbReq(STranslateContext* pCxt, SAlterTableStmt* pStmt,
|
||||||
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:
|
||||||
|
case TSDB_ALTER_TABLE_ADD_COLUMN_WITH_COMPRESS_OPTION:
|
||||||
return buildAddColReq(pCxt, pStmt, pTableMeta, pReq);
|
return buildAddColReq(pCxt, pStmt, pTableMeta, pReq);
|
||||||
case TSDB_ALTER_TABLE_DROP_COLUMN:
|
case TSDB_ALTER_TABLE_DROP_COLUMN:
|
||||||
return buildDropColReq(pCxt, pStmt, pTableMeta, pReq);
|
return buildDropColReq(pCxt, pStmt, pTableMeta, pReq);
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -21,4 +21,15 @@ sql create table txx2 (ts timestamp compress 'disabled' level 'h', f int compres
|
||||||
sql create table txx3 (ts timestamp compress 'disabled' level 'h', f int compress 'xz')
|
sql create table txx3 (ts timestamp compress 'disabled' level 'h', f int compress 'xz')
|
||||||
sql create table txx4 (ts timestamp compress 'disabled' level 'h', f int compress 'zstd')
|
sql create table txx4 (ts timestamp compress 'disabled' level 'h', f int compress 'zstd')
|
||||||
|
|
||||||
|
|
||||||
|
sql alter table txx4 add column tt int compress 'xz' level 'h'
|
||||||
|
sql alter table txx4 drop column tt
|
||||||
|
|
||||||
|
sql create stable sp(ts timestamp, c int) tags(t int)
|
||||||
|
sql alter table sp add column c1 int compress 'zstd'
|
||||||
|
sql alter table sp drop column c1
|
||||||
|
|
||||||
|
sql alter stable sp add column c1 int compress 'zstd'
|
||||||
|
sql alter stable sp drop column c1
|
||||||
|
|
||||||
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
||||||
|
|
Loading…
Reference in New Issue