diff --git a/src/common/src/tdataformat.c b/src/common/src/tdataformat.c index ce781b2eec5f0d3fb1645fd4ad045a5ccf7bb719..8f4b23ec164eee5a5b9cad10567a96a4201483e2 100644 --- a/src/common/src/tdataformat.c +++ b/src/common/src/tdataformat.c @@ -50,7 +50,8 @@ int tdSchemaAddCol(STSchema *pSchema, int8_t type, int16_t colId, int32_t bytes) if (pSchema->numOfCols == 0) { colSetOffset(pCol, 0); } else { - colSetOffset(pCol, pSchema->columns[pSchema->numOfCols - 1].offset + TYPE_BYTES[type]); + STColumn *pTCol = pSchema->columns + pSchema->numOfCols - 1; + colSetOffset(pCol, pTCol->offset + TYPE_BYTES[pTCol->type]); } switch (type) { case TSDB_DATA_TYPE_BINARY: