diff --git a/source/dnode/vnode/src/tsdb/tsdbRead2.c b/source/dnode/vnode/src/tsdb/tsdbRead2.c index 76ec4da24c..1fb108ed7f 100644 --- a/source/dnode/vnode/src/tsdb/tsdbRead2.c +++ b/source/dnode/vnode/src/tsdb/tsdbRead2.c @@ -103,30 +103,10 @@ int32_t pkCompEx(SRowKey* p1, SRowKey* p2) { return 1; } - ASSERT(p1->numOfPKs == p2->numOfPKs); - if (p1->numOfPKs == 0) { return 0; } else { - if (IS_VAR_DATA_TYPE(p1->pks[0].type)) { - int32_t len = TMIN(p1->pks[0].nData, p2->pks[0].nData); - int32_t ret = strncmp((char*)p1->pks[0].pData, (char*)p2->pks[0].pData, len); - if (ret == 0) { - if (p1->pks[0].nData == p2->pks[0].nData) { - return 0; - } else { - return p1->pks[0].nData > p2->pks[0].nData ? 1 : -1; - } - } else { - return ret > 0 ? 1 : -1; - } - } else { - if (p1->pks[0].val == p2->pks[0].val) { - return 0; - } else { - return tValueCompare(&p1->pks[0], &p2->pks[0]); - } - } + return tRowKeyCompare(p1, p2); } } diff --git a/source/dnode/vnode/src/tsdb/tsdbReadUtil.c b/source/dnode/vnode/src/tsdb/tsdbReadUtil.c index 27b7f3edbe..1a62c824d7 100644 --- a/source/dnode/vnode/src/tsdb/tsdbReadUtil.c +++ b/source/dnode/vnode/src/tsdb/tsdbReadUtil.c @@ -191,6 +191,10 @@ int32_t initRowKey(SRowKey* pKey, int64_t ts, int32_t numOfPks, int32_t type, in terrno = TSDB_CODE_OUT_OF_MEMORY; return terrno; } + + if (!asc) { + pKey->numOfPKs = 2; + } } }