提交 7145bc5f 编写于 作者: Y yihaoDeng

[TD-4825]<feature> order by col after group-by

上级 2f37ebf6
......@@ -279,9 +279,15 @@ static void taosArrayQuicksortHelper(SArray *pArray, int low, int high, __ext_co
}
static void taosArrayQuickSort(SArray* pArray, __ext_compar_fn_t fn, const void *param) {
return taosArrayQuicksortHelper(pArray, 0, taosArrayGetSize(pArray) - 1, fn, param);
if (pArray->size <= 0) {
return;
}
taosArrayQuicksortHelper(pArray, 0, taosArrayGetSize(pArray) - 1, fn, param);
}
static void taosArrayInsertSort(SArray* pArray, __ext_compar_fn_t fn, const void *param) {
if (pArray->size <= 0) {
return;
}
for (int i = 1; i <= pArray->size - 1; ++i) {
for (int j = i; j > 0; --j) {
if (fn(taosArrayGetP(pArray, j), taosArrayGetP(pArray, j - 1), param) == -1) {
......@@ -294,9 +300,12 @@ static void taosArrayInsertSort(SArray* pArray, __ext_compar_fn_t fn, const void
}
}
}
return;
}
// order array<void *type>
void taosArraySortPWithExt(SArray* pArray, __ext_compar_fn_t fn, const void *param) {
return taosArrayGetSize(pArray) > 8 ?
taosArrayGetSize(pArray) > 8 ?
taosArrayQuickSort(pArray, fn, param) : taosArrayInsertSort(pArray, fn, param);
}
//TODO(yihaoDeng) order array<type>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册