From b4f4ce9e850130e7286f5d7d648ee385ea00011d Mon Sep 17 00:00:00 2001 From: Ganlin Zhao Date: Fri, 21 Jan 2022 10:27:54 +0800 Subject: [PATCH] [TD-11222]: Histogram function --- src/client/src/tscSQLParser.c | 3 ++- tests/develop-test/2-query/function_histogram.py | 10 ++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c index 68717c551b..d87b073642 100644 --- a/src/client/src/tscSQLParser.c +++ b/src/client/src/tscSQLParser.c @@ -3428,7 +3428,8 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col if (isinf(start->valuedouble) || (width != NULL && isinf(width->valuedouble)) || - (factor != NULL && isinf(factor->valuedouble))) { + (factor != NULL && isinf(factor->valuedouble)) || + (count != NULL && isinf(count->valuedouble))) { return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg23); } diff --git a/tests/develop-test/2-query/function_histogram.py b/tests/develop-test/2-query/function_histogram.py index a2ee171a5d..f77686df02 100644 --- a/tests/develop-test/2-query/function_histogram.py +++ b/tests/develop-test/2-query/function_histogram.py @@ -1057,6 +1057,16 @@ class TDTestCase: tdSql.error('select histogram(col_tinyint, \'linear_bin\', \'{"start": 0, "width": 1, "count": "abc", "infinity": true}\', 0) from stb;') tdSql.error('select histogram(col_tinyint, \'linear_bin\', \'{"start": 0, "width": 1, "count": "中文", "infinity": true}\', 0) from stb;') tdSql.error('select histogram(col_tinyint, \'linear_bin\', \'{"start": 0, "width": 1, "count": abc, "infinity": true}\', 0) from stb;') + tdSql.error('select histogram(col_tinyint, \'linear_bin\', \'{"start": 0, "width": 1, "count": 1.8e+308, "infinity": true}\', 0) from stb;') + tdSql.error('select histogram(col_tinyint, \'linear_bin\', \'{"start": 0, "width": 1, "count": -1.8e+308, "infinity": true}\', 0) from stb;') + + tdSql.error('select histogram(col_tinyint, \'linear_bin\', \'{"start": 0, "width": 1, "count": 1, "infinity": 1}\', 0) from stb;') + tdSql.error('select histogram(col_tinyint, \'linear_bin\', \'{"start": 0, "width": 1, "count": 1, "infinity": 0}\', 0) from stb;') + tdSql.error('select histogram(col_tinyint, \'linear_bin\', \'{"start": 0, "width": 1, "count": 1, "infinity": -1.5}\', 0) from stb;') + tdSql.error('select histogram(col_tinyint, \'linear_bin\', \'{"start": 0, "width": 1, "count": 1, "infinity": 1.8e+308}\', 0) from stb;') + tdSql.error('select histogram(col_tinyint, \'linear_bin\', \'{"start": 0, "width": 1, "count": 1, "infinity": "abc"}\', 0) from stb;') + tdSql.error('select histogram(col_tinyint, \'linear_bin\', \'{"start": 0, "width": 1, "count": 1, "infinity": "中文"}\', 0) from stb;') + tdSql.error('select histogram(col_tinyint, \'linear_bin\', \'{"start": 0, "width": 1, "count": 1, "infinity": abc}\', 0) from stb;') return tdSql.execute('drop database db') -- GitLab