[TD-4394]fix core when select data after modify tag width
This commit is contained in:
parent
c8a42e1182
commit
800a112f2a
|
@ -117,7 +117,7 @@ typedef struct {
|
||||||
|
|
||||||
void tsdbClearTableCfg(STableCfg *config);
|
void tsdbClearTableCfg(STableCfg *config);
|
||||||
|
|
||||||
void *tsdbGetTableTagVal(const void *pTable, int32_t colId, int16_t type, int16_t bytes);
|
void *tsdbGetTableTagVal(const void *pTable, int32_t colId, int16_t type, int16_t* bytes);
|
||||||
char *tsdbGetTableName(void *pTable);
|
char *tsdbGetTableName(void *pTable);
|
||||||
|
|
||||||
#define TSDB_TABLEID(_table) ((STableId*) (_table))
|
#define TSDB_TABLEID(_table) ((STableId*) (_table))
|
||||||
|
|
|
@ -2819,7 +2819,7 @@ static void doSetTagValueInParam(void* pTable, int32_t tagColId, tVariant *tag,
|
||||||
val = tsdbGetTableName(pTable);
|
val = tsdbGetTableName(pTable);
|
||||||
assert(val != NULL);
|
assert(val != NULL);
|
||||||
} else {
|
} else {
|
||||||
val = tsdbGetTableTagVal(pTable, tagColId, type, bytes);
|
val = tsdbGetTableTagVal(pTable, tagColId, type, &bytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (val == NULL || isNull(val, type)) {
|
if (val == NULL || isNull(val, type)) {
|
||||||
|
@ -6011,7 +6011,7 @@ static SSDataBlock* doTagScan(void* param, bool* newgroup) {
|
||||||
if (pExprInfo->base.colInfo.colId == TSDB_TBNAME_COLUMN_INDEX) {
|
if (pExprInfo->base.colInfo.colId == TSDB_TBNAME_COLUMN_INDEX) {
|
||||||
data = tsdbGetTableName(item->pTable);
|
data = tsdbGetTableName(item->pTable);
|
||||||
} else {
|
} else {
|
||||||
data = tsdbGetTableTagVal(item->pTable, pExprInfo->base.colInfo.colId, type, bytes);
|
data = tsdbGetTableTagVal(item->pTable, pExprInfo->base.colInfo.colId, type, &bytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
doSetTagValueToResultBuf(output, data, type, bytes);
|
doSetTagValueToResultBuf(output, data, type, bytes);
|
||||||
|
@ -6050,7 +6050,7 @@ static SSDataBlock* doTagScan(void* param, bool* newgroup) {
|
||||||
if (pExprInfo[j].base.colInfo.colId == TSDB_TBNAME_COLUMN_INDEX) {
|
if (pExprInfo[j].base.colInfo.colId == TSDB_TBNAME_COLUMN_INDEX) {
|
||||||
data = tsdbGetTableName(item->pTable);
|
data = tsdbGetTableName(item->pTable);
|
||||||
} else {
|
} else {
|
||||||
data = tsdbGetTableTagVal(item->pTable, pExprInfo[j].base.colInfo.colId, type, bytes);
|
data = tsdbGetTableTagVal(item->pTable, pExprInfo[j].base.colInfo.colId, type, &bytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
dst = pColInfo->pData + count * pExprInfo[j].base.resBytes;
|
dst = pColInfo->pData + count * pExprInfo[j].base.resBytes;
|
||||||
|
|
|
@ -201,7 +201,7 @@ _err:
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void *tsdbGetTableTagVal(const void* pTable, int32_t colId, int16_t type, int16_t bytes) {
|
void *tsdbGetTableTagVal(const void* pTable, int32_t colId, int16_t type, int16_t* bytes) {
|
||||||
// TODO: this function should be changed also
|
// TODO: this function should be changed also
|
||||||
|
|
||||||
STSchema *pSchema = tsdbGetTableTagSchema((STable*) pTable);
|
STSchema *pSchema = tsdbGetTableTagSchema((STable*) pTable);
|
||||||
|
@ -211,8 +211,16 @@ void *tsdbGetTableTagVal(const void* pTable, int32_t colId, int16_t type, int16_
|
||||||
}
|
}
|
||||||
|
|
||||||
char *val = tdGetKVRowValOfCol(((STable*)pTable)->tagVal, colId);
|
char *val = tdGetKVRowValOfCol(((STable*)pTable)->tagVal, colId);
|
||||||
assert(type == pCol->type && bytes == pCol->bytes);
|
assert(type == pCol->type &&
|
||||||
|
// if var data type,bytes may >= col bytes,in case of tag width has beed modified
|
||||||
|
((IS_VAR_DATA_TYPE(type) && *bytes >= pCol->bytes) ||
|
||||||
|
// otherwise, bytes must be equal to colomn bytes
|
||||||
|
(!IS_VAR_DATA_TYPE(type) && *bytes == pCol->bytes)));
|
||||||
|
|
||||||
|
// in case tag width has been modified bigger but vnode has not been notified
|
||||||
|
if (val != NULL && IS_VAR_DATA_TYPE(type) && *bytes > pCol->bytes) {
|
||||||
|
*bytes = pCol->bytes;
|
||||||
|
}
|
||||||
// if (val != NULL && IS_VAR_DATA_TYPE(type)) {
|
// if (val != NULL && IS_VAR_DATA_TYPE(type)) {
|
||||||
// assert(varDataLen(val) < pCol->bytes);
|
// assert(varDataLen(val) < pCol->bytes);
|
||||||
// }
|
// }
|
||||||
|
|
Loading…
Reference in New Issue