add tmq interface
This commit is contained in:
parent
0acc5f485a
commit
f0147770e0
|
@ -16,6 +16,8 @@
|
|||
#include "cJSON.h"
|
||||
#include "clientInt.h"
|
||||
#include "parser.h"
|
||||
#include "tcol.h"
|
||||
#include "tcompression.h"
|
||||
#include "tdatablock.h"
|
||||
#include "tdef.h"
|
||||
#include "tglobal.h"
|
||||
|
@ -27,7 +29,7 @@
|
|||
static tb_uid_t processSuid(tb_uid_t suid, char* db) { return suid + MurmurHash3_32(db, strlen(db)); }
|
||||
|
||||
static char* buildCreateTableJson(SSchemaWrapper* schemaRow, SSchemaWrapper* schemaTag, char* name, int64_t id,
|
||||
int8_t t) {
|
||||
int8_t t, SColCmprWrapper* pColCmprRow) {
|
||||
char* string = NULL;
|
||||
cJSON* json = cJSON_CreateObject();
|
||||
if (json == NULL) {
|
||||
|
@ -67,6 +69,23 @@ static char* buildCreateTableJson(SSchemaWrapper* schemaRow, SSchemaWrapper* sch
|
|||
cJSON* isPk = cJSON_CreateBool(s->flags & COL_IS_KEY);
|
||||
cJSON_AddItemToObject(column, "isPrimarykey", isPk);
|
||||
cJSON_AddItemToArray(columns, column);
|
||||
|
||||
if (pColCmprRow == NULL || pColCmprRow->nCols <= i) {
|
||||
continue;
|
||||
}
|
||||
SColCmpr* pColCmpr = pColCmprRow->pColCmpr + i;
|
||||
const char* encode = columnEncodeStr(COMPRESS_L1_TYPE_U32(pColCmpr->alg));
|
||||
const char* compress = columnCompressStr(COMPRESS_L2_TYPE_U32(pColCmpr->alg));
|
||||
const char* level = columnLevelStr(COMPRESS_L2_TYPE_LEVEL_U32(pColCmpr->alg));
|
||||
|
||||
cJSON* encodeJson = cJSON_CreateString(encode);
|
||||
cJSON_AddItemToObject(column, "encode", encodeJson);
|
||||
|
||||
cJSON* compressJson = cJSON_CreateString(compress);
|
||||
cJSON_AddItemToObject(column, "compress", compressJson);
|
||||
|
||||
cJSON* levelJson = cJSON_CreateString(level);
|
||||
cJSON_AddItemToObject(column, "level", levelJson);
|
||||
}
|
||||
cJSON_AddItemToObject(json, "columns", columns);
|
||||
|
||||
|
@ -205,7 +224,7 @@ static char* processCreateStb(SMqMetaRsp* metaRsp) {
|
|||
if (tDecodeSVCreateStbReq(&coder, &req) < 0) {
|
||||
goto _err;
|
||||
}
|
||||
string = buildCreateTableJson(&req.schemaRow, &req.schemaTag, req.name, req.suid, TSDB_SUPER_TABLE);
|
||||
string = buildCreateTableJson(&req.schemaRow, &req.schemaTag, req.name, req.suid, TSDB_SUPER_TABLE, &req.colCmpr);
|
||||
_err:
|
||||
uDebug("create stable return, sql json:%s", string);
|
||||
tDecoderClear(&coder);
|
||||
|
@ -373,8 +392,8 @@ static char* processCreateTable(SMqMetaRsp* metaRsp) {
|
|||
if (pCreateReq->type == TSDB_CHILD_TABLE) {
|
||||
string = buildCreateCTableJson(req.pReqs, req.nReqs);
|
||||
} else if (pCreateReq->type == TSDB_NORMAL_TABLE) {
|
||||
string =
|
||||
buildCreateTableJson(&pCreateReq->ntb.schemaRow, NULL, pCreateReq->name, pCreateReq->uid, TSDB_NORMAL_TABLE);
|
||||
string = buildCreateTableJson(&pCreateReq->ntb.schemaRow, NULL, pCreateReq->name, pCreateReq->uid,
|
||||
TSDB_NORMAL_TABLE, &pCreateReq->colCmpr);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -274,8 +274,6 @@ int metaCreateSTable(SMeta *pMeta, int64_t version, SVCreateStbReq *pReq) {
|
|||
me.name = pReq->name;
|
||||
me.stbEntry.schemaRow = pReq->schemaRow;
|
||||
me.stbEntry.schemaTag = pReq->schemaTag;
|
||||
// me.stbEntry.colCmpr = pReq->colCmpr;
|
||||
// me.stbEntry.colCmpr = pReq->
|
||||
if (pReq->rollup) {
|
||||
TABLE_SET_ROLLUP(me.flags);
|
||||
me.stbEntry.rsmaParam = pReq->rsmaParam;
|
||||
|
|
Loading…
Reference in New Issue