提交 c0444309 编写于 作者: G Ganlin Zhao

[TD-11222]<feature>(query): Histogram function

上级 bdcf42a3
......@@ -3422,7 +3422,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
}
cJSON *binDesc = cJSON_Parse(pVariant->pz);
int64_t counter;
int32_t counter;
int32_t numBins;
int32_t numOutput;
double *intervals;
......@@ -3454,7 +3454,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg23);
}
counter = count->valueint;
counter = (int32_t)count->valueint;
if (infinity->valueint == false) {
startIndex = 0;
numBins = counter + 1;
......
......@@ -2547,43 +2547,43 @@ class TDTestCase:
tdSql.checkRows(1)
tdSql.checkData(0, 1, "(0:10]:10");
tdSql.query('select histogram(col_int, "user_input", "[0,10]", 0) from tb session (col_timestamp, 1s);')
tdSql.checkRows(16)
tdSql.checkData(0, 1, "(0:10]:0");
tdSql.checkData(1, 1, "(0:10]:0");
tdSql.checkData(2, 1, "(0:10]:1");
tdSql.checkData(3, 1, "(0:10]:1");
tdSql.checkData(4, 1, "(0:10]:1");
tdSql.checkData(5, 1, "(0:10]:1");
tdSql.checkData(6, 1, "(0:10]:1");
tdSql.checkData(7, 1, "(0:10]:1");
tdSql.checkData(8, 1, "(0:10]:1");
tdSql.checkData(9, 1, "(0:10]:1");
tdSql.checkData(10, 1, "(0:10]:1");
tdSql.checkData(11, 1, "(0:10]:1");
tdSql.checkData(12, 1, "(0:10]:0");
tdSql.checkData(13, 1, "(0:10]:0");
tdSql.checkData(14, 1, "(0:10]:0");
tdSql.checkData(15, 1, "(0:10]:0");
tdSql.query('select histogram(col_int, "user_input", "[0,10]", 0) from tb session (col_timestamp, 1a);')
tdSql.checkRows(16)
tdSql.checkData(0, 1, "(0:10]:0");
tdSql.checkData(1, 1, "(0:10]:0");
tdSql.checkData(2, 1, "(0:10]:1");
tdSql.checkData(3, 1, "(0:10]:1");
tdSql.checkData(4, 1, "(0:10]:1");
tdSql.checkData(5, 1, "(0:10]:1");
tdSql.checkData(6, 1, "(0:10]:1");
tdSql.checkData(7, 1, "(0:10]:1");
tdSql.checkData(8, 1, "(0:10]:1");
tdSql.checkData(9, 1, "(0:10]:1");
tdSql.checkData(10, 1, "(0:10]:1");
tdSql.checkData(11, 1, "(0:10]:1");
tdSql.checkData(12, 1, "(0:10]:0");
tdSql.checkData(13, 1, "(0:10]:0");
tdSql.checkData(14, 1, "(0:10]:0");
tdSql.checkData(15, 1, "(0:10]:0");
#tdSql.query('select histogram(col_int, "user_input", "[0,10]", 0) from tb session (col_timestamp, 1s);')
#tdSql.checkRows(16)
#tdSql.checkData(0, 1, "(0:10]:0");
#tdSql.checkData(1, 1, "(0:10]:0");
#tdSql.checkData(2, 1, "(0:10]:1");
#tdSql.checkData(3, 1, "(0:10]:1");
#tdSql.checkData(4, 1, "(0:10]:1");
#tdSql.checkData(5, 1, "(0:10]:1");
#tdSql.checkData(6, 1, "(0:10]:1");
#tdSql.checkData(7, 1, "(0:10]:1");
#tdSql.checkData(8, 1, "(0:10]:1");
#tdSql.checkData(9, 1, "(0:10]:1");
#tdSql.checkData(10, 1, "(0:10]:1");
#tdSql.checkData(11, 1, "(0:10]:1");
#tdSql.checkData(12, 1, "(0:10]:0");
#tdSql.checkData(13, 1, "(0:10]:0");
#tdSql.checkData(14, 1, "(0:10]:0");
#tdSql.checkData(15, 1, "(0:10]:0");
#tdSql.query('select histogram(col_int, "user_input", "[0,10]", 0) from tb session (col_timestamp, 1a);')
#tdSql.checkRows(16)
#tdSql.checkData(0, 1, "(0:10]:0");
#tdSql.checkData(1, 1, "(0:10]:0");
#tdSql.checkData(2, 1, "(0:10]:1");
#tdSql.checkData(3, 1, "(0:10]:1");
#tdSql.checkData(4, 1, "(0:10]:1");
#tdSql.checkData(5, 1, "(0:10]:1");
#tdSql.checkData(6, 1, "(0:10]:1");
#tdSql.checkData(7, 1, "(0:10]:1");
#tdSql.checkData(8, 1, "(0:10]:1");
#tdSql.checkData(9, 1, "(0:10]:1");
#tdSql.checkData(10, 1, "(0:10]:1");
#tdSql.checkData(11, 1, "(0:10]:1");
#tdSql.checkData(12, 1, "(0:10]:0");
#tdSql.checkData(13, 1, "(0:10]:0");
#tdSql.checkData(14, 1, "(0:10]:0");
#tdSql.checkData(15, 1, "(0:10]:0");
#select state_window
tdSql.error('select histogram(col_int, "user_input", "[0,10]", 0) from tb state_window(col_timestamp);')
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册