提交 59462d35 编写于 作者: A Alex Duan

new ASSERT add tdiest.c and tcompression.c

上级 232c4f4a
......@@ -470,7 +470,7 @@ int32_t tsDecompressStringImp(const char *const input, int32_t compressedSize, c
// TODO: Take care here, we assumes little endian encoding.
int32_t tsCompressTimestampImp(const char *const input, const int32_t nelements, char *const output) {
int32_t _pos = 1;
assert(nelements >= 0);
ASSERTS(nelements >= 0, "nelements is negative");
if (nelements == 0) return 0;
......@@ -565,7 +565,7 @@ _exit_over:
}
int32_t tsDecompressTimestampImp(const char *const input, const int32_t nelements, char *const output) {
assert(nelements >= 0);
ASSERTS(nelements >= 0, "nelements is negative");
if (nelements == 0) return 0;
if (input[0] == 0) {
......@@ -629,7 +629,7 @@ int32_t tsDecompressTimestampImp(const char *const input, const int32_t nelement
}
} else {
assert(0);
ASSERT(0);
return -1;
}
}
......@@ -2146,7 +2146,7 @@ int32_t tsCompressTimestamp(void *pIn, int32_t nIn, int32_t nEle, void *pOut, in
int32_t len = tsCompressTimestampImp(pIn, nEle, pBuf);
return tsCompressStringImp(pBuf, len, pOut, nOut);
} else {
assert(0);
ASSERTS(0, "compress algo not one or two stage");
return -1;
}
}
......@@ -2159,7 +2159,7 @@ int32_t tsDecompressTimestamp(void *pIn, int32_t nIn, int32_t nEle, void *pOut,
if (tsDecompressStringImp(pIn, nIn, pBuf, nBuf) < 0) return -1;
return tsDecompressTimestampImp(pBuf, nEle, pOut);
} else {
assert(0);
ASSERTS(0, "compress algo invalid");
return -1;
}
}
......@@ -2180,7 +2180,7 @@ int32_t tsCompressFloat(void *pIn, int32_t nIn, int32_t nEle, void *pOut, int32_
int32_t len = tsCompressFloatImp(pIn, nEle, pBuf);
return tsCompressStringImp(pBuf, len, pOut, nOut);
} else {
assert(0);
ASSERTS(0, "compress algo invalid");
return -1;
}
#ifdef TD_TSZ
......@@ -2203,7 +2203,7 @@ int32_t tsDecompressFloat(void *pIn, int32_t nIn, int32_t nEle, void *pOut, int3
if (tsDecompressStringImp(pIn, nIn, pBuf, nBuf) < 0) return -1;
return tsDecompressFloatImp(pBuf, nEle, pOut);
} else {
assert(0);
ASSERTS(0, "compress algo invalid");
return -1;
}
#ifdef TD_TSZ
......@@ -2227,7 +2227,7 @@ int32_t tsCompressDouble(void *pIn, int32_t nIn, int32_t nEle, void *pOut, int32
int32_t len = tsCompressDoubleImp(pIn, nEle, pBuf);
return tsCompressStringImp(pBuf, len, pOut, nOut);
} else {
assert(0);
ASSERTS(0, "compress algo invalid");
return -1;
}
#ifdef TD_TSZ
......@@ -2250,7 +2250,7 @@ int32_t tsDecompressDouble(void *pIn, int32_t nIn, int32_t nEle, void *pOut, int
if (tsDecompressStringImp(pIn, nIn, pBuf, nBuf) < 0) return -1;
return tsDecompressDoubleImp(pBuf, nEle, pOut);
} else {
assert(0);
ASSERTS(0, "compress algo invalid");
return -1;
}
#ifdef TD_TSZ
......@@ -2281,7 +2281,7 @@ int32_t tsCompressBool(void *pIn, int32_t nIn, int32_t nEle, void *pOut, int32_t
}
return tsCompressStringImp(pBuf, len, pOut, nOut);
} else {
assert(0);
ASSERTS(0, "compress algo invalid");
return -1;
}
}
......@@ -2294,7 +2294,7 @@ int32_t tsDecompressBool(void *pIn, int32_t nIn, int32_t nEle, void *pOut, int32
if (tsDecompressStringImp(pIn, nIn, pBuf, nBuf) < 0) return -1;
return tsDecompressBoolImp(pBuf, nEle, pOut);
} else {
assert(0);
ASSERTS(0, "compress algo invalid");
return -1;
}
}
......@@ -2308,7 +2308,7 @@ int32_t tsCompressTinyint(void *pIn, int32_t nIn, int32_t nEle, void *pOut, int3
int32_t len = tsCompressINTImp(pIn, nEle, pBuf, TSDB_DATA_TYPE_TINYINT);
return tsCompressStringImp(pBuf, len, pOut, nOut);
} else {
assert(0);
ASSERTS(0, "compress algo invalid");
return -1;
}
}
......@@ -2321,7 +2321,7 @@ int32_t tsDecompressTinyint(void *pIn, int32_t nIn, int32_t nEle, void *pOut, in
if (tsDecompressStringImp(pIn, nIn, pBuf, nBuf) < 0) return -1;
return tsDecompressINTImp(pBuf, nEle, pOut, TSDB_DATA_TYPE_TINYINT);
} else {
assert(0);
ASSERTS(0, "compress algo invalid");
return -1;
}
}
......@@ -2335,7 +2335,7 @@ int32_t tsCompressSmallint(void *pIn, int32_t nIn, int32_t nEle, void *pOut, int
int32_t len = tsCompressINTImp(pIn, nEle, pBuf, TSDB_DATA_TYPE_SMALLINT);
return tsCompressStringImp(pBuf, len, pOut, nOut);
} else {
assert(0);
ASSERTS(0, "compress algo invalid");
return -1;
}
}
......@@ -2348,7 +2348,7 @@ int32_t tsDecompressSmallint(void *pIn, int32_t nIn, int32_t nEle, void *pOut, i
if (tsDecompressStringImp(pIn, nIn, pBuf, nBuf) < 0) return -1;
return tsDecompressINTImp(pBuf, nEle, pOut, TSDB_DATA_TYPE_SMALLINT);
} else {
assert(0);
ASSERTS(0, "compress algo invalid");
return -1;
}
}
......@@ -2362,7 +2362,7 @@ int32_t tsCompressInt(void *pIn, int32_t nIn, int32_t nEle, void *pOut, int32_t
int32_t len = tsCompressINTImp(pIn, nEle, pBuf, TSDB_DATA_TYPE_INT);
return tsCompressStringImp(pBuf, len, pOut, nOut);
} else {
assert(0);
ASSERTS(0, "compress algo invalid");
return -1;
}
}
......@@ -2375,7 +2375,7 @@ int32_t tsDecompressInt(void *pIn, int32_t nIn, int32_t nEle, void *pOut, int32_
if (tsDecompressStringImp(pIn, nIn, pBuf, nBuf) < 0) return -1;
return tsDecompressINTImp(pBuf, nEle, pOut, TSDB_DATA_TYPE_INT);
} else {
assert(0);
ASSERTS(0, "compress algo invalid");
return -1;
}
}
......@@ -2389,7 +2389,7 @@ int32_t tsCompressBigint(void *pIn, int32_t nIn, int32_t nEle, void *pOut, int32
int32_t len = tsCompressINTImp(pIn, nEle, pBuf, TSDB_DATA_TYPE_BIGINT);
return tsCompressStringImp(pBuf, len, pOut, nOut);
} else {
assert(0);
ASSERTS(0, "compress algo invalid");
return -1;
}
}
......@@ -2402,7 +2402,7 @@ int32_t tsDecompressBigint(void *pIn, int32_t nIn, int32_t nEle, void *pOut, int
if (tsDecompressStringImp(pIn, nIn, pBuf, nBuf) < 0) return -1;
return tsDecompressINTImp(pBuf, nEle, pOut, TSDB_DATA_TYPE_BIGINT);
} else {
assert(0);
ASSERTS(0, "compress algo invalid");
return -1;
}
}
......@@ -135,24 +135,24 @@ void tdigestCompress(TDigest *t) {
if (a->mean <= b->mean) {
mergeCentroid(&args, a);
assert(args.idx < t->size);
ASSERTS(args.idx < t->size, "idx over size");
i++;
} else {
mergeCentroid(&args, b);
assert(args.idx < t->size);
ASSERTS(args.idx < t->size, "idx over size");
j++;
}
}
while (i < num_unmerged) {
mergeCentroid(&args, &unmerged_centroids[i++]);
assert(args.idx < t->size);
ASSERTS(args.idx < t->size, "idx over size");
}
taosMemoryFree((void *)unmerged_centroids);
while (j < t->num_centroids) {
mergeCentroid(&args, &t->centroids[j++]);
assert(args.idx < t->size);
ASSERTS(args.idx < t->size, "idx over size");
}
if (t->total_weight > 0) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册