提交 0cd76a53 编写于 作者: G Ganlin Zhao

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

上级 bb7ce4e0
...@@ -2681,7 +2681,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col ...@@ -2681,7 +2681,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
const char* msg22 = "invalid parameters for bin_desciption"; const char* msg22 = "invalid parameters for bin_desciption";
const char* msg23 = "parameter/bin out of range [-DBL_MAX, DBL_MAX]"; const char* msg23 = "parameter/bin out of range [-DBL_MAX, DBL_MAX]";
const char* msg24 = "width param cannot be 0"; const char* msg24 = "width param cannot be 0";
const char* msg25 = "count param should be greater than 0"; const char* msg25 = "count param should be in range [1, 1000]";
const char* msg26 = "start param cannot be 0 with 'log_bin'"; const char* msg26 = "start param cannot be 0 with 'log_bin'";
const char* msg27 = "factor param cannot be negative or equal to 0/1"; const char* msg27 = "factor param cannot be negative or equal to 0/1";
const char* msg28 = "the second paramter of diff should be 0 or 1"; const char* msg28 = "the second paramter of diff should be 0 or 1";
...@@ -3443,7 +3443,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col ...@@ -3443,7 +3443,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg22); return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg22);
} }
if (count->valueint <= 0) { if (count->valueint <= 0 || count->valueint > 1000) {
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg25); return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg25);
} }
......
...@@ -392,8 +392,8 @@ int32_t getResultDataInfo(int32_t dataType, int32_t dataBytes, int32_t functionI ...@@ -392,8 +392,8 @@ int32_t getResultDataInfo(int32_t dataType, int32_t dataBytes, int32_t functionI
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} else if (functionId == TSDB_FUNC_HISTOGRAM) { } else if (functionId == TSDB_FUNC_HISTOGRAM) {
*type = TSDB_DATA_TYPE_BINARY; *type = TSDB_DATA_TYPE_BINARY;
*bytes = (sizeof(SHistogramFuncInfo) + param * sizeof(SHistogramFuncBin)); *bytes = 512;
*interBytes = *bytes; *interBytes = (sizeof(SHistogramFuncInfo) + param * sizeof(SHistogramFuncBin));
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
} }
...@@ -501,8 +501,8 @@ int32_t getResultDataInfo(int32_t dataType, int32_t dataBytes, int32_t functionI ...@@ -501,8 +501,8 @@ int32_t getResultDataInfo(int32_t dataType, int32_t dataBytes, int32_t functionI
*interBytes = sizeof(SElapsedInfo); *interBytes = sizeof(SElapsedInfo);
} else if (functionId == TSDB_FUNC_HISTOGRAM) { } else if (functionId == TSDB_FUNC_HISTOGRAM) {
*type = TSDB_DATA_TYPE_BINARY; *type = TSDB_DATA_TYPE_BINARY;
*bytes = 1024; *bytes = 512;
*interBytes = *bytes; *interBytes = (sizeof(SHistogramFuncInfo) + param * sizeof(SHistogramFuncBin));
} else { } else {
return TSDB_CODE_TSC_INVALID_OPERATION; return TSDB_CODE_TSC_INVALID_OPERATION;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册