Merge remote-tracking branch 'origin/feature/query' into hotfix/crash
This commit is contained in:
commit
32acac11d9
|
@ -4514,7 +4514,7 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
|
||||||
if (pTagsSchema->type != TSDB_DATA_TYPE_BINARY && pTagsSchema->type != TSDB_DATA_TYPE_NCHAR) {
|
if (pTagsSchema->type != TSDB_DATA_TYPE_BINARY && pTagsSchema->type != TSDB_DATA_TYPE_NCHAR) {
|
||||||
len = tDataTypeDesc[pTagsSchema->type].nSize;
|
len = tDataTypeDesc[pTagsSchema->type].nSize;
|
||||||
} else {
|
} else {
|
||||||
len = varDataTLen(pUpdateMsg->data);
|
len = varDataTLen(pUpdateMsg->data + schemaLen);
|
||||||
}
|
}
|
||||||
|
|
||||||
pUpdateMsg->tagValLen = htonl(len); // length may be changed after dump data
|
pUpdateMsg->tagValLen = htonl(len); // length may be changed after dump data
|
||||||
|
|
|
@ -50,8 +50,8 @@ extern "C" {
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int8_t type; // Column type
|
int8_t type; // Column type
|
||||||
int16_t colId; // column ID
|
int16_t colId; // column ID
|
||||||
int32_t bytes; // column bytes
|
int16_t bytes; // column bytes
|
||||||
int32_t offset; // point offset in SDataRow after the header part
|
int16_t offset; // point offset in SDataRow after the header part
|
||||||
} STColumn;
|
} STColumn;
|
||||||
|
|
||||||
#define colType(col) ((col)->type)
|
#define colType(col) ((col)->type)
|
||||||
|
@ -116,7 +116,7 @@ typedef struct {
|
||||||
int tdInitTSchemaBuilder(STSchemaBuilder *pBuilder, int32_t version);
|
int tdInitTSchemaBuilder(STSchemaBuilder *pBuilder, int32_t version);
|
||||||
void tdDestroyTSchemaBuilder(STSchemaBuilder *pBuilder);
|
void tdDestroyTSchemaBuilder(STSchemaBuilder *pBuilder);
|
||||||
void tdResetTSchemaBuilder(STSchemaBuilder *pBuilder, int32_t version);
|
void tdResetTSchemaBuilder(STSchemaBuilder *pBuilder, int32_t version);
|
||||||
int tdAddColToSchema(STSchemaBuilder *pBuilder, int8_t type, int16_t colId, int32_t bytes);
|
int tdAddColToSchema(STSchemaBuilder *pBuilder, int8_t type, int16_t colId, int16_t bytes);
|
||||||
STSchema *tdGetSchemaFromBuilder(STSchemaBuilder *pBuilder);
|
STSchema *tdGetSchemaFromBuilder(STSchemaBuilder *pBuilder);
|
||||||
|
|
||||||
// ----------------- Data row structure
|
// ----------------- Data row structure
|
||||||
|
|
|
@ -43,7 +43,7 @@ int tdEncodeSchema(void **buf, STSchema *pSchema) {
|
||||||
STColumn *pCol = schemaColAt(pSchema, i);
|
STColumn *pCol = schemaColAt(pSchema, i);
|
||||||
tlen += taosEncodeFixedI8(buf, colType(pCol));
|
tlen += taosEncodeFixedI8(buf, colType(pCol));
|
||||||
tlen += taosEncodeFixedI16(buf, colColId(pCol));
|
tlen += taosEncodeFixedI16(buf, colColId(pCol));
|
||||||
tlen += taosEncodeFixedI32(buf, colBytes(pCol));
|
tlen += taosEncodeFixedI16(buf, colBytes(pCol));
|
||||||
}
|
}
|
||||||
|
|
||||||
return tlen;
|
return tlen;
|
||||||
|
@ -65,10 +65,10 @@ void *tdDecodeSchema(void *buf, STSchema **pRSchema) {
|
||||||
for (int i = 0; i < numOfCols; i++) {
|
for (int i = 0; i < numOfCols; i++) {
|
||||||
int8_t type = 0;
|
int8_t type = 0;
|
||||||
int16_t colId = 0;
|
int16_t colId = 0;
|
||||||
int32_t bytes = 0;
|
int16_t bytes = 0;
|
||||||
buf = taosDecodeFixedI8(buf, &type);
|
buf = taosDecodeFixedI8(buf, &type);
|
||||||
buf = taosDecodeFixedI16(buf, &colId);
|
buf = taosDecodeFixedI16(buf, &colId);
|
||||||
buf = taosDecodeFixedI32(buf, &bytes);
|
buf = taosDecodeFixedI16(buf, &bytes);
|
||||||
if (tdAddColToSchema(&schemaBuilder, type, colId, bytes) < 0) {
|
if (tdAddColToSchema(&schemaBuilder, type, colId, bytes) < 0) {
|
||||||
tdDestroyTSchemaBuilder(&schemaBuilder);
|
tdDestroyTSchemaBuilder(&schemaBuilder);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -105,7 +105,7 @@ void tdResetTSchemaBuilder(STSchemaBuilder *pBuilder, int32_t version) {
|
||||||
pBuilder->version = version;
|
pBuilder->version = version;
|
||||||
}
|
}
|
||||||
|
|
||||||
int tdAddColToSchema(STSchemaBuilder *pBuilder, int8_t type, int16_t colId, int32_t bytes) {
|
int tdAddColToSchema(STSchemaBuilder *pBuilder, int8_t type, int16_t colId, int16_t bytes) {
|
||||||
if (!isValidDataType(type)) return -1;
|
if (!isValidDataType(type)) return -1;
|
||||||
|
|
||||||
if (pBuilder->nCols >= pBuilder->tCols) {
|
if (pBuilder->nCols >= pBuilder->tCols) {
|
||||||
|
|
|
@ -283,8 +283,8 @@ int tsdbUpdateTagValue(TSDB_REPO_T *repo, SUpdateTableTagValMsg *pMsg) {
|
||||||
for(int32_t i = 0; i < pMsg->numOfTags; ++i) {
|
for(int32_t i = 0; i < pMsg->numOfTags; ++i) {
|
||||||
STColumn* pCol = (STColumn*) d;
|
STColumn* pCol = (STColumn*) d;
|
||||||
pCol->colId = htons(pCol->colId);
|
pCol->colId = htons(pCol->colId);
|
||||||
pCol->bytes = htonl(pCol->bytes);
|
pCol->bytes = htons(pCol->bytes);
|
||||||
assert(pCol->offset == 0);
|
pCol->offset = 0;
|
||||||
|
|
||||||
d += sizeof(STColumn);
|
d += sizeof(STColumn);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue