enh: param
This commit is contained in:
parent
04565b23ef
commit
5c01cff369
|
@ -166,6 +166,7 @@ const char* columnCompressStr(uint16_t type) {
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t columnLevelVal(const char* level) {
|
uint8_t columnLevelVal(const char* level) {
|
||||||
|
if (level == NULL) return TSDB_COLVAL_LEVEL_NOCHANGE;
|
||||||
uint8_t l = TSDB_COLVAL_LEVEL_MEDIUM;
|
uint8_t l = TSDB_COLVAL_LEVEL_MEDIUM;
|
||||||
if (0 == strcmp(level, "h") || 0 == strcmp(level, TSDB_COLUMN_LEVEL_HIGH)) {
|
if (0 == strcmp(level, "h") || 0 == strcmp(level, TSDB_COLUMN_LEVEL_HIGH)) {
|
||||||
l = TSDB_COLVAL_LEVEL_HIGH;
|
l = TSDB_COLVAL_LEVEL_HIGH;
|
||||||
|
@ -180,6 +181,7 @@ uint8_t columnLevelVal(const char* level) {
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t columnCompressVal(const char* compress) {
|
uint16_t columnCompressVal(const char* compress) {
|
||||||
|
if (compress == NULL) return TSDB_COLVAL_COMPRESS_NOCHANGE;
|
||||||
uint16_t c = TSDB_COLVAL_COMPRESS_LZ4;
|
uint16_t c = TSDB_COLVAL_COMPRESS_LZ4;
|
||||||
if (0 == strcmp(compress, TSDB_COLUMN_COMPRESS_LZ4)) {
|
if (0 == strcmp(compress, TSDB_COLUMN_COMPRESS_LZ4)) {
|
||||||
c = TSDB_COLVAL_COMPRESS_LZ4;
|
c = TSDB_COLVAL_COMPRESS_LZ4;
|
||||||
|
@ -200,6 +202,7 @@ uint16_t columnCompressVal(const char* compress) {
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t columnEncodeVal(const char* encode) {
|
uint8_t columnEncodeVal(const char* encode) {
|
||||||
|
if (encode == NULL) return TSDB_COLVAL_ENCODE_NOCHANGE;
|
||||||
uint8_t e = TSDB_COLVAL_ENCODE_SIMPLE8B;
|
uint8_t e = TSDB_COLVAL_ENCODE_SIMPLE8B;
|
||||||
if (0 == strcmp(encode, TSDB_COLUMN_ENCODE_SIMPLE8B)) {
|
if (0 == strcmp(encode, TSDB_COLUMN_ENCODE_SIMPLE8B)) {
|
||||||
e = TSDB_COLVAL_ENCODE_SIMPLE8B;
|
e = TSDB_COLVAL_ENCODE_SIMPLE8B;
|
||||||
|
@ -311,6 +314,7 @@ void setColLevel(uint32_t* compress, uint8_t level) {
|
||||||
|
|
||||||
int32_t setColCompressByOption(uint8_t type, uint8_t encode, uint16_t compressType, uint8_t level, bool check,
|
int32_t setColCompressByOption(uint8_t type, uint8_t encode, uint16_t compressType, uint8_t level, bool check,
|
||||||
uint32_t* compress) {
|
uint32_t* compress) {
|
||||||
|
if(compress == NULL) return TSDB_CODE_TSC_ENCODE_PARAM_ERROR;
|
||||||
if (check && !validColEncode(type, encode)) return TSDB_CODE_TSC_ENCODE_PARAM_ERROR;
|
if (check && !validColEncode(type, encode)) return TSDB_CODE_TSC_ENCODE_PARAM_ERROR;
|
||||||
setColEncode(compress, encode);
|
setColEncode(compress, encode);
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,9 @@
|
||||||
extern SConfig* tsCfg;
|
extern SConfig* tsCfg;
|
||||||
|
|
||||||
static int32_t buildRetrieveTableRsp(SSDataBlock* pBlock, int32_t numOfCols, SRetrieveTableRsp** pRsp) {
|
static int32_t buildRetrieveTableRsp(SSDataBlock* pBlock, int32_t numOfCols, SRetrieveTableRsp** pRsp) {
|
||||||
|
if (NULL == pBlock || NULL == pRsp) {
|
||||||
|
return TSDB_CODE_INVALID_PARA;
|
||||||
|
}
|
||||||
size_t dataEncodeBufSize = blockGetEncodeSize(pBlock);
|
size_t dataEncodeBufSize = blockGetEncodeSize(pBlock);
|
||||||
size_t rspSize = sizeof(SRetrieveTableRsp) + dataEncodeBufSize + PAYLOAD_PREFIX_LEN;
|
size_t rspSize = sizeof(SRetrieveTableRsp) + dataEncodeBufSize + PAYLOAD_PREFIX_LEN;
|
||||||
*pRsp = taosMemoryCalloc(1, rspSize);
|
*pRsp = taosMemoryCalloc(1, rspSize);
|
||||||
|
@ -216,6 +219,9 @@ static int32_t setDescResultIntoDataBlock(bool sysInfoUser, SSDataBlock* pBlock,
|
||||||
|
|
||||||
static int32_t execDescribe(bool sysInfoUser, SNode* pStmt, SRetrieveTableRsp** pRsp, int8_t biMode) {
|
static int32_t execDescribe(bool sysInfoUser, SNode* pStmt, SRetrieveTableRsp** pRsp, int8_t biMode) {
|
||||||
SDescribeStmt* pDesc = (SDescribeStmt*)pStmt;
|
SDescribeStmt* pDesc = (SDescribeStmt*)pStmt;
|
||||||
|
if (NULL == pDesc || NULL == pDesc->pMeta) {
|
||||||
|
return TSDB_CODE_INVALID_PARA;
|
||||||
|
}
|
||||||
int32_t numOfRows = TABLE_TOTAL_COL_NUM(pDesc->pMeta);
|
int32_t numOfRows = TABLE_TOTAL_COL_NUM(pDesc->pMeta);
|
||||||
|
|
||||||
SSDataBlock* pBlock = NULL;
|
SSDataBlock* pBlock = NULL;
|
||||||
|
@ -505,7 +511,7 @@ static int32_t buildCreateViewResultDataBlock(SSDataBlock** pOutput) {
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
void appendColumnFields(char* buf, int32_t* len, STableCfg* pCfg) {
|
static void appendColumnFields(char* buf, int32_t* len, STableCfg* pCfg) {
|
||||||
for (int32_t i = 0; i < pCfg->numOfColumns; ++i) {
|
for (int32_t i = 0; i < pCfg->numOfColumns; ++i) {
|
||||||
SSchema* pSchema = pCfg->pSchemas + i;
|
SSchema* pSchema = pCfg->pSchemas + i;
|
||||||
#define LTYPE_LEN (32 + 60) // 60 byte for compress info
|
#define LTYPE_LEN (32 + 60) // 60 byte for compress info
|
||||||
|
@ -539,7 +545,7 @@ void appendColumnFields(char* buf, int32_t* len, STableCfg* pCfg) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void appendTagFields(char* buf, int32_t* len, STableCfg* pCfg) {
|
static void appendTagFields(char* buf, int32_t* len, STableCfg* pCfg) {
|
||||||
for (int32_t i = 0; i < pCfg->numOfTags; ++i) {
|
for (int32_t i = 0; i < pCfg->numOfTags; ++i) {
|
||||||
SSchema* pSchema = pCfg->pSchemas + pCfg->numOfColumns + i;
|
SSchema* pSchema = pCfg->pSchemas + pCfg->numOfColumns + i;
|
||||||
char type[32];
|
char type[32];
|
||||||
|
@ -558,7 +564,7 @@ void appendTagFields(char* buf, int32_t* len, STableCfg* pCfg) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void appendTagNameFields(char* buf, int32_t* len, STableCfg* pCfg) {
|
static void appendTagNameFields(char* buf, int32_t* len, STableCfg* pCfg) {
|
||||||
for (int32_t i = 0; i < pCfg->numOfTags; ++i) {
|
for (int32_t i = 0; i < pCfg->numOfTags; ++i) {
|
||||||
SSchema* pSchema = pCfg->pSchemas + pCfg->numOfColumns + i;
|
SSchema* pSchema = pCfg->pSchemas + pCfg->numOfColumns + i;
|
||||||
*len += tsnprintf(buf + VARSTR_HEADER_SIZE + *len, SHOW_CREATE_TB_RESULT_FIELD2_LEN - (VARSTR_HEADER_SIZE + *len),
|
*len += tsnprintf(buf + VARSTR_HEADER_SIZE + *len, SHOW_CREATE_TB_RESULT_FIELD2_LEN - (VARSTR_HEADER_SIZE + *len),
|
||||||
|
@ -566,7 +572,7 @@ void appendTagNameFields(char* buf, int32_t* len, STableCfg* pCfg) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t appendTagValues(char* buf, int32_t* len, STableCfg* pCfg) {
|
static int32_t appendTagValues(char* buf, int32_t* len, STableCfg* pCfg) {
|
||||||
int32_t code = TSDB_CODE_SUCCESS;
|
int32_t code = TSDB_CODE_SUCCESS;
|
||||||
SArray* pTagVals = NULL;
|
SArray* pTagVals = NULL;
|
||||||
STag* pTag = (STag*)pCfg->pTags;
|
STag* pTag = (STag*)pCfg->pTags;
|
||||||
|
@ -643,7 +649,7 @@ _exit:
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
void appendTableOptions(char* buf, int32_t* len, SDbCfgInfo* pDbCfg, STableCfg* pCfg) {
|
static void appendTableOptions(char* buf, int32_t* len, SDbCfgInfo* pDbCfg, STableCfg* pCfg) {
|
||||||
if (pCfg->commentLen > 0) {
|
if (pCfg->commentLen > 0) {
|
||||||
*len += tsnprintf(buf + VARSTR_HEADER_SIZE + *len, SHOW_CREATE_TB_RESULT_FIELD2_LEN - (VARSTR_HEADER_SIZE + *len),
|
*len += tsnprintf(buf + VARSTR_HEADER_SIZE + *len, SHOW_CREATE_TB_RESULT_FIELD2_LEN - (VARSTR_HEADER_SIZE + *len),
|
||||||
" COMMENT '%s'", pCfg->pComment);
|
" COMMENT '%s'", pCfg->pComment);
|
||||||
|
@ -997,7 +1003,7 @@ static int32_t createSelectResultDataBlock(SNodeList* pProjects, SSDataBlock** p
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t buildSelectResultDataBlock(SNodeList* pProjects, SSDataBlock* pBlock) {
|
static int32_t buildSelectResultDataBlock(SNodeList* pProjects, SSDataBlock* pBlock) {
|
||||||
QRY_ERR_RET(blockDataEnsureCapacity(pBlock, 1));
|
QRY_ERR_RET(blockDataEnsureCapacity(pBlock, 1));
|
||||||
|
|
||||||
int32_t index = 0;
|
int32_t index = 0;
|
||||||
|
|
Loading…
Reference in New Issue