提交 f139195f 编写于 作者: S shenglian zhou

enhance test for math str function

上级 0306a534
......@@ -717,4 +717,5 @@ int32_t getMaximumIdleDurationSec();
void doInvokeUdf(SUdfInfo* pUdfInfo, SQLFunctionCtx *pCtx, int32_t idx, int32_t type);
int32_t getColumnDataFromId(void *param, int32_t id, void **data);
void qInfoLogSSDataBlock(SSDataBlock* block);
#endif // TDENGINE_QEXECUTOR_H
......@@ -9373,3 +9373,49 @@ void freeQueryAttr(SQueryAttr* pQueryAttr) {
}
}
void qInfoLogSSDataBlock(SSDataBlock* block) {
if (block == NULL) {
qInfo("SSDataBlock : NULL");
return;
}
qInfo("SSDataBlock rows:%d, cols:%d, tid:%d, uid:%" PRId64 ", skey:%" PRId64 ", ekey:%" PRId64, block->info.rows,
block->info.numOfCols, block->info.tid, block->info.uid, block->info.window.skey, block->info.window.ekey);
if (block->pBlockStatis != NULL) {
qInfo("SSDataBlock statics: null %d, max %" PRId64 ", min %" PRId64
", colId %d, maxIndex %d, minIndex %d, colId %d, sum %" PRId64,
block->pBlockStatis->numOfNull, block->pBlockStatis->max, block->pBlockStatis->min,
block->pBlockStatis->colId, block->pBlockStatis->maxIndex, block->pBlockStatis->minIndex,
block->pBlockStatis->colId, block->pBlockStatis->sum);
}
for (int i = 0; i < block->info.numOfCols; ++i) {
SColumnInfoData* infoData = taosArrayGet(block->pDataBlock, i);
qInfo("column %d, bytes %d, colId %d, type %d", i, infoData->info.bytes, infoData->info.colId, infoData->info.type);
for (int j = 0; j < block->info.rows; ++j) {
if (IS_SIGNED_NUMERIC_TYPE(infoData->info.type)) {
int64_t v;
GET_TYPED_DATA(v, int64_t, infoData->info.type, infoData->pData + j * infoData->info.bytes);
qInfo("%d, %" PRId64, j, v);
} else if (IS_UNSIGNED_NUMERIC_TYPE(infoData->info.type)) {
uint64_t v;
GET_TYPED_DATA(v, uint64_t, infoData->info.type, infoData->pData + j * infoData->info.bytes);
qInfo("%d, %" PRIu64, j, v);
} else if (IS_FLOAT_TYPE(infoData->info.type)) {
double v;
GET_TYPED_DATA(v, double, infoData->info.type, infoData->pData + j * infoData->info.bytes);
qInfo("%d, %lf", j, v);
} else if (infoData->info.type == TSDB_DATA_TYPE_BOOL) {
bool v;
GET_TYPED_DATA(v, bool, infoData->info.type, infoData->pData + j * infoData->info.bytes);
qInfo("%d, %s", j, v ? "true" : "false");
} else if (infoData->info.type == TSDB_DATA_TYPE_TIMESTAMP) {
int64_t v;
GET_TYPED_DATA(v, int64_t, infoData->info.type, infoData->pData + j * infoData->info.bytes);
qInfo("%d, %" PRId64, j, v);
} else {
qInfo("can not print binary or nchar");
}
}
}
}
......@@ -99,7 +99,7 @@ sql insert into tba1 values ('2021-11-11 09:00:28',true, 9,9,9,9,9,9,"999","9999
sql insert into tba1 values ('2021-11-11 09:00:29',true, 0,0,0,0,0,0,"000","0000",0,0,0,0);
run general/compute/math_str_query1.sim
#run general/compute/math_str_query2.sim
run general/compute/math_str_query2.sim
#run general/compute/math_str_query3.sim
#system sh/exec.sh -n dnode1 -s stop -x SIGINT
......
......@@ -28,6 +28,7 @@ print execute sql select sqrt(c1 + c2) from tb1;
sql_error select sqrt(c1 + c2) from tb1;
print execute sql select sqrt(13) from tb1;
sql select sqrt(13) from tb1;
print $data00
if $data00 != @3.605551275@ then
return -1
endi
......@@ -595,58 +596,58 @@ if $data80 != @1.414213562@ then
return -1
endi
endi
print execute sql select sqrt(c4),t1 from stb1 order by ts desc;
#sql select sqrt(c4),t1 from stb1 order by ts desc;
#if $data00 != @2.645751311@ then
#if $data00 != @-nan@ then
# return -1
#endi
#endi
#if $data01 != @2@ then
#if $data01 != @1@ then
#endi
# return -1
#endi
#if $data20 != @2.449489743@ then
#if $data20 != @46340.950001052@ then
# return -1
#endi
#endi
#if $data21 != @2@ then
#if $data21 != @1@ then
# return -1
#endi
#endi
#if $data40 != @2.236067977@ then
#if $data40 != @2.000000000@ then
# return -1
#endi
#endi
#if $data41 != @2@ then
#if $data41 != @1@ then
# return -1
#endi
#endi
#if $data60 != @2.000000000@ then
#if $data60 != NULL then
# return -1
#endi
#endi
#if $data61 != @2@ then
#if $data61 != @1@ then
# return -1
#endi
#endi
#if $data80 != @1.414213562@ then
#if $data80 != @1.414213562@ then
# return -1
#endi
#endi
#if $data81 != @2@ then
#if $data81 != @1@ then
# return -1
#endi
#endi
print execute sql select sqrt(c4),t1,c4 from stb1 order by ts desc;
sql select sqrt(c4),t1,c4 from stb1 order by ts desc;
if $data00 != @2.645751311@ then
if $data00 != @-nan@ then
return -1
endi
endi
if $data01 != @2@ then
if $data01 != @1@ then
return -1
endi
endi
if $data20 != @2.449489743@ then
if $data20 != @46340.950001052@ then
return -1
endi
endi
if $data21 != @2@ then
if $data21 != @1@ then
return -1
endi
endi
if $data40 != @2.236067977@ then
if $data40 != @2.000000000@ then
return -1
endi
endi
if $data41 != @2@ then
if $data41 != @1@ then
return -1
endi
endi
if $data60 != @2.000000000@ then
if $data60 != NULL then
return -1
endi
endi
if $data61 != @2@ then
if $data61 != @1@ then
return -1
endi
endi
if $data80 != @1.414213562@ then
if $data80 != @1.414213562@ then
return -1
endi
endi
if $data81 != @2@ then
if $data81 != @1@ then
return -1
endi
endi
print execute sql select sqrt(c3),tbname from stb1;
sql select sqrt(c3),tbname from stb1;
if $data00 != @1.000000000@ then
......@@ -1073,111 +1074,3 @@ endi
if $data90 != @1.732050808@ then
return -1
endi
print execute sql select sqrt(stb1.c4),sqrt(stba.c5) from stb1,stba where stb1.t1=stba.t1 and stb1.ts=stba.ts;
#sql select sqrt(stb1.c4),sqrt(stba.c5) from stb1,stba where stb1.t1=stba.t1 and stb1.ts=stba.ts;
#if $data00 != @1.000000000@ then
# return -1
#endi
#if $data01 != @1.000000000@ then
# return -1
#endi
#if $data10 != NULL then
# return -1
#endi
#if $data11 != @1.414213562@ then
# return -1
#endi
#if $data20 != @1.414213562@ then
# return -1
#endi
#if $data21 != @1.732050808@ then
# return -1
#endi
#if $data30 != NULL then
# return -1
#endi
#if $data31 != @2.000000000@ then
# return -1
#endi
#if $data40 != @2.000000000@ then
# return -1
#endi
#if $data41 != @2.236067977@ then
# return -1
#endi
#if $data50 != @46340.950001052@ then
# return -1
#endi
#if $data51 != @2.449489743@ then
# return -1
#endi
#if $data60 != @-nan@ then
# return -1
#endi
#if $data61 != @2.645751311@ then
# return -1
#endi
#print execute sql select sqrt(c4) as a from stb1 union all select sqrt(c5) as a from stba;
#sql select sqrt(c4) as a from stb1 union all select sqrt(c5) as a from stba;
#if $data00 != @1.000000000@ then
# return -1
#endi
#if $data10 != NULL then
# return -1
#endi
#if $data20 != @1.414213562@ then
# return -1
#endi
#if $data30 != NULL then
# return -1
#endi
#if $data40 != @2.000000000@ then
# return -1
#endi
#if $data50 != @46340.950001052@ then
# return -1
#endi
#if $data60 != @-nan@ then
# return -1
#endi
#if $data70 != @1.000000000@ then
# return -1
#endi
#if $data80 != @1.414213562@ then
# return -1
#endi
#if $data90 != @1.414213562@ then
# return -1
#endi
#print execute sql select sqrt(c2) from stba;
#sql select sqrt(c2) from stba;
#if $data00 != @1.000000000@ then
# return -1
#endi
#if $data10 != @1.414213562@ then
# return -1
#endi
#if $data20 != @1.732050808@ then
# return -1
#endi
#if $data30 != @2.000000000@ then
# return -1
#endi
#if $data40 != @2.236067977@ then
# return -1
#endi
#if $data50 != @2.449489743@ then
# return -1
#endi
#if $data60 != @2.645751311@ then
# return -1
#endi
#if $data70 != @2.828427125@ then
# return -1
#endi
#if $data80 != @3.000000000@ then
# return -1
#endi
#if $data90 != @0.000000000@ then
# return -1
#endi
sleep 100
sql connect
sql use db;
print execute sql select sqrt(stb1.c4),sqrt(stba.c5) from stb1,stba where stb1.t1=stba.t1 and stb1.ts=stba.ts;
sql select sqrt(stb1.c4),sqrt(stba.c5) from stb1,stba where stb1.t1=stba.t1 and stb1.ts=stba.ts;
if $data00 != @1.000000000@ then
return -1
endi
if $data01 != @1.000000000@ then
return -1
endi
if $data10 != NULL then
return -1
endi
if $data11 != @1.414213562@ then
return -1
endi
if $data20 != @1.414213562@ then
return -1
endi
if $data21 != @1.732050808@ then
return -1
endi
if $data30 != NULL then
return -1
endi
if $data31 != @2.000000000@ then
return -1
endi
if $data40 != @2.000000000@ then
return -1
endi
if $data41 != @2.236067977@ then
return -1
endi
if $data50 != @46340.950001052@ then
return -1
endi
if $data51 != @2.449489743@ then
return -1
endi
if $data60 != @-nan@ then
return -1
endi
if $data61 != @2.645751311@ then
return -1
endi
print execute sql select sqrt(c4) as a from stb1 union all select sqrt(c5) as a from stba;
sql select sqrt(c4) as a from stb1 union all select sqrt(c5) as a from stba;
if $data00 != @1.000000000@ then
return -1
endi
if $data10 != NULL then
return -1
endi
if $data20 != @1.414213562@ then
return -1
endi
if $data30 != NULL then
return -1
endi
if $data40 != @2.000000000@ then
return -1
endi
if $data50 != @46340.950001052@ then
return -1
endi
if $data60 != @-nan@ then
return -1
endi
if $data70 != @1.000000000@ then
return -1
endi
if $data80 != @1.414213562@ then
return -1
endi
if $data90 != @1.414213562@ then
return -1
endi
print execute sql select sqrt(c2) from stba;
sql select sqrt(c2) from stba;
if $data00 != @1.000000000@ then
return -1
endi
if $data10 != @1.414213562@ then
return -1
endi
if $data20 != @1.732050808@ then
return -1
endi
if $data30 != @2.000000000@ then
return -1
endi
if $data40 != @2.236067977@ then
return -1
endi
if $data50 != @2.449489743@ then
return -1
endi
if $data60 != @2.645751311@ then
return -1
endi
if $data70 != @2.828427125@ then
return -1
endi
if $data80 != @3.000000000@ then
return -1
endi
if $data90 != @0.000000000@ then
return -1
endi
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册