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

[TD-13589]<feature>(query): Improve Histogram function output as JSON string

上级 cda83bcb
......@@ -5100,10 +5100,10 @@ static void histogram_func_finalizer(SQLFunctionCtx *pCtx) {
int sz;
if (!pRes->normalized) {
int64_t count = (int64_t)pRes->orderedBins[i].count;
sz = sprintf(pCtx->pOutput + VARSTR_HEADER_SIZE, "(%g:%g]:%"PRId64,
sz = sprintf(pCtx->pOutput + VARSTR_HEADER_SIZE, "{\"lower_bin\":%g, \"upper_bin\":%g, \"count\":%"PRId64"}",
pRes->orderedBins[i].lower, pRes->orderedBins[i].upper, count);
} else {
sz = sprintf(pCtx->pOutput + VARSTR_HEADER_SIZE, "(%g:%g]:%lf",
sz = sprintf(pCtx->pOutput + VARSTR_HEADER_SIZE, "{\"lower_bin\":%g, \"upper_bin\":%g, \"count\":%lf}",
pRes->orderedBins[i].lower, pRes->orderedBins[i].upper, pRes->orderedBins[i].count);
}
varDataSetLen(pCtx->pOutput, sz);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册