From bc56d1196a9b17177df804b47be4cc3e753731d9 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Mon, 1 Apr 2024 18:06:07 +0800 Subject: [PATCH] more code --- source/common/src/tdataformat.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/source/common/src/tdataformat.c b/source/common/src/tdataformat.c index 991c17c5cc..7de685d9b1 100644 --- a/source/common/src/tdataformat.c +++ b/source/common/src/tdataformat.c @@ -1238,7 +1238,8 @@ int32_t tValueCompare(const SValue *tv1, const SValue *tv2) { T_COMPARE_SCALAR_VALUE(uint64_t, &tv1->val, &tv2->val); case TSDB_DATA_TYPE_GEOMETRY: case TSDB_DATA_TYPE_BINARY: { - return strcmp((const char *)tv1->pData, (const char *)tv2->pData); + int32_t ret = strncmp((const char *)tv1->pData, (const char *)tv2->pData, TMIN(tv1->nData, tv2->nData)); + return ret ? ret : (tv1->nData < tv2->nData ? -1 : (tv1->nData > tv2->nData ? 1 : 0)); } case TSDB_DATA_TYPE_NCHAR: { int32_t ret = tasoUcs4Compare((TdUcs4 *)tv1->pData, (TdUcs4 *)tv2->pData, @@ -1286,7 +1287,7 @@ int32_t tRowKeyCompare(const void *p1, const void *p2) { return 0; } -int32_t tRowKeyAssign(SRowKey *pDst, SRowKey* pSrc) { +int32_t tRowKeyAssign(SRowKey *pDst, SRowKey *pSrc) { pDst->ts = pSrc->ts; pDst->numOfPKs = pSrc->numOfPKs;