resolve more conflict
This commit is contained in:
parent
d076b7cec8
commit
a3f36045ab
|
@ -87,6 +87,22 @@ int tdGetSchemaEncodeSize(STSchema *pSchema);
|
|||
void * tdEncodeSchema(void *dst, STSchema *pSchema);
|
||||
STSchema *tdDecodeSchema(void **psrc);
|
||||
|
||||
static FORCE_INLINE int comparColId(const void *key1, const void *key2) {
|
||||
if (*(int16_t *)key1 > ((STColumn *)key2)->colId) {
|
||||
return 1;
|
||||
} else if (*(int16_t *)key1 < ((STColumn *)key2)->colId) {
|
||||
return -1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
static FORCE_INLINE STColumn *tdGetColOfID(STSchema *pSchema, int16_t colId) {
|
||||
void *ptr = bsearch(&colId, (void *)pSchema->columns, schemaNCols(pSchema), sizeof(STColumn), comparColId);
|
||||
if (ptr == NULL) return NULL;
|
||||
return (STColumn *)ptr;
|
||||
}
|
||||
|
||||
// ----------------- Data row structure
|
||||
|
||||
/* A data row, the format is like below:
|
||||
|
|
|
@ -251,28 +251,23 @@ int32_t tsdbGetTableTagVal(TsdbRepoT* repo, STableId* id, int32_t colId, int16_t
|
|||
STsdbMeta* pMeta = tsdbGetMeta(repo);
|
||||
STable* pTable = tsdbGetTableByUid(pMeta, id->uid);
|
||||
|
||||
*val = tdQueryTagByID(pTable->tagVal, colId, type);
|
||||
STSchema *pSchema = tsdbGetTableTagSchema(pMeta, pTable);
|
||||
STColumn *pCol = tdGetColOfID(pSchema, colId);
|
||||
if (pCol == NULL) {
|
||||
return -1; // No matched tag volumn
|
||||
}
|
||||
|
||||
*val = tdGetKVRowValOfCol(pTable->tagVal, colId);
|
||||
*type = pCol->type;
|
||||
|
||||
if (*val != NULL) {
|
||||
switch(*type) {
|
||||
case TSDB_DATA_TYPE_BINARY:
|
||||
case TSDB_DATA_TYPE_NCHAR: *bytes = varDataLen(*val); break;
|
||||
case TSDB_DATA_TYPE_NULL: *bytes = 0; break;
|
||||
default:
|
||||
*bytes = tDataTypeDesc[*type].nSize;break;
|
||||
if (IS_VAR_DATA_TYPE(*type)) {
|
||||
*bytes = varDataLen(*val);
|
||||
} else {
|
||||
*bytes = TYPE_BYTES[*type];
|
||||
}
|
||||
}
|
||||
|
||||
if (pCol == NULL) {
|
||||
return -1; // No matched tags. Maybe the modification of tags has not been done yet.
|
||||
}
|
||||
|
||||
char* d = tdGetKVRowValOfCol(pTable->tagVal, pCol->colId);
|
||||
//ASSERT((int8_t)tagtype == pCol->type)
|
||||
*val = d;
|
||||
*type = pCol->type;
|
||||
*bytes = pCol->bytes;
|
||||
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
@ -453,7 +453,7 @@ int tsdbWriteCompIdx(SRWHelper *pHelper) {
|
|||
pHelper->pBuffer = trealloc(pHelper->pBuffer, tsizeof(pHelper->pBuffer)*2);
|
||||
}
|
||||
buf = POINTER_SHIFT(pHelper->pBuffer, drift);
|
||||
buf = taosEncodeVariant32(buf, i);
|
||||
buf = taosEncodeVariantU32(buf, i);
|
||||
buf = tsdbEncodeSCompIdx(buf, pCompIdx);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue