Merge pull request #22096 from taosdata/fix/TD-25210-3.0
fix: add sma option when show create table for stb/ntb
This commit is contained in:
commit
73c6666e62
|
@ -1738,6 +1738,7 @@ static int32_t mndBuildStbSchemaImp(SDbObj *pDb, SStbObj *pStb, const char *tbNa
|
|||
SSchema *pSrcSchema = &pStb->pColumns[i];
|
||||
memcpy(pSchema->name, pSrcSchema->name, TSDB_COL_NAME_LEN);
|
||||
pSchema->type = pSrcSchema->type;
|
||||
pSchema->flags = pSrcSchema->flags;
|
||||
pSchema->colId = pSrcSchema->colId;
|
||||
pSchema->bytes = pSrcSchema->bytes;
|
||||
}
|
||||
|
@ -1788,6 +1789,7 @@ static int32_t mndBuildStbCfgImp(SDbObj *pDb, SStbObj *pStb, const char *tbName,
|
|||
SSchema *pSrcSchema = &pStb->pColumns[i];
|
||||
memcpy(pSchema->name, pSrcSchema->name, TSDB_COL_NAME_LEN);
|
||||
pSchema->type = pSrcSchema->type;
|
||||
pSchema->flags = pSrcSchema->flags;
|
||||
pSchema->colId = pSrcSchema->colId;
|
||||
pSchema->bytes = pSrcSchema->bytes;
|
||||
}
|
||||
|
@ -1797,6 +1799,7 @@ static int32_t mndBuildStbCfgImp(SDbObj *pDb, SStbObj *pStb, const char *tbName,
|
|||
SSchema *pSrcSchema = &pStb->pTags[i];
|
||||
memcpy(pSchema->name, pSrcSchema->name, TSDB_COL_NAME_LEN);
|
||||
pSchema->type = pSrcSchema->type;
|
||||
pSchema->flags = pSrcSchema->flags;
|
||||
pSchema->colId = pSrcSchema->colId;
|
||||
pSchema->bytes = pSrcSchema->bytes;
|
||||
}
|
||||
|
|
|
@ -615,6 +615,31 @@ void appendTableOptions(char* buf, int32_t* len, SDbCfgInfo* pDbCfg, STableCfg*
|
|||
if (pCfg->ttl > 0) {
|
||||
*len += sprintf(buf + VARSTR_HEADER_SIZE + *len, " TTL %d", pCfg->ttl);
|
||||
}
|
||||
|
||||
if (TSDB_SUPER_TABLE == pCfg->tableType || TSDB_NORMAL_TABLE == pCfg->tableType) {
|
||||
int32_t nSma = 0;
|
||||
for (int32_t i = 0; i < pCfg->numOfColumns; ++i) {
|
||||
if (IS_BSMA_ON(pCfg->pSchemas + i)) {
|
||||
++nSma;
|
||||
}
|
||||
}
|
||||
|
||||
if (nSma < pCfg->numOfColumns) {
|
||||
bool smaOn = false;
|
||||
*len += sprintf(buf + VARSTR_HEADER_SIZE + *len, " SMA(");
|
||||
for (int32_t i = 0; i < pCfg->numOfColumns; ++i) {
|
||||
if (IS_BSMA_ON(pCfg->pSchemas + i)) {
|
||||
if (smaOn) {
|
||||
*len += sprintf(buf + VARSTR_HEADER_SIZE + *len, ",`%s`", (pCfg->pSchemas + i)->name);
|
||||
} else {
|
||||
smaOn = true;
|
||||
*len += sprintf(buf + VARSTR_HEADER_SIZE + *len, "`%s`", (pCfg->pSchemas + i)->name);
|
||||
}
|
||||
}
|
||||
}
|
||||
*len += sprintf(buf + VARSTR_HEADER_SIZE + *len, ")");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int32_t setCreateTBResultIntoDataBlock(SSDataBlock* pBlock, SDbCfgInfo* pDbCfg, char* tbName, STableCfg* pCfg) {
|
||||
|
|
Loading…
Reference in New Issue