diff --git a/src/client/src/tscGlobalmerge.c b/src/client/src/tscGlobalmerge.c index 2ca99e072791791a9ec70b522a9fb5bc2334a467..db25a0b09c9b88855bbaa44ebaa9340f4f5264b3 100644 --- a/src/client/src/tscGlobalmerge.c +++ b/src/client/src/tscGlobalmerge.c @@ -233,7 +233,7 @@ static int32_t tscFlushTmpBufferImpl(tExtMemBuffer *pMemoryBuf, tOrderDescriptor // sort before flush to disk, the data must be consecutively put on tFilePage. if (pDesc->orderInfo.numOfCols > 0) { - tColDataQSort(pDesc, (int32_t)pPage->num, 0, (int32_t)pPage->num - 1, pPage->data, orderType); + tColDataMergeSort(pDesc, (int32_t)pPage->num, 0, (int32_t)pPage->num - 1, pPage->data, orderType); } #ifdef _DEBUG_VIEW @@ -364,7 +364,7 @@ static int32_t createOrderDescriptor(tOrderDescriptor **pOrderDesc, SQueryInfo* SExprInfo* pExprInfo = tscExprGet(pQueryInfo, j); int32_t functionId = pExprInfo->base.functionId; - if (pColIndex->colId == pExprInfo->base.colInfo.colId && (functionId == TSDB_FUNC_PRJ || functionId == TSDB_FUNC_TAG)) { + if (pColIndex->colId == pExprInfo->base.colInfo.colId && (functionId == TSDB_FUNC_PRJ || functionId == TSDB_FUNC_TAG || functionId == TSDB_FUNC_TAGPRJ)) { orderColIndexList[i] = j; break; } diff --git a/src/client/src/tscUtil.c b/src/client/src/tscUtil.c index 50b9a8fd7eea703dffe34f8ad5eb204b310f0d7e..5489f3ba67d87a9edd73961bcae1440698fe6b4f 100644 --- a/src/client/src/tscUtil.c +++ b/src/client/src/tscUtil.c @@ -268,10 +268,6 @@ bool tscIsProjectionQueryOnSTable(SQueryInfo* pQueryInfo, int32_t tableIndex) { functionId != TSDB_FUNC_TS && functionId != TSDB_FUNC_ARITHM && functionId != TSDB_FUNC_TS_COMP && - functionId != TSDB_FUNC_DIFF && - functionId != TSDB_FUNC_DERIVATIVE && - functionId != TSDB_FUNC_MAVG && - functionId != TSDB_FUNC_CSUM && functionId != TSDB_FUNC_TS_DUMMY && functionId != TSDB_FUNC_TID_TAG && functionId != TSDB_FUNC_CEIL && diff --git a/src/query/inc/qExtbuffer.h b/src/query/inc/qExtbuffer.h index 6728809c4f685a9afd0306abef88e9cbe2f63256..ccdfd5c05994b71bd911c3a66d02dc1ffa58a474 100644 --- a/src/query/inc/qExtbuffer.h +++ b/src/query/inc/qExtbuffer.h @@ -236,6 +236,9 @@ typedef int (*__col_compar_fn_t)(tOrderDescriptor *, int32_t numOfRows, int32_t void tColDataQSort(tOrderDescriptor *, int32_t numOfRows, int32_t start, int32_t end, char *data, int32_t orderType); +void tColDataMergeSort(tOrderDescriptor *, int32_t numOfRows, int32_t start, int32_t end, char *data, int32_t orderType); + + void taoscQSort(void** pCols, SSchema* pSchema, int32_t numOfCols, int32_t numOfRows, int32_t index, __compar_fn_t compareFn); int32_t compare_sa(tOrderDescriptor *, int32_t numOfRows, int32_t idx1, int32_t idx2, char *data); diff --git a/src/query/src/qAggMain.c b/src/query/src/qAggMain.c index 7545823d7d5c5b2140a7504bbe43041df53bb9f5..f26b3cda1a56df698db0db1465bd6116726ca0ae 100644 --- a/src/query/src/qAggMain.c +++ b/src/query/src/qAggMain.c @@ -196,6 +196,14 @@ typedef struct { char *taglists; } SSampleFuncInfo; +typedef struct { + bool valueAssigned; + union { + int64_t i64Prev; + double d64Prev; + }; +} SDiffFuncInfo; + int32_t getResultDataInfo(int32_t dataType, int32_t dataBytes, int32_t functionId, int32_t param, int16_t *type, int32_t *bytes, int32_t *interBytes, int16_t extLength, bool isSuperTable, SUdfInfo* pUdfInfo) { if (!isValidDataType(dataType)) { @@ -214,10 +222,13 @@ int32_t getResultDataInfo(int32_t dataType, int32_t dataBytes, int32_t functionI if (functionId == TSDB_FUNC_INTERP) { *interBytes = sizeof(SInterpInfoDetail); + } else if (functionId == TSDB_FUNC_DIFF) { + *interBytes = sizeof(SDiffFuncInfo); } else { *interBytes = 0; } + return TSDB_CODE_SUCCESS; } @@ -2984,18 +2995,16 @@ static void full_copy_function(SQLFunctionCtx *pCtx) { } } -enum { - INITIAL_VALUE_NOT_ASSIGNED = 0, -}; static bool diff_function_setup(SQLFunctionCtx *pCtx, SResultRowCellInfo* pResInfo) { if (!function_setup(pCtx, pResInfo)) { return false; } - // diff function require the value is set to -1 - pCtx->param[1].nType = INITIAL_VALUE_NOT_ASSIGNED; - return false; + SDiffFuncInfo* pDiffInfo = GET_ROWCELL_INTERBUF(pResInfo); + pDiffInfo->valueAssigned = false; + pDiffInfo->i64Prev = 0; + return true; } static bool deriv_function_setup(SQLFunctionCtx *pCtx, SResultRowCellInfo* pResultInfo) { @@ -3201,22 +3210,14 @@ static void deriv_function(SQLFunctionCtx *pCtx) { GET_RES_INFO(pCtx)->numOfRes += notNullElems; } -#define DIFF_IMPL(ctx, d, type) \ - do { \ - if ((ctx)->param[1].nType == INITIAL_VALUE_NOT_ASSIGNED) { \ - (ctx)->param[1].nType = (ctx)->inputType; \ - *(type *)&(ctx)->param[1].i64 = *(type *)(d); \ - } else { \ - *(type *)(ctx)->pOutput = *(type *)(d) - (*(type *)(&(ctx)->param[1].i64)); \ - *(type *)(&(ctx)->param[1].i64) = *(type *)(d); \ - *(int64_t *)(ctx)->ptsOutputBuf = GET_TS_DATA(ctx, index); \ - } \ - } while (0); // TODO difference in date column static void diff_function(SQLFunctionCtx *pCtx) { + SResultRowCellInfo *pResInfo = GET_RES_INFO(pCtx); + SDiffFuncInfo *pDiffInfo = GET_ROWCELL_INTERBUF(pResInfo); + void *data = GET_INPUT_DATA_LIST(pCtx); - bool isFirstBlock = (pCtx->param[1].nType == INITIAL_VALUE_NOT_ASSIGNED); + bool isFirstBlock = (pDiffInfo->valueAssigned == false); int32_t notNullElems = 0; @@ -3236,15 +3237,15 @@ static void diff_function(SQLFunctionCtx *pCtx) { continue; } - if (pCtx->param[1].nType != INITIAL_VALUE_NOT_ASSIGNED) { // initial value is not set yet - *pOutput = (int32_t)(pData[i] - pCtx->param[1].i64); // direct previous may be null + if (pDiffInfo->valueAssigned) { + *pOutput = (int32_t)(pData[i] - pDiffInfo->i64Prev); // direct previous may be null *pTimestamp = (tsList != NULL)? tsList[i]:0; pOutput += 1; pTimestamp += 1; } - pCtx->param[1].i64 = pData[i]; - pCtx->param[1].nType = pCtx->inputType; + pDiffInfo->i64Prev = pData[i]; + pDiffInfo->valueAssigned = true; notNullElems++; } break; @@ -3258,15 +3259,15 @@ static void diff_function(SQLFunctionCtx *pCtx) { continue; } - if (pCtx->param[1].nType != INITIAL_VALUE_NOT_ASSIGNED) { // initial value is not set yet - *pOutput = pData[i] - pCtx->param[1].i64; // direct previous may be null + if (pDiffInfo->valueAssigned) { + *pOutput = pData[i] - pDiffInfo->i64Prev; // direct previous may be null *pTimestamp = (tsList != NULL)? tsList[i]:0; pOutput += 1; pTimestamp += 1; } - pCtx->param[1].i64 = pData[i]; - pCtx->param[1].nType = pCtx->inputType; + pDiffInfo->i64Prev = pData[i]; + pDiffInfo->valueAssigned = true; notNullElems++; } break; @@ -3280,15 +3281,15 @@ static void diff_function(SQLFunctionCtx *pCtx) { continue; } - if (pCtx->param[1].nType != INITIAL_VALUE_NOT_ASSIGNED) { // initial value is not set yet - SET_DOUBLE_VAL(pOutput, pData[i] - pCtx->param[1].dKey); // direct previous may be null + if (pDiffInfo->valueAssigned) { // initial value is not set yet + SET_DOUBLE_VAL(pOutput, pData[i] - pDiffInfo->d64Prev); // direct previous may be null *pTimestamp = (tsList != NULL)? tsList[i]:0; pOutput += 1; pTimestamp += 1; } - pCtx->param[1].dKey = pData[i]; - pCtx->param[1].nType = pCtx->inputType; + pDiffInfo->d64Prev = pData[i]; + pDiffInfo->valueAssigned = true; notNullElems++; } break; @@ -3302,15 +3303,15 @@ static void diff_function(SQLFunctionCtx *pCtx) { continue; } - if (pCtx->param[1].nType != INITIAL_VALUE_NOT_ASSIGNED) { // initial value is not set yet - *pOutput = (float)(pData[i] - pCtx->param[1].dKey); // direct previous may be null + if (pDiffInfo->valueAssigned) { // initial value is not set yet + *pOutput = (float)(pData[i] - pDiffInfo->d64Prev); // direct previous may be null *pTimestamp = (tsList != NULL)? tsList[i]:0; pOutput += 1; pTimestamp += 1; } - pCtx->param[1].dKey = pData[i]; - pCtx->param[1].nType = pCtx->inputType; + pDiffInfo->d64Prev = pData[i]; + pDiffInfo->valueAssigned = true; notNullElems++; } break; @@ -3324,15 +3325,15 @@ static void diff_function(SQLFunctionCtx *pCtx) { continue; } - if (pCtx->param[1].nType != INITIAL_VALUE_NOT_ASSIGNED) { // initial value is not set yet - *pOutput = (int16_t)(pData[i] - pCtx->param[1].i64); // direct previous may be null + if (pDiffInfo->valueAssigned) { // initial value is not set yet + *pOutput = (int16_t)(pData[i] - pDiffInfo->i64Prev); // direct previous may be null *pTimestamp = (tsList != NULL)? tsList[i]:0; pOutput += 1; pTimestamp += 1; } - pCtx->param[1].i64 = pData[i]; - pCtx->param[1].nType = pCtx->inputType; + pDiffInfo->i64Prev = pData[i]; + pDiffInfo->valueAssigned = true; notNullElems++; } break; @@ -3347,15 +3348,15 @@ static void diff_function(SQLFunctionCtx *pCtx) { continue; } - if (pCtx->param[1].nType != INITIAL_VALUE_NOT_ASSIGNED) { // initial value is not set yet - *pOutput = (int8_t)(pData[i] - pCtx->param[1].i64); // direct previous may be null + if (pDiffInfo->valueAssigned) { // initial value is not set yet + *pOutput = (int8_t)(pData[i] - pDiffInfo->i64Prev); // direct previous may be null *pTimestamp = (tsList != NULL)? tsList[i]:0; pOutput += 1; pTimestamp += 1; } - pCtx->param[1].i64 = pData[i]; - pCtx->param[1].nType = pCtx->inputType; + pDiffInfo->i64Prev = pData[i]; + pDiffInfo->valueAssigned = true; notNullElems++; } break; @@ -3365,7 +3366,7 @@ static void diff_function(SQLFunctionCtx *pCtx) { } // initial value is not set yet - if (pCtx->param[1].nType == INITIAL_VALUE_NOT_ASSIGNED || notNullElems <= 0) { + if (!pDiffInfo->valueAssigned || notNullElems <= 0) { /* * 1. current block and blocks before are full of null * 2. current block may be null value diff --git a/src/query/src/qExtbuffer.c b/src/query/src/qExtbuffer.c index 45b1f0c5534bea73502d74a758b88b1983bfc4b8..ef4b56dc877ca75fe79ac5a345e99e0a3717eff5 100644 --- a/src/query/src/qExtbuffer.c +++ b/src/query/src/qExtbuffer.c @@ -641,6 +641,89 @@ static UNUSED_FUNC void tRowModelDisplay(tOrderDescriptor *pDescriptor, int32_t printf("\n"); } +static void mergeSortIndicesByOrderColumns(tOrderDescriptor *pDescriptor, int32_t numOfRows, int32_t start, int32_t end, char *data, + int32_t orderType, __col_compar_fn_t compareFn, int32_t* indices, int32_t* aux) { + if (end <= start) { + return; + } + + + int32_t mid = start + (end-start)/2; + mergeSortIndicesByOrderColumns(pDescriptor, numOfRows, start, mid, data, orderType, compareFn, indices, aux); + mergeSortIndicesByOrderColumns(pDescriptor, numOfRows, mid+1, end, data, orderType, compareFn, indices, aux); + int32_t left = start; + int32_t right = mid + 1; + int32_t k; + for (k = start; k <= end; ++k) { + if (left == mid+1) { + aux[k] = indices[right]; + ++right; + } else if (right == end+1) { + aux[k] = indices[left]; + ++left; + } else { + int32_t ret = compareFn(pDescriptor, numOfRows, indices[left], indices[right], data); + if (ret <= 0) { + aux[k] = indices[left]; + ++left; + } else { + aux[k] = indices[right]; + ++right; + } + } + } + + for (k = start; k <= end; ++k) { + indices[k] = aux[k]; + } +} + +static void columnwiseMergeSortImpl(tOrderDescriptor *pDescriptor, int32_t numOfRows, int32_t start, int32_t end, char* data, + int32_t orderType, __col_compar_fn_t compareFn) { + int32_t* indices = malloc(numOfRows * sizeof(int32_t)); + int32_t* aux = malloc(numOfRows * sizeof(int32_t)); + + for (int32_t i = 0; i < numOfRows; ++i) { + indices[i] = i; + } + + mergeSortIndicesByOrderColumns(pDescriptor, numOfRows, 0, numOfRows-1, data, orderType, compareFn, indices, aux); + + int32_t numOfCols = pDescriptor->pColumnModel->numOfCols; + + int32_t prevLength = 0; + char* p = NULL; + + for(int32_t i = 0; i < numOfCols; ++i) { + int16_t colOffset = getColumnModelOffset(pDescriptor->pColumnModel, i); + int32_t colBytes = pDescriptor->pColumnModel->pFields[i].field.bytes; + // make sure memory buffer is enough + if (prevLength < colBytes) { + char *tmp = realloc(p, colBytes * numOfRows); + assert(tmp); + + p = tmp; + prevLength = colBytes; + } + + char* colData = data + colOffset * numOfRows; + memcpy(p, colData, colBytes * numOfRows); + + for(int32_t j = 0; j < numOfRows; ++j){ + char* dest = colData + colBytes * j; + + int32_t newPos = indices[j]; + char* src = p + (newPos * colBytes); + memcpy(dest, src, colBytes); + } + + } + + tfree(p); + tfree(aux); + tfree(indices); +} + static void columnwiseQSortImpl(tOrderDescriptor *pDescriptor, int32_t numOfRows, int32_t start, int32_t end, char *data, int32_t orderType, __col_compar_fn_t compareFn, void* buf) { #ifdef _DEBUG_VIEW @@ -742,9 +825,9 @@ static void columnwiseQSortImpl(tOrderDescriptor *pDescriptor, int32_t numOfRows } } -void tColDataQSort(tOrderDescriptor *pDescriptor, int32_t numOfRows, int32_t start, int32_t end, char *data, int32_t order) { +void tColDataQSort(tOrderDescriptor *pDescriptor, int32_t numOfRows, int32_t start, int32_t end, char *data, int32_t orderType) { // short array sort, incur another sort procedure instead of quick sort process - __col_compar_fn_t compareFn = (order == TSDB_ORDER_ASC) ? compare_sa : compare_sd; + __col_compar_fn_t compareFn = (orderType == TSDB_ORDER_ASC) ? compare_sa : compare_sd; SColumnModel* pModel = pDescriptor->pColumnModel; @@ -762,12 +845,40 @@ void tColDataQSort(tOrderDescriptor *pDescriptor, int32_t numOfRows, int32_t sta if (end - start + 1 <= 8) { tColDataInsertSort(pDescriptor, numOfRows, start, end, data, compareFn, buf); } else { - columnwiseQSortImpl(pDescriptor, numOfRows, start, end, data, order, compareFn, buf); + columnwiseQSortImpl(pDescriptor, numOfRows, start, end, data, orderType, compareFn, buf); } free(buf); } +void tColDataMergeSort(tOrderDescriptor *pDescriptor, int32_t numOfRows, int32_t start, int32_t end, char *data, int32_t orderType) { + // short array sort, incur another sort procedure instead of quick sort process + __col_compar_fn_t compareFn = (orderType == TSDB_ORDER_ASC) ? compare_sa : compare_sd; + + SColumnModel* pModel = pDescriptor->pColumnModel; + + size_t width = 0; + for(int32_t i = 0; i < pModel->numOfCols; ++i) { + SSchema1* pSchema = &pModel->pFields[i].field; + if (width < pSchema->bytes) { + width = pSchema->bytes; + } + } + + char* buf = malloc(width); + assert(width > 0 && buf != NULL); + + if (end - start + 1 <= 8) { + tColDataInsertSort(pDescriptor, numOfRows, start, end, data, compareFn, buf); + } else { + columnwiseMergeSortImpl(pDescriptor, numOfRows, start, end, data, orderType, compareFn); + } + + free(buf); +} + + + /* * deep copy of sschema */ diff --git a/tests/script/fullGeneralSuite.sim b/tests/script/fullGeneralSuite.sim index a2b3978ad7fd6c6f2b4adf9f62b9edb4fed2a9e5..a5d8216de1d537843bef42fbf3752a45e899b5c3 100644 --- a/tests/script/fullGeneralSuite.sim +++ b/tests/script/fullGeneralSuite.sim @@ -38,6 +38,7 @@ run general/compute/stddev.sim run general/compute/sum.sim run general/compute/top.sim run general/compute/block_dist.sim +run general/compute/table_group.sim run general/db/alter_option.sim run general/db/alter_tables_d2.sim run general/db/alter_tables_v1.sim diff --git a/tests/script/general/compute/table_group.sim b/tests/script/general/compute/table_group.sim new file mode 100644 index 0000000000000000000000000000000000000000..cbce7963c3ede6688a2a6d1d0934fa6dfbc7f25b --- /dev/null +++ b/tests/script/general/compute/table_group.sim @@ -0,0 +1,2485 @@ +system sh/stop_dnodes.sh + +system sh/deploy.sh -n dnode1 -i 1 +system sh/cfg.sh -n dnode1 -c walLevel -v 1 +system sh/cfg.sh -n dnode1 -c minRows -v 10 +system sh/exec.sh -n dnode1 -s start +sleep 200 +sql connect + +$db = m_db_tbg_limit +$tb = ct +$mt = st + +sql drop database $db -x step1 +step1: +sql create database $db +sql use $db +sql create table $mt ( ts timestamp, f1 int, f2 int ) tags(t int) + +$tb1 = ct1 +$tb2 = ct2 +$tb3 = ct3 +$tbnum = 3 +$rownum = 10 + +$x = 0 +while $x < $rownum + $i = 1 + while $i <= $tbnum + $tbi = $tb . $i + $inc = $x * 60 + $inc1 = $inc + $i + $ms = 1601481600000 + $inc1 + $v1 = $x * 10 + $v = $v1 + $i + sql insert into $tbi using $mt tags( $i ) values ( $ms , $v , $v ) + $i = $i + 1 + endw + $x = $x + 1 +endw + +system sh/exec.sh -n dnode1 -s stop -x SIGINT +sleep 500 +system sh/exec.sh -n dnode1 -s start +sleep 200 +sql connect +sql use $db + +$x = 0 +while $x < $rownum + $i = 1 + while $i <= $tbnum + $tbi = $tb . $i + $inc = $x * 60 + $inc1 = $inc + $i + $ms = 1601481700000 + $inc1 + $v1 = $x * 10 + $temp = $rownum * 10 + $v1 = $v1 + $temp + $v = $v1 + $i + sql insert into $tbi using $mt tags( $i ) values ( $ms , $v , $v ) + $i = $i + 1 + endw + $x = $x + 1 +endw + +system sh/exec.sh -n dnode1 -s stop -x SIGINT +sleep 500 +system sh/exec.sh -n dnode1 -s start +sql connect +sql use $db + +print execute sql select csum(f1) from st group by tbname + +sql select csum(f1) from st group by tbname + +if $rows != 60 then + return -1 +endi +if $data00 != @20-10-01 00:00:00.001@ then + return -1 +endi +if $data01 != @1@ then + return -1 +endi +if $data02 != @ct1@ then + return -1 +endi +if $data10 != @20-10-01 00:00:00.061@ then + return -1 +endi +if $data11 != @12@ then + return -1 +endi +if $data12 != @ct1@ then + return -1 +endi +if $data20 != @20-10-01 00:00:00.121@ then + return -1 +endi +if $data21 != @33@ then + return -1 +endi +if $data22 != @ct1@ then + return -1 +endi +if $data30 != @20-10-01 00:00:00.181@ then + return -1 +endi +if $data31 != @64@ then + return -1 +endi +if $data32 != @ct1@ then + return -1 +endi +if $data40 != @20-10-01 00:00:00.241@ then + return -1 +endi +if $data41 != @105@ then + return -1 +endi +if $data42 != @ct1@ then + return -1 +endi +if $data50 != @20-10-01 00:00:00.301@ then + return -1 +endi +if $data51 != @156@ then + return -1 +endi +if $data52 != @ct1@ then + return -1 +endi +if $data60 != @20-10-01 00:00:00.361@ then + return -1 +endi +if $data61 != @217@ then + return -1 +endi +if $data62 != @ct1@ then + return -1 +endi +if $data70 != @20-10-01 00:00:00.421@ then + return -1 +endi +if $data71 != @288@ then + return -1 +endi +if $data72 != @ct1@ then + return -1 +endi +if $data80 != @20-10-01 00:00:00.481@ then + return -1 +endi +if $data81 != @369@ then + return -1 +endi +if $data82 != @ct1@ then + return -1 +endi +if $data90 != @20-10-01 00:00:00.541@ then + return -1 +endi +if $data91 != @460@ then + return -1 +endi +if $data92 != @ct1@ then + return -1 +endi +print execute sql select diff(f1) from st group by tbname + +sql select diff(f1) from st group by tbname + +if $rows != 57 then + return -1 +endi +if $data00 != @20-10-01 00:00:00.061@ then + return -1 +endi +if $data01 != @10@ then + return -1 +endi +if $data02 != @ct1@ then + return -1 +endi +if $data10 != @20-10-01 00:00:00.121@ then + return -1 +endi +if $data11 != @10@ then + return -1 +endi +if $data12 != @ct1@ then + return -1 +endi +if $data20 != @20-10-01 00:00:00.181@ then + return -1 +endi +if $data21 != @10@ then + return -1 +endi +if $data22 != @ct1@ then + return -1 +endi +if $data30 != @20-10-01 00:00:00.241@ then + return -1 +endi +if $data31 != @10@ then + return -1 +endi +if $data32 != @ct1@ then + return -1 +endi +if $data40 != @20-10-01 00:00:00.301@ then + return -1 +endi +if $data41 != @10@ then + return -1 +endi +if $data42 != @ct1@ then + return -1 +endi +if $data50 != @20-10-01 00:00:00.361@ then + return -1 +endi +if $data51 != @10@ then + return -1 +endi +if $data52 != @ct1@ then + return -1 +endi +if $data60 != @20-10-01 00:00:00.421@ then + return -1 +endi +if $data61 != @10@ then + return -1 +endi +if $data62 != @ct1@ then + return -1 +endi +if $data70 != @20-10-01 00:00:00.481@ then + return -1 +endi +if $data71 != @10@ then + return -1 +endi +if $data72 != @ct1@ then + return -1 +endi +if $data80 != @20-10-01 00:00:00.541@ then + return -1 +endi +if $data81 != @10@ then + return -1 +endi +if $data82 != @ct1@ then + return -1 +endi +if $data90 != @20-10-01 00:01:40.001@ then + return -1 +endi +if $data91 != @10@ then + return -1 +endi +if $data92 != @ct1@ then + return -1 +endi +print execute sql select derivative(f1, 1s, 0) from st group by tbname + +sql select derivative(f1, 1s, 0) from st group by tbname + +if $rows != 57 then + return -1 +endi +if $data00 != @20-10-01 00:00:00.061@ then + return -1 +endi +if $data01 != @166.666666667@ then + return -1 +endi +if $data02 != @ct1@ then + return -1 +endi +if $data10 != @20-10-01 00:00:00.121@ then + return -1 +endi +if $data11 != @166.666666667@ then + return -1 +endi +if $data12 != @ct1@ then + return -1 +endi +if $data20 != @20-10-01 00:00:00.181@ then + return -1 +endi +if $data21 != @166.666666667@ then + return -1 +endi +if $data22 != @ct1@ then + return -1 +endi +if $data30 != @20-10-01 00:00:00.241@ then + return -1 +endi +if $data31 != @166.666666667@ then + return -1 +endi +if $data32 != @ct1@ then + return -1 +endi +if $data40 != @20-10-01 00:00:00.301@ then + return -1 +endi +if $data41 != @166.666666667@ then + return -1 +endi +if $data42 != @ct1@ then + return -1 +endi +if $data50 != @20-10-01 00:00:00.361@ then + return -1 +endi +if $data51 != @166.666666667@ then + return -1 +endi +if $data52 != @ct1@ then + return -1 +endi +if $data60 != @20-10-01 00:00:00.421@ then + return -1 +endi +if $data61 != @166.666666667@ then + return -1 +endi +if $data62 != @ct1@ then + return -1 +endi +if $data70 != @20-10-01 00:00:00.481@ then + return -1 +endi +if $data71 != @166.666666667@ then + return -1 +endi +if $data72 != @ct1@ then + return -1 +endi +if $data80 != @20-10-01 00:00:00.541@ then + return -1 +endi +if $data81 != @166.666666667@ then + return -1 +endi +if $data82 != @ct1@ then + return -1 +endi +if $data90 != @20-10-01 00:01:40.001@ then + return -1 +endi +if $data91 != @0.100542932@ then + return -1 +endi +if $data92 != @ct1@ then + return -1 +endi +print execute sql select mavg(f1,2) from st group by tbname + +sql select mavg(f1,2) from st group by tbname + +if $rows != 57 then + return -1 +endi +if $data00 != @20-10-01 00:00:00.061@ then + return -1 +endi +if $data01 != @6.000000000@ then + return -1 +endi +if $data02 != @ct1@ then + return -1 +endi +if $data10 != @20-10-01 00:00:00.121@ then + return -1 +endi +if $data11 != @16.000000000@ then + return -1 +endi +if $data12 != @ct1@ then + return -1 +endi +if $data20 != @20-10-01 00:00:00.181@ then + return -1 +endi +if $data21 != @26.000000000@ then + return -1 +endi +if $data22 != @ct1@ then + return -1 +endi +if $data30 != @20-10-01 00:00:00.241@ then + return -1 +endi +if $data31 != @36.000000000@ then + return -1 +endi +if $data32 != @ct1@ then + return -1 +endi +if $data40 != @20-10-01 00:00:00.301@ then + return -1 +endi +if $data41 != @46.000000000@ then + return -1 +endi +if $data42 != @ct1@ then + return -1 +endi +if $data50 != @20-10-01 00:00:00.361@ then + return -1 +endi +if $data51 != @56.000000000@ then + return -1 +endi +if $data52 != @ct1@ then + return -1 +endi +if $data60 != @20-10-01 00:00:00.421@ then + return -1 +endi +if $data61 != @66.000000000@ then + return -1 +endi +if $data62 != @ct1@ then + return -1 +endi +if $data70 != @20-10-01 00:00:00.481@ then + return -1 +endi +if $data71 != @76.000000000@ then + return -1 +endi +if $data72 != @ct1@ then + return -1 +endi +if $data80 != @20-10-01 00:00:00.541@ then + return -1 +endi +if $data81 != @86.000000000@ then + return -1 +endi +if $data82 != @ct1@ then + return -1 +endi +if $data90 != @20-10-01 00:01:40.001@ then + return -1 +endi +if $data91 != @96.000000000@ then + return -1 +endi +if $data92 != @ct1@ then + return -1 +endi +print execute sql select csum(f1),t from st group by tbname + +sql select csum(f1),t from st group by tbname + +if $rows != 60 then + return -1 +endi +if $data00 != @20-10-01 00:00:00.001@ then + return -1 +endi +if $data01 != @1@ then + return -1 +endi +if $data02 != @1@ then + return -1 +endi +if $data03 != @ct1@ then + return -1 +endi +if $data10 != @20-10-01 00:00:00.061@ then + return -1 +endi +if $data11 != @12@ then + return -1 +endi +if $data12 != @1@ then + return -1 +endi +if $data13 != @ct1@ then + return -1 +endi +if $data20 != @20-10-01 00:00:00.121@ then + return -1 +endi +if $data21 != @33@ then + return -1 +endi +if $data22 != @1@ then + return -1 +endi +if $data23 != @ct1@ then + return -1 +endi +if $data30 != @20-10-01 00:00:00.181@ then + return -1 +endi +if $data31 != @64@ then + return -1 +endi +if $data32 != @1@ then + return -1 +endi +if $data33 != @ct1@ then + return -1 +endi +if $data40 != @20-10-01 00:00:00.241@ then + return -1 +endi +if $data41 != @105@ then + return -1 +endi +if $data42 != @1@ then + return -1 +endi +if $data43 != @ct1@ then + return -1 +endi +if $data50 != @20-10-01 00:00:00.301@ then + return -1 +endi +if $data51 != @156@ then + return -1 +endi +if $data52 != @1@ then + return -1 +endi +if $data53 != @ct1@ then + return -1 +endi +if $data60 != @20-10-01 00:00:00.361@ then + return -1 +endi +if $data61 != @217@ then + return -1 +endi +if $data62 != @1@ then + return -1 +endi +if $data63 != @ct1@ then + return -1 +endi +if $data70 != @20-10-01 00:00:00.421@ then + return -1 +endi +if $data71 != @288@ then + return -1 +endi +if $data72 != @1@ then + return -1 +endi +if $data73 != @ct1@ then + return -1 +endi +if $data80 != @20-10-01 00:00:00.481@ then + return -1 +endi +if $data81 != @369@ then + return -1 +endi +if $data82 != @1@ then + return -1 +endi +if $data83 != @ct1@ then + return -1 +endi +if $data90 != @20-10-01 00:00:00.541@ then + return -1 +endi +if $data91 != @460@ then + return -1 +endi +if $data92 != @1@ then + return -1 +endi +if $data93 != @ct1@ then + return -1 +endi +print execute sql select diff(f1),t from st group by tbname + +sql select diff(f1),t from st group by tbname + +if $rows != 57 then + return -1 +endi +if $data00 != @20-10-01 00:00:00.061@ then + return -1 +endi +if $data01 != @10@ then + return -1 +endi +if $data02 != @1@ then + return -1 +endi +if $data03 != @ct1@ then + return -1 +endi +if $data10 != @20-10-01 00:00:00.121@ then + return -1 +endi +if $data11 != @10@ then + return -1 +endi +if $data12 != @1@ then + return -1 +endi +if $data13 != @ct1@ then + return -1 +endi +if $data20 != @20-10-01 00:00:00.181@ then + return -1 +endi +if $data21 != @10@ then + return -1 +endi +if $data22 != @1@ then + return -1 +endi +if $data23 != @ct1@ then + return -1 +endi +if $data30 != @20-10-01 00:00:00.241@ then + return -1 +endi +if $data31 != @10@ then + return -1 +endi +if $data32 != @1@ then + return -1 +endi +if $data33 != @ct1@ then + return -1 +endi +if $data40 != @20-10-01 00:00:00.301@ then + return -1 +endi +if $data41 != @10@ then + return -1 +endi +if $data42 != @1@ then + return -1 +endi +if $data43 != @ct1@ then + return -1 +endi +if $data50 != @20-10-01 00:00:00.361@ then + return -1 +endi +if $data51 != @10@ then + return -1 +endi +if $data52 != @1@ then + return -1 +endi +if $data53 != @ct1@ then + return -1 +endi +if $data60 != @20-10-01 00:00:00.421@ then + return -1 +endi +if $data61 != @10@ then + return -1 +endi +if $data62 != @1@ then + return -1 +endi +if $data63 != @ct1@ then + return -1 +endi +if $data70 != @20-10-01 00:00:00.481@ then + return -1 +endi +if $data71 != @10@ then + return -1 +endi +if $data72 != @1@ then + return -1 +endi +if $data73 != @ct1@ then + return -1 +endi +if $data80 != @20-10-01 00:00:00.541@ then + return -1 +endi +if $data81 != @10@ then + return -1 +endi +if $data82 != @1@ then + return -1 +endi +if $data83 != @ct1@ then + return -1 +endi +if $data90 != @20-10-01 00:01:40.001@ then + return -1 +endi +if $data91 != @10@ then + return -1 +endi +if $data92 != @1@ then + return -1 +endi +if $data93 != @ct1@ then + return -1 +endi +print execute sql select derivative(f1, 1s, 0),t from st group by tbname + +sql select derivative(f1, 1s, 0),t from st group by tbname + +if $rows != 57 then + return -1 +endi +if $data00 != @20-10-01 00:00:00.061@ then + return -1 +endi +if $data01 != @166.666666667@ then + return -1 +endi +if $data02 != @1@ then + return -1 +endi +if $data03 != @ct1@ then + return -1 +endi +if $data10 != @20-10-01 00:00:00.121@ then + return -1 +endi +if $data11 != @166.666666667@ then + return -1 +endi +if $data12 != @1@ then + return -1 +endi +if $data13 != @ct1@ then + return -1 +endi +if $data20 != @20-10-01 00:00:00.181@ then + return -1 +endi +if $data21 != @166.666666667@ then + return -1 +endi +if $data22 != @1@ then + return -1 +endi +if $data23 != @ct1@ then + return -1 +endi +if $data30 != @20-10-01 00:00:00.241@ then + return -1 +endi +if $data31 != @166.666666667@ then + return -1 +endi +if $data32 != @1@ then + return -1 +endi +if $data33 != @ct1@ then + return -1 +endi +if $data40 != @20-10-01 00:00:00.301@ then + return -1 +endi +if $data41 != @166.666666667@ then + return -1 +endi +if $data42 != @1@ then + return -1 +endi +if $data43 != @ct1@ then + return -1 +endi +if $data50 != @20-10-01 00:00:00.361@ then + return -1 +endi +if $data51 != @166.666666667@ then + return -1 +endi +if $data52 != @1@ then + return -1 +endi +if $data53 != @ct1@ then + return -1 +endi +if $data60 != @20-10-01 00:00:00.421@ then + return -1 +endi +if $data61 != @166.666666667@ then + return -1 +endi +if $data62 != @1@ then + return -1 +endi +if $data63 != @ct1@ then + return -1 +endi +if $data70 != @20-10-01 00:00:00.481@ then + return -1 +endi +if $data71 != @166.666666667@ then + return -1 +endi +if $data72 != @1@ then + return -1 +endi +if $data73 != @ct1@ then + return -1 +endi +if $data80 != @20-10-01 00:00:00.541@ then + return -1 +endi +if $data81 != @166.666666667@ then + return -1 +endi +if $data82 != @1@ then + return -1 +endi +if $data83 != @ct1@ then + return -1 +endi +if $data90 != @20-10-01 00:01:40.001@ then + return -1 +endi +if $data91 != @0.100542932@ then + return -1 +endi +if $data92 != @1@ then + return -1 +endi +if $data93 != @ct1@ then + return -1 +endi +print execute sql select mavg(f1,2),t from st group by tbname + +sql select mavg(f1,2),t from st group by tbname + +if $rows != 57 then + return -1 +endi +if $data00 != @20-10-01 00:00:00.061@ then + return -1 +endi +if $data01 != @6.000000000@ then + return -1 +endi +if $data02 != @1@ then + return -1 +endi +if $data03 != @ct1@ then + return -1 +endi +if $data10 != @20-10-01 00:00:00.121@ then + return -1 +endi +if $data11 != @16.000000000@ then + return -1 +endi +if $data12 != @1@ then + return -1 +endi +if $data13 != @ct1@ then + return -1 +endi +if $data20 != @20-10-01 00:00:00.181@ then + return -1 +endi +if $data21 != @26.000000000@ then + return -1 +endi +if $data22 != @1@ then + return -1 +endi +if $data23 != @ct1@ then + return -1 +endi +if $data30 != @20-10-01 00:00:00.241@ then + return -1 +endi +if $data31 != @36.000000000@ then + return -1 +endi +if $data32 != @1@ then + return -1 +endi +if $data33 != @ct1@ then + return -1 +endi +if $data40 != @20-10-01 00:00:00.301@ then + return -1 +endi +if $data41 != @46.000000000@ then + return -1 +endi +if $data42 != @1@ then + return -1 +endi +if $data43 != @ct1@ then + return -1 +endi +if $data50 != @20-10-01 00:00:00.361@ then + return -1 +endi +if $data51 != @56.000000000@ then + return -1 +endi +if $data52 != @1@ then + return -1 +endi +if $data53 != @ct1@ then + return -1 +endi +if $data60 != @20-10-01 00:00:00.421@ then + return -1 +endi +if $data61 != @66.000000000@ then + return -1 +endi +if $data62 != @1@ then + return -1 +endi +if $data63 != @ct1@ then + return -1 +endi +if $data70 != @20-10-01 00:00:00.481@ then + return -1 +endi +if $data71 != @76.000000000@ then + return -1 +endi +if $data72 != @1@ then + return -1 +endi +if $data73 != @ct1@ then + return -1 +endi +if $data80 != @20-10-01 00:00:00.541@ then + return -1 +endi +if $data81 != @86.000000000@ then + return -1 +endi +if $data82 != @1@ then + return -1 +endi +if $data83 != @ct1@ then + return -1 +endi +if $data90 != @20-10-01 00:01:40.001@ then + return -1 +endi +if $data91 != @96.000000000@ then + return -1 +endi +if $data92 != @1@ then + return -1 +endi +if $data93 != @ct1@ then + return -1 +endi +print execute sql select csum(f1) from st group by tbname limit 2 + +sql select csum(f1) from st group by tbname limit 2 + +if $rows != 6 then + return -1 +endi +if $data00 != @20-10-01 00:00:00.001@ then + return -1 +endi +if $data01 != @1@ then + return -1 +endi +if $data02 != @ct1@ then + return -1 +endi +if $data10 != @20-10-01 00:00:00.061@ then + return -1 +endi +if $data11 != @12@ then + return -1 +endi +if $data12 != @ct1@ then + return -1 +endi +if $data20 != @20-10-01 00:00:00.002@ then + return -1 +endi +if $data21 != @2@ then + return -1 +endi +if $data22 != @ct2@ then + return -1 +endi +if $data30 != @20-10-01 00:00:00.062@ then + return -1 +endi +if $data31 != @14@ then + return -1 +endi +if $data32 != @ct2@ then + return -1 +endi +if $data40 != @20-10-01 00:00:00.003@ then + return -1 +endi +if $data41 != @3@ then + return -1 +endi +if $data42 != @ct3@ then + return -1 +endi +if $data50 != @20-10-01 00:00:00.063@ then + return -1 +endi +if $data51 != @16@ then + return -1 +endi +if $data52 != @ct3@ then + return -1 +endi +print execute sql select diff(f1) from st group by tbname limit 2 + +sql select diff(f1) from st group by tbname limit 2 + +if $rows != 6 then + return -1 +endi +if $data00 != @20-10-01 00:00:00.061@ then + return -1 +endi +if $data01 != @10@ then + return -1 +endi +if $data02 != @ct1@ then + return -1 +endi +if $data10 != @20-10-01 00:00:00.121@ then + return -1 +endi +if $data11 != @10@ then + return -1 +endi +if $data12 != @ct1@ then + return -1 +endi +if $data20 != @20-10-01 00:00:00.062@ then + return -1 +endi +if $data21 != @10@ then + return -1 +endi +if $data22 != @ct2@ then + return -1 +endi +if $data30 != @20-10-01 00:00:00.122@ then + return -1 +endi +if $data31 != @10@ then + return -1 +endi +if $data32 != @ct2@ then + return -1 +endi +if $data40 != @20-10-01 00:00:00.063@ then + return -1 +endi +if $data41 != @10@ then + return -1 +endi +if $data42 != @ct3@ then + return -1 +endi +if $data50 != @20-10-01 00:00:00.123@ then + return -1 +endi +if $data51 != @10@ then + return -1 +endi +if $data52 != @ct3@ then + return -1 +endi +print execute sql select derivative(f1, 1s, 0) from st group by tbname limit 2 + +sql select derivative(f1, 1s, 0) from st group by tbname limit 2 + +if $rows != 6 then + return -1 +endi +if $data00 != @20-10-01 00:00:00.061@ then + return -1 +endi +if $data01 != @166.666666667@ then + return -1 +endi +if $data02 != @ct1@ then + return -1 +endi +if $data10 != @20-10-01 00:00:00.121@ then + return -1 +endi +if $data11 != @166.666666667@ then + return -1 +endi +if $data12 != @ct1@ then + return -1 +endi +if $data20 != @20-10-01 00:00:00.062@ then + return -1 +endi +if $data21 != @166.666666667@ then + return -1 +endi +if $data22 != @ct2@ then + return -1 +endi +if $data30 != @20-10-01 00:00:00.122@ then + return -1 +endi +if $data31 != @166.666666667@ then + return -1 +endi +if $data32 != @ct2@ then + return -1 +endi +if $data40 != @20-10-01 00:00:00.063@ then + return -1 +endi +if $data41 != @166.666666667@ then + return -1 +endi +if $data42 != @ct3@ then + return -1 +endi +if $data50 != @20-10-01 00:00:00.123@ then + return -1 +endi +if $data51 != @166.666666667@ then + return -1 +endi +if $data52 != @ct3@ then + return -1 +endi +print execute sql select mavg(f1,2) from st group by tbname limit 2 + +sql select mavg(f1,2) from st group by tbname limit 2 + +if $rows != 6 then + return -1 +endi +if $data00 != @20-10-01 00:00:00.061@ then + return -1 +endi +if $data01 != @6.000000000@ then + return -1 +endi +if $data02 != @ct1@ then + return -1 +endi +if $data10 != @20-10-01 00:00:00.121@ then + return -1 +endi +if $data11 != @16.000000000@ then + return -1 +endi +if $data12 != @ct1@ then + return -1 +endi +if $data20 != @20-10-01 00:00:00.062@ then + return -1 +endi +if $data21 != @7.000000000@ then + return -1 +endi +if $data22 != @ct2@ then + return -1 +endi +if $data30 != @20-10-01 00:00:00.122@ then + return -1 +endi +if $data31 != @17.000000000@ then + return -1 +endi +if $data32 != @ct2@ then + return -1 +endi +if $data40 != @20-10-01 00:00:00.063@ then + return -1 +endi +if $data41 != @8.000000000@ then + return -1 +endi +if $data42 != @ct3@ then + return -1 +endi +if $data50 != @20-10-01 00:00:00.123@ then + return -1 +endi +if $data51 != @18.000000000@ then + return -1 +endi +if $data52 != @ct3@ then + return -1 +endi +print execute sql select csum(f1),t from st group by tbname limit 2 + +sql select csum(f1),t from st group by tbname limit 2 + +if $rows != 6 then + return -1 +endi +if $data00 != @20-10-01 00:00:00.001@ then + return -1 +endi +if $data01 != @1@ then + return -1 +endi +if $data02 != @1@ then + return -1 +endi +if $data03 != @ct1@ then + return -1 +endi +if $data10 != @20-10-01 00:00:00.061@ then + return -1 +endi +if $data11 != @12@ then + return -1 +endi +if $data12 != @1@ then + return -1 +endi +if $data13 != @ct1@ then + return -1 +endi +if $data20 != @20-10-01 00:00:00.002@ then + return -1 +endi +if $data21 != @2@ then + return -1 +endi +if $data22 != @2@ then + return -1 +endi +if $data23 != @ct2@ then + return -1 +endi +if $data30 != @20-10-01 00:00:00.062@ then + return -1 +endi +if $data31 != @14@ then + return -1 +endi +if $data32 != @2@ then + return -1 +endi +if $data33 != @ct2@ then + return -1 +endi +if $data40 != @20-10-01 00:00:00.003@ then + return -1 +endi +if $data41 != @3@ then + return -1 +endi +if $data42 != @3@ then + return -1 +endi +if $data43 != @ct3@ then + return -1 +endi +if $data50 != @20-10-01 00:00:00.063@ then + return -1 +endi +if $data51 != @16@ then + return -1 +endi +if $data52 != @3@ then + return -1 +endi +if $data53 != @ct3@ then + return -1 +endi +print execute sql select diff(f1),t from st group by tbname limit 2 + +sql select diff(f1),t from st group by tbname limit 2 + +if $rows != 6 then + return -1 +endi +if $data00 != @20-10-01 00:00:00.061@ then + return -1 +endi +if $data01 != @10@ then + return -1 +endi +if $data02 != @1@ then + return -1 +endi +if $data03 != @ct1@ then + return -1 +endi +if $data10 != @20-10-01 00:00:00.121@ then + return -1 +endi +if $data11 != @10@ then + return -1 +endi +if $data12 != @1@ then + return -1 +endi +if $data13 != @ct1@ then + return -1 +endi +if $data20 != @20-10-01 00:00:00.062@ then + return -1 +endi +if $data21 != @10@ then + return -1 +endi +if $data22 != @2@ then + return -1 +endi +if $data23 != @ct2@ then + return -1 +endi +if $data30 != @20-10-01 00:00:00.122@ then + return -1 +endi +if $data31 != @10@ then + return -1 +endi +if $data32 != @2@ then + return -1 +endi +if $data33 != @ct2@ then + return -1 +endi +if $data40 != @20-10-01 00:00:00.063@ then + return -1 +endi +if $data41 != @10@ then + return -1 +endi +if $data42 != @3@ then + return -1 +endi +if $data43 != @ct3@ then + return -1 +endi +if $data50 != @20-10-01 00:00:00.123@ then + return -1 +endi +if $data51 != @10@ then + return -1 +endi +if $data52 != @3@ then + return -1 +endi +if $data53 != @ct3@ then + return -1 +endi +print execute sql select derivative(f1, 1s, 0),t from st group by tbname limit 2 + +sql select derivative(f1, 1s, 0),t from st group by tbname limit 2 + +if $rows != 6 then + return -1 +endi +if $data00 != @20-10-01 00:00:00.061@ then + return -1 +endi +if $data01 != @166.666666667@ then + return -1 +endi +if $data02 != @1@ then + return -1 +endi +if $data03 != @ct1@ then + return -1 +endi +if $data10 != @20-10-01 00:00:00.121@ then + return -1 +endi +if $data11 != @166.666666667@ then + return -1 +endi +if $data12 != @1@ then + return -1 +endi +if $data13 != @ct1@ then + return -1 +endi +if $data20 != @20-10-01 00:00:00.062@ then + return -1 +endi +if $data21 != @166.666666667@ then + return -1 +endi +if $data22 != @2@ then + return -1 +endi +if $data23 != @ct2@ then + return -1 +endi +if $data30 != @20-10-01 00:00:00.122@ then + return -1 +endi +if $data31 != @166.666666667@ then + return -1 +endi +if $data32 != @2@ then + return -1 +endi +if $data33 != @ct2@ then + return -1 +endi +if $data40 != @20-10-01 00:00:00.063@ then + return -1 +endi +if $data41 != @166.666666667@ then + return -1 +endi +if $data42 != @3@ then + return -1 +endi +if $data43 != @ct3@ then + return -1 +endi +if $data50 != @20-10-01 00:00:00.123@ then + return -1 +endi +if $data51 != @166.666666667@ then + return -1 +endi +if $data52 != @3@ then + return -1 +endi +if $data53 != @ct3@ then + return -1 +endi +print execute sql select mavg(f1,2),t from st group by tbname limit 2 + +sql select mavg(f1,2),t from st group by tbname limit 2 + +if $rows != 6 then + return -1 +endi +if $data00 != @20-10-01 00:00:00.061@ then + return -1 +endi +if $data01 != @6.000000000@ then + return -1 +endi +if $data02 != @1@ then + return -1 +endi +if $data03 != @ct1@ then + return -1 +endi +if $data10 != @20-10-01 00:00:00.121@ then + return -1 +endi +if $data11 != @16.000000000@ then + return -1 +endi +if $data12 != @1@ then + return -1 +endi +if $data13 != @ct1@ then + return -1 +endi +if $data20 != @20-10-01 00:00:00.062@ then + return -1 +endi +if $data21 != @7.000000000@ then + return -1 +endi +if $data22 != @2@ then + return -1 +endi +if $data23 != @ct2@ then + return -1 +endi +if $data30 != @20-10-01 00:00:00.122@ then + return -1 +endi +if $data31 != @17.000000000@ then + return -1 +endi +if $data32 != @2@ then + return -1 +endi +if $data33 != @ct2@ then + return -1 +endi +if $data40 != @20-10-01 00:00:00.063@ then + return -1 +endi +if $data41 != @8.000000000@ then + return -1 +endi +if $data42 != @3@ then + return -1 +endi +if $data43 != @ct3@ then + return -1 +endi +if $data50 != @20-10-01 00:00:00.123@ then + return -1 +endi +if $data51 != @18.000000000@ then + return -1 +endi +if $data52 != @3@ then + return -1 +endi +if $data53 != @ct3@ then + return -1 +endi +print execute sql select csum(f1) from st group by tbname limit 2 offset 9 + +sql select csum(f1) from st group by tbname limit 2 offset 9 + +if $rows != 6 then + return -1 +endi +if $data00 != @20-10-01 00:00:00.541@ then + return -1 +endi +if $data01 != @460@ then + return -1 +endi +if $data02 != @ct1@ then + return -1 +endi +if $data10 != @20-10-01 00:01:40.001@ then + return -1 +endi +if $data11 != @561@ then + return -1 +endi +if $data12 != @ct1@ then + return -1 +endi +if $data20 != @20-10-01 00:00:00.542@ then + return -1 +endi +if $data21 != @470@ then + return -1 +endi +if $data22 != @ct2@ then + return -1 +endi +if $data30 != @20-10-01 00:01:40.002@ then + return -1 +endi +if $data31 != @572@ then + return -1 +endi +if $data32 != @ct2@ then + return -1 +endi +if $data40 != @20-10-01 00:00:00.543@ then + return -1 +endi +if $data41 != @480@ then + return -1 +endi +if $data42 != @ct3@ then + return -1 +endi +if $data50 != @20-10-01 00:01:40.003@ then + return -1 +endi +if $data51 != @583@ then + return -1 +endi +if $data52 != @ct3@ then + return -1 +endi +print execute sql select diff(f1) from st group by tbname limit 2 offset 9 + +sql select diff(f1) from st group by tbname limit 2 offset 9 + +if $rows != 6 then + return -1 +endi +if $data00 != @20-10-01 00:01:40.001@ then + return -1 +endi +if $data01 != @10@ then + return -1 +endi +if $data02 != @ct1@ then + return -1 +endi +if $data10 != @20-10-01 00:01:40.061@ then + return -1 +endi +if $data11 != @10@ then + return -1 +endi +if $data12 != @ct1@ then + return -1 +endi +if $data20 != @20-10-01 00:01:40.002@ then + return -1 +endi +if $data21 != @10@ then + return -1 +endi +if $data22 != @ct2@ then + return -1 +endi +if $data30 != @20-10-01 00:01:40.062@ then + return -1 +endi +if $data31 != @10@ then + return -1 +endi +if $data32 != @ct2@ then + return -1 +endi +if $data40 != @20-10-01 00:01:40.003@ then + return -1 +endi +if $data41 != @10@ then + return -1 +endi +if $data42 != @ct3@ then + return -1 +endi +if $data50 != @20-10-01 00:01:40.063@ then + return -1 +endi +if $data51 != @10@ then + return -1 +endi +if $data52 != @ct3@ then + return -1 +endi +print execute sql select derivative(f1, 1s, 0) from st group by tbname limit 2 offset 9 + +sql select derivative(f1, 1s, 0) from st group by tbname limit 2 offset 9 + +if $rows != 6 then + return -1 +endi +if $data00 != @20-10-01 00:01:40.001@ then + return -1 +endi +if $data01 != @0.100542932@ then + return -1 +endi +if $data02 != @ct1@ then + return -1 +endi +if $data10 != @20-10-01 00:01:40.061@ then + return -1 +endi +if $data11 != @166.666666667@ then + return -1 +endi +if $data12 != @ct1@ then + return -1 +endi +if $data20 != @20-10-01 00:01:40.002@ then + return -1 +endi +if $data21 != @0.100542932@ then + return -1 +endi +if $data22 != @ct2@ then + return -1 +endi +if $data30 != @20-10-01 00:01:40.062@ then + return -1 +endi +if $data31 != @166.666666667@ then + return -1 +endi +if $data32 != @ct2@ then + return -1 +endi +if $data40 != @20-10-01 00:01:40.003@ then + return -1 +endi +if $data41 != @0.100542932@ then + return -1 +endi +if $data42 != @ct3@ then + return -1 +endi +if $data50 != @20-10-01 00:01:40.063@ then + return -1 +endi +if $data51 != @166.666666667@ then + return -1 +endi +if $data52 != @ct3@ then + return -1 +endi +print execute sql select mavg(f1,2) from st group by tbname limit 2 offset 9 + +sql select mavg(f1,2) from st group by tbname limit 2 offset 9 + +if $rows != 6 then + return -1 +endi +if $data00 != @20-10-01 00:01:40.001@ then + return -1 +endi +if $data01 != @96.000000000@ then + return -1 +endi +if $data02 != @ct1@ then + return -1 +endi +if $data10 != @20-10-01 00:01:40.061@ then + return -1 +endi +if $data11 != @106.000000000@ then + return -1 +endi +if $data12 != @ct1@ then + return -1 +endi +if $data20 != @20-10-01 00:01:40.002@ then + return -1 +endi +if $data21 != @97.000000000@ then + return -1 +endi +if $data22 != @ct2@ then + return -1 +endi +if $data30 != @20-10-01 00:01:40.062@ then + return -1 +endi +if $data31 != @107.000000000@ then + return -1 +endi +if $data32 != @ct2@ then + return -1 +endi +if $data40 != @20-10-01 00:01:40.003@ then + return -1 +endi +if $data41 != @98.000000000@ then + return -1 +endi +if $data42 != @ct3@ then + return -1 +endi +if $data50 != @20-10-01 00:01:40.063@ then + return -1 +endi +if $data51 != @108.000000000@ then + return -1 +endi +if $data52 != @ct3@ then + return -1 +endi +print execute sql select csum(f1),t from st group by tbname limit 2 offset 9 + +sql select csum(f1),t from st group by tbname limit 2 offset 9 + +if $rows != 6 then + return -1 +endi +if $data00 != @20-10-01 00:00:00.541@ then + return -1 +endi +if $data01 != @460@ then + return -1 +endi +if $data02 != @1@ then + return -1 +endi +if $data03 != @ct1@ then + return -1 +endi +if $data10 != @20-10-01 00:01:40.001@ then + return -1 +endi +if $data11 != @561@ then + return -1 +endi +if $data12 != @1@ then + return -1 +endi +if $data13 != @ct1@ then + return -1 +endi +if $data20 != @20-10-01 00:00:00.542@ then + return -1 +endi +if $data21 != @470@ then + return -1 +endi +if $data22 != @2@ then + return -1 +endi +if $data23 != @ct2@ then + return -1 +endi +if $data30 != @20-10-01 00:01:40.002@ then + return -1 +endi +if $data31 != @572@ then + return -1 +endi +if $data32 != @2@ then + return -1 +endi +if $data33 != @ct2@ then + return -1 +endi +if $data40 != @20-10-01 00:00:00.543@ then + return -1 +endi +if $data41 != @480@ then + return -1 +endi +if $data42 != @3@ then + return -1 +endi +if $data43 != @ct3@ then + return -1 +endi +if $data50 != @20-10-01 00:01:40.003@ then + return -1 +endi +if $data51 != @583@ then + return -1 +endi +if $data52 != @3@ then + return -1 +endi +if $data53 != @ct3@ then + return -1 +endi +print execute sql select diff(f1),t from st group by tbname limit 2 offset 9 + +sql select diff(f1),t from st group by tbname limit 2 offset 9 + +if $rows != 6 then + return -1 +endi +if $data00 != @20-10-01 00:01:40.001@ then + return -1 +endi +if $data01 != @10@ then + return -1 +endi +if $data02 != @1@ then + return -1 +endi +if $data03 != @ct1@ then + return -1 +endi +if $data10 != @20-10-01 00:01:40.061@ then + return -1 +endi +if $data11 != @10@ then + return -1 +endi +if $data12 != @1@ then + return -1 +endi +if $data13 != @ct1@ then + return -1 +endi +if $data20 != @20-10-01 00:01:40.002@ then + return -1 +endi +if $data21 != @10@ then + return -1 +endi +if $data22 != @2@ then + return -1 +endi +if $data23 != @ct2@ then + return -1 +endi +if $data30 != @20-10-01 00:01:40.062@ then + return -1 +endi +if $data31 != @10@ then + return -1 +endi +if $data32 != @2@ then + return -1 +endi +if $data33 != @ct2@ then + return -1 +endi +if $data40 != @20-10-01 00:01:40.003@ then + return -1 +endi +if $data41 != @10@ then + return -1 +endi +if $data42 != @3@ then + return -1 +endi +if $data43 != @ct3@ then + return -1 +endi +if $data50 != @20-10-01 00:01:40.063@ then + return -1 +endi +if $data51 != @10@ then + return -1 +endi +if $data52 != @3@ then + return -1 +endi +if $data53 != @ct3@ then + return -1 +endi +print execute sql select derivative(f1, 1s, 0),t from st group by tbname limit 2 offset 9 + +sql select derivative(f1, 1s, 0),t from st group by tbname limit 2 offset 9 + +if $rows != 6 then + return -1 +endi +if $data00 != @20-10-01 00:01:40.001@ then + return -1 +endi +if $data01 != @0.100542932@ then + return -1 +endi +if $data02 != @1@ then + return -1 +endi +if $data03 != @ct1@ then + return -1 +endi +if $data10 != @20-10-01 00:01:40.061@ then + return -1 +endi +if $data11 != @166.666666667@ then + return -1 +endi +if $data12 != @1@ then + return -1 +endi +if $data13 != @ct1@ then + return -1 +endi +if $data20 != @20-10-01 00:01:40.002@ then + return -1 +endi +if $data21 != @0.100542932@ then + return -1 +endi +if $data22 != @2@ then + return -1 +endi +if $data23 != @ct2@ then + return -1 +endi +if $data30 != @20-10-01 00:01:40.062@ then + return -1 +endi +if $data31 != @166.666666667@ then + return -1 +endi +if $data32 != @2@ then + return -1 +endi +if $data33 != @ct2@ then + return -1 +endi +if $data40 != @20-10-01 00:01:40.003@ then + return -1 +endi +if $data41 != @0.100542932@ then + return -1 +endi +if $data42 != @3@ then + return -1 +endi +if $data43 != @ct3@ then + return -1 +endi +if $data50 != @20-10-01 00:01:40.063@ then + return -1 +endi +if $data51 != @166.666666667@ then + return -1 +endi +if $data52 != @3@ then + return -1 +endi +if $data53 != @ct3@ then + return -1 +endi +print execute sql select mavg(f1,2),t from st group by tbname limit 2 offset 9 + +sql select mavg(f1,2),t from st group by tbname limit 2 offset 9 + +if $rows != 6 then + return -1 +endi +if $data00 != @20-10-01 00:01:40.001@ then + return -1 +endi +if $data01 != @96.000000000@ then + return -1 +endi +if $data02 != @1@ then + return -1 +endi +if $data03 != @ct1@ then + return -1 +endi +if $data10 != @20-10-01 00:01:40.061@ then + return -1 +endi +if $data11 != @106.000000000@ then + return -1 +endi +if $data12 != @1@ then + return -1 +endi +if $data13 != @ct1@ then + return -1 +endi +if $data20 != @20-10-01 00:01:40.002@ then + return -1 +endi +if $data21 != @97.000000000@ then + return -1 +endi +if $data22 != @2@ then + return -1 +endi +if $data23 != @ct2@ then + return -1 +endi +if $data30 != @20-10-01 00:01:40.062@ then + return -1 +endi +if $data31 != @107.000000000@ then + return -1 +endi +if $data32 != @2@ then + return -1 +endi +if $data33 != @ct2@ then + return -1 +endi +if $data40 != @20-10-01 00:01:40.003@ then + return -1 +endi +if $data41 != @98.000000000@ then + return -1 +endi +if $data42 != @3@ then + return -1 +endi +if $data43 != @ct3@ then + return -1 +endi +if $data50 != @20-10-01 00:01:40.063@ then + return -1 +endi +if $data51 != @108.000000000@ then + return -1 +endi +if $data52 != @3@ then + return -1 +endi +if $data53 != @ct3@ then + return -1 +endi +print execute sql select csum(f1),t,tbname from st group by tbname limit 2 offset 9 + +sql select csum(f1),t,tbname from st group by tbname limit 2 offset 9 + +if $rows != 6 then + return -1 +endi +if $data00 != @20-10-01 00:00:00.541@ then + return -1 +endi +if $data01 != @460@ then + return -1 +endi +if $data02 != @1@ then + return -1 +endi +if $data03 != @ct1@ then + return -1 +endi +if $data04 != @ct1@ then + return -1 +endi +if $data10 != @20-10-01 00:01:40.001@ then + return -1 +endi +if $data11 != @561@ then + return -1 +endi +if $data12 != @1@ then + return -1 +endi +if $data13 != @ct1@ then + return -1 +endi +if $data14 != @ct1@ then + return -1 +endi +if $data20 != @20-10-01 00:00:00.542@ then + return -1 +endi +if $data21 != @470@ then + return -1 +endi +if $data22 != @2@ then + return -1 +endi +if $data23 != @ct2@ then + return -1 +endi +if $data24 != @ct2@ then + return -1 +endi +if $data30 != @20-10-01 00:01:40.002@ then + return -1 +endi +if $data31 != @572@ then + return -1 +endi +if $data32 != @2@ then + return -1 +endi +if $data33 != @ct2@ then + return -1 +endi +if $data34 != @ct2@ then + return -1 +endi +if $data40 != @20-10-01 00:00:00.543@ then + return -1 +endi +if $data41 != @480@ then + return -1 +endi +if $data42 != @3@ then + return -1 +endi +if $data43 != @ct3@ then + return -1 +endi +if $data44 != @ct3@ then + return -1 +endi +if $data50 != @20-10-01 00:01:40.003@ then + return -1 +endi +if $data51 != @583@ then + return -1 +endi +if $data52 != @3@ then + return -1 +endi +if $data53 != @ct3@ then + return -1 +endi +if $data54 != @ct3@ then + return -1 +endi +print execute sql select diff(f1),t,tbname from st group by tbname limit 2 offset 9 + +sql select diff(f1),t,tbname from st group by tbname limit 2 offset 9 + +if $rows != 6 then + return -1 +endi +if $data00 != @20-10-01 00:01:40.001@ then + return -1 +endi +if $data01 != @10@ then + return -1 +endi +if $data02 != @1@ then + return -1 +endi +if $data03 != @ct1@ then + return -1 +endi +if $data04 != @ct1@ then + return -1 +endi +if $data10 != @20-10-01 00:01:40.061@ then + return -1 +endi +if $data11 != @10@ then + return -1 +endi +if $data12 != @1@ then + return -1 +endi +if $data13 != @ct1@ then + return -1 +endi +if $data14 != @ct1@ then + return -1 +endi +if $data20 != @20-10-01 00:01:40.002@ then + return -1 +endi +if $data21 != @10@ then + return -1 +endi +if $data22 != @2@ then + return -1 +endi +if $data23 != @ct2@ then + return -1 +endi +if $data24 != @ct2@ then + return -1 +endi +if $data30 != @20-10-01 00:01:40.062@ then + return -1 +endi +if $data31 != @10@ then + return -1 +endi +if $data32 != @2@ then + return -1 +endi +if $data33 != @ct2@ then + return -1 +endi +if $data34 != @ct2@ then + return -1 +endi +if $data40 != @20-10-01 00:01:40.003@ then + return -1 +endi +if $data41 != @10@ then + return -1 +endi +if $data42 != @3@ then + return -1 +endi +if $data43 != @ct3@ then + return -1 +endi +if $data44 != @ct3@ then + return -1 +endi +if $data50 != @20-10-01 00:01:40.063@ then + return -1 +endi +if $data51 != @10@ then + return -1 +endi +if $data52 != @3@ then + return -1 +endi +if $data53 != @ct3@ then + return -1 +endi +if $data54 != @ct3@ then + return -1 +endi +print execute sql select derivative(f1, 1s, 0),t,tbname from st group by tbname limit 2 offset 9 + +sql select derivative(f1, 1s, 0),t,tbname from st group by tbname limit 2 offset 9 + +if $rows != 6 then + return -1 +endi +if $data00 != @20-10-01 00:01:40.001@ then + return -1 +endi +if $data01 != @0.100542932@ then + return -1 +endi +if $data02 != @1@ then + return -1 +endi +if $data03 != @ct1@ then + return -1 +endi +if $data04 != @ct1@ then + return -1 +endi +if $data10 != @20-10-01 00:01:40.061@ then + return -1 +endi +if $data11 != @166.666666667@ then + return -1 +endi +if $data12 != @1@ then + return -1 +endi +if $data13 != @ct1@ then + return -1 +endi +if $data14 != @ct1@ then + return -1 +endi +if $data20 != @20-10-01 00:01:40.002@ then + return -1 +endi +if $data21 != @0.100542932@ then + return -1 +endi +if $data22 != @2@ then + return -1 +endi +if $data23 != @ct2@ then + return -1 +endi +if $data24 != @ct2@ then + return -1 +endi +if $data30 != @20-10-01 00:01:40.062@ then + return -1 +endi +if $data31 != @166.666666667@ then + return -1 +endi +if $data32 != @2@ then + return -1 +endi +if $data33 != @ct2@ then + return -1 +endi +if $data34 != @ct2@ then + return -1 +endi +if $data40 != @20-10-01 00:01:40.003@ then + return -1 +endi +if $data41 != @0.100542932@ then + return -1 +endi +if $data42 != @3@ then + return -1 +endi +if $data43 != @ct3@ then + return -1 +endi +if $data44 != @ct3@ then + return -1 +endi +if $data50 != @20-10-01 00:01:40.063@ then + return -1 +endi +if $data51 != @166.666666667@ then + return -1 +endi +if $data52 != @3@ then + return -1 +endi +if $data53 != @ct3@ then + return -1 +endi +if $data54 != @ct3@ then + return -1 +endi +print execute sql select mavg(f1,2),t,tbname from st group by tbname limit 2 offset 9 + +sql select mavg(f1,2),t,tbname from st group by tbname limit 2 offset 9 + +if $rows != 6 then + return -1 +endi +if $data00 != @20-10-01 00:01:40.001@ then + return -1 +endi +if $data01 != @96.000000000@ then + return -1 +endi +if $data02 != @1@ then + return -1 +endi +if $data03 != @ct1@ then + return -1 +endi +if $data04 != @ct1@ then + return -1 +endi +if $data10 != @20-10-01 00:01:40.061@ then + return -1 +endi +if $data11 != @106.000000000@ then + return -1 +endi +if $data12 != @1@ then + return -1 +endi +if $data13 != @ct1@ then + return -1 +endi +if $data14 != @ct1@ then + return -1 +endi +if $data20 != @20-10-01 00:01:40.002@ then + return -1 +endi +if $data21 != @97.000000000@ then + return -1 +endi +if $data22 != @2@ then + return -1 +endi +if $data23 != @ct2@ then + return -1 +endi +if $data24 != @ct2@ then + return -1 +endi +if $data30 != @20-10-01 00:01:40.062@ then + return -1 +endi +if $data31 != @107.000000000@ then + return -1 +endi +if $data32 != @2@ then + return -1 +endi +if $data33 != @ct2@ then + return -1 +endi +if $data34 != @ct2@ then + return -1 +endi +if $data40 != @20-10-01 00:01:40.003@ then + return -1 +endi +if $data41 != @98.000000000@ then + return -1 +endi +if $data42 != @3@ then + return -1 +endi +if $data43 != @ct3@ then + return -1 +endi +if $data44 != @ct3@ then + return -1 +endi +if $data50 != @20-10-01 00:01:40.063@ then + return -1 +endi +if $data51 != @108.000000000@ then + return -1 +endi +if $data52 != @3@ then + return -1 +endi +if $data53 != @ct3@ then + return -1 +endi +if $data54 != @ct3@ then + return -1 +endi +print ================================ clear +#sql drop database $db +#sql show databases +#if $rows != 0 then +# return -1 +#endi + +#system sh/exec.sh -n dnode1 -s stop -x SIGINT + diff --git a/tests/script/general/compute/testSuite.sim b/tests/script/general/compute/testSuite.sim index 25c93ed29339c326628b885c34ed8766299460aa..ceb6525c7f67ab6c06f80d527f90c00299fbbd6e 100644 --- a/tests/script/general/compute/testSuite.sim +++ b/tests/script/general/compute/testSuite.sim @@ -20,3 +20,4 @@ run general/compute/stddev.sim run general/compute/sum.sim run general/compute/top.sim run general/compute/block_dist.sim +run general/compute/table_group.sim diff --git a/tests/script/regressionSuite.sim b/tests/script/regressionSuite.sim index a705601d96f64f2690c3b933228b02b49d59af68..91a88451924e6856a693208d30733c1f610dd74a 100644 --- a/tests/script/regressionSuite.sim +++ b/tests/script/regressionSuite.sim @@ -38,6 +38,7 @@ run general/compute/stddev.sim run general/compute/sum.sim run general/compute/top.sim run general/compute/block_dist.sim +run general/compute/table_group.sim run general/db/alter_option.sim run general/db/alter_tables_d2.sim run general/db/alter_tables_v1.sim