提交 72e8d5ce 编写于 作者: wmmhello's avatar wmmhello

refactor:add schemaless test cases

上级 07a02b25
...@@ -1597,7 +1597,7 @@ static int32_t smlBoundColumns(SArray *cols, SParsedDataColInfo* pColList, SSche ...@@ -1597,7 +1597,7 @@ static int32_t smlBoundColumns(SArray *cols, SParsedDataColInfo* pColList, SSche
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
static int32_t smlParseTags(SArray *cols, SKVRowBuilder *tagsBuilder, SParsedDataColInfo* tags, SSchema* pSchema, SVCreateTbReq *createTblReq, SMsgBuf *msg) { static int32_t smlBoundTags(SArray *cols, SKVRowBuilder *tagsBuilder, SParsedDataColInfo* tags, SSchema* pSchema, SKVRow *row, SMsgBuf *msg) {
if (tdInitKVRowBuilder(tagsBuilder) < 0) { if (tdInitKVRowBuilder(tagsBuilder) < 0) {
return TSDB_CODE_TSC_OUT_OF_MEMORY; return TSDB_CODE_TSC_OUT_OF_MEMORY;
} }
...@@ -1611,13 +1611,11 @@ static int32_t smlParseTags(SArray *cols, SKVRowBuilder *tagsBuilder, SParsedDat ...@@ -1611,13 +1611,11 @@ static int32_t smlParseTags(SArray *cols, SKVRowBuilder *tagsBuilder, SParsedDat
} }
SKVRow row = tdGetKVRowFromBuilder(tagsBuilder); *row = tdGetKVRowFromBuilder(tagsBuilder);
if(row == NULL){ if(*row == NULL){
return TSDB_CODE_SML_INVALID_DATA; return TSDB_CODE_SML_INVALID_DATA;
} }
tdSortKVRowByColIdx(row); tdSortKVRowByColIdx(*row);
createTblReq->type = TD_CHILD_TABLE;
createTblReq->ctbCfg.pTag = row;
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
...@@ -1633,11 +1631,14 @@ int32_t smlBindData(void *handle, SArray *tags, SArray *colsFormat, SHashObj *co ...@@ -1633,11 +1631,14 @@ int32_t smlBindData(void *handle, SArray *tags, SArray *colsFormat, SHashObj *co
buildInvalidOperationMsg(&pBuf, "bound tags error"); buildInvalidOperationMsg(&pBuf, "bound tags error");
return ret; return ret;
} }
ret = smlParseTags(tags, &smlHandle->tagsBuilder, &smlHandle->tags, pTagsSchema, &smlHandle->createTblReq, &pBuf); SKVRow row = NULL;
ret = smlBoundTags(tags, &smlHandle->tagsBuilder, &smlHandle->tags, pTagsSchema, &row, &pBuf);
if(ret != TSDB_CODE_SUCCESS){ if(ret != TSDB_CODE_SUCCESS){
return ret; return ret;
} }
buildCreateTbReq(&smlHandle->createTblReq, pTableMeta->schema->name, row, pTableMeta->suid);
STableDataBlocks* pDataBlock = NULL; STableDataBlocks* pDataBlock = NULL;
ret = getDataBlockFromList(smlHandle->pBlockHash, pTableMeta->uid, TSDB_DEFAULT_PAYLOAD_SIZE, ret = getDataBlockFromList(smlHandle->pBlockHash, pTableMeta->uid, TSDB_DEFAULT_PAYLOAD_SIZE,
sizeof(SSubmitBlk), getTableInfo(pTableMeta).rowSize, pTableMeta, sizeof(SSubmitBlk), getTableInfo(pTableMeta).rowSize, pTableMeta,
...@@ -1714,15 +1715,15 @@ int32_t smlBindData(void *handle, SArray *tags, SArray *colsFormat, SHashObj *co ...@@ -1714,15 +1715,15 @@ int32_t smlBindData(void *handle, SArray *tags, SArray *colsFormat, SHashObj *co
kv = *p; kv = *p;
} }
if (kv->valueLen == 0) { if (kv->length == 0) {
MemRowAppend(&pBuf, NULL, 0, &param); MemRowAppend(&pBuf, NULL, 0, &param);
} else { } else {
int32_t colLen = pColSchema->bytes; int32_t colLen = pColSchema->bytes;
if (IS_VAR_DATA_TYPE(pColSchema->type)) { if (IS_VAR_DATA_TYPE(pColSchema->type)) {
colLen = kv->valueLen; colLen = kv->length;
} }
MemRowAppend(&pBuf, kv->value, colLen, &param); MemRowAppend(&pBuf, &(kv->value), colLen, &param);
} }
if (PRIMARYKEY_TIMESTAMP_COL_ID == pColSchema->colId) { if (PRIMARYKEY_TIMESTAMP_COL_ID == pColSchema->colId) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册