[TBASE-816]
This commit is contained in:
parent
d3941fe95b
commit
d04354a8ac
|
@ -3786,10 +3786,11 @@ static void getStatics_i64(int64_t *primaryKey, int64_t *data, int32_t numOfRow,
|
|||
|
||||
static void getStatics_f(int64_t *primaryKey, float *data, int32_t numOfRow, double *min, double *max, double *sum,
|
||||
int16_t *minIndex, int16_t *maxIndex, int32_t *numOfNull) {
|
||||
*min = DBL_MAX;
|
||||
*max = -DBL_MAX;
|
||||
*minIndex = 0;
|
||||
*maxIndex = 0;
|
||||
float fmin = DBL_MAX;
|
||||
float fmax = -DBL_MAX;
|
||||
float fminIndex = 0;
|
||||
float fmaxIndex = 0;
|
||||
double dsum = 0;
|
||||
|
||||
assert(numOfRow <= INT16_MAX);
|
||||
|
||||
|
@ -3799,15 +3800,19 @@ static void getStatics_f(int64_t *primaryKey, float *data, int32_t numOfRow, dou
|
|||
continue;
|
||||
}
|
||||
|
||||
*sum += data[i];
|
||||
if (*min > data[i]) {
|
||||
*min = data[i];
|
||||
*minIndex = i;
|
||||
float fv = 0;
|
||||
*(int32_t*)(&fv) = *(int32_t*)(&(data[i]));
|
||||
|
||||
//*sum += data[i];
|
||||
dsum += fv;
|
||||
if (fmin > fv) {
|
||||
fmin = fv;
|
||||
fminIndex = i;
|
||||
}
|
||||
|
||||
if (*max < data[i]) {
|
||||
*max = data[i];
|
||||
*maxIndex = i;
|
||||
if (fmax < fv) {
|
||||
fmax = fv;
|
||||
fmaxIndex = i;
|
||||
}
|
||||
|
||||
// if (isNull(&lastVal, TSDB_DATA_TYPE_FLOAT)) {
|
||||
|
@ -3819,14 +3824,26 @@ static void getStatics_f(int64_t *primaryKey, float *data, int32_t numOfRow, dou
|
|||
// lastVal = data[i];
|
||||
// }
|
||||
}
|
||||
|
||||
double csum = 0;
|
||||
*(int64_t*)(&csum) = *(int64_t*)sum;
|
||||
csum += dsum;
|
||||
*(int64_t*)(sum) = *(int64_t*)(&csum);
|
||||
|
||||
*(int32_t*)max = *(int32_t*)(&fmax);
|
||||
*(int32_t*)min = *(int32_t*)(&fmin);
|
||||
*(int32_t*)minIndex = *(int32_t*)(&fminIndex);
|
||||
*(int32_t*)maxIndex = *(int32_t*)(&fmaxIndex);
|
||||
|
||||
}
|
||||
|
||||
static void getStatics_d(int64_t *primaryKey, double *data, int32_t numOfRow, double *min, double *max, double *sum,
|
||||
int16_t *minIndex, int16_t *maxIndex, int32_t *numOfNull) {
|
||||
*min = DBL_MAX;
|
||||
*max = -DBL_MAX;
|
||||
*minIndex = 0;
|
||||
*maxIndex = 0;
|
||||
double dmin = DBL_MAX;
|
||||
double dmax = -DBL_MAX;
|
||||
double dminIndex = 0;
|
||||
double dmaxIndex = 0;
|
||||
double dsum = 0;
|
||||
|
||||
assert(numOfRow <= INT16_MAX);
|
||||
|
||||
|
@ -3839,15 +3856,19 @@ static void getStatics_d(int64_t *primaryKey, double *data, int32_t numOfRow, do
|
|||
continue;
|
||||
}
|
||||
|
||||
*sum += data[i];
|
||||
if (*min > data[i]) {
|
||||
*min = data[i];
|
||||
*minIndex = i;
|
||||
double dv = 0;
|
||||
*(int64_t*)(&dv) = *(int64_t*)(&(data[i]));
|
||||
|
||||
//*sum += data[i];
|
||||
dsum += dv;
|
||||
if (dmin > dv) {
|
||||
dmin = dv;
|
||||
dminIndex = i;
|
||||
}
|
||||
|
||||
if (*max < data[i]) {
|
||||
*max = data[i];
|
||||
*maxIndex = i;
|
||||
if (dmax < dv) {
|
||||
dmax = dv;
|
||||
dmaxIndex = i;
|
||||
}
|
||||
|
||||
// if (isNull(&lastVal, TSDB_DATA_TYPE_DOUBLE)) {
|
||||
|
@ -3859,6 +3880,16 @@ static void getStatics_d(int64_t *primaryKey, double *data, int32_t numOfRow, do
|
|||
// lastVal = data[i];
|
||||
// }
|
||||
}
|
||||
|
||||
double csum = 0;
|
||||
*(int64_t*)(&csum) = *(int64_t*)sum;
|
||||
csum += dsum;
|
||||
*(int64_t*)(sum) = *(int64_t*)(&csum);
|
||||
|
||||
*(int64_t*)max = *(int64_t*)(&dmax);
|
||||
*(int64_t*)min = *(int64_t*)(&dmin);
|
||||
*(int64_t*)minIndex = *(int64_t*)(&dminIndex);
|
||||
*(int64_t*)maxIndex = *(int64_t*)(&dmaxIndex);
|
||||
}
|
||||
|
||||
void getStatistics(char *priData, char *data, int32_t size, int32_t numOfRow, int32_t type, int64_t *min, int64_t *max,
|
||||
|
|
|
@ -73,7 +73,7 @@ void tscSaveSlowQuery(SSqlObj *pSql) {
|
|||
const static int64_t SLOW_QUERY_INTERVAL = 3000000L;
|
||||
if (pSql->res.useconds < SLOW_QUERY_INTERVAL) return;
|
||||
|
||||
tscTrace("%p query time:%ld sql:%s", pSql, pSql->res.useconds, pSql->sqlstr);
|
||||
tscTrace("%p query time:%lld sql:%s", pSql, pSql->res.useconds, pSql->sqlstr);
|
||||
|
||||
char *sql = malloc(200);
|
||||
int len = snprintf(sql, 200, "insert into %s.slowquery values(now, '%s', %lld, %lld, '", tsMonitorDbName,
|
||||
|
|
|
@ -866,7 +866,8 @@ int vnodeSaveQueryResult(void *handle, char *data, int32_t *size) {
|
|||
pQInfo->pointsRead);
|
||||
|
||||
if (pQInfo->over == 0) {
|
||||
dTrace("QInfo:%p set query flag, oldSig:%p, func:%s", pQInfo, pQInfo->signature, __FUNCTION__);
|
||||
//dTrace("QInfo:%p set query flag, oldSig:%p, func:%s", pQInfo, pQInfo->signature, __FUNCTION__);
|
||||
dTrace("QInfo:%p set query flag, oldSig:%p", pQInfo, pQInfo->signature);
|
||||
uint64_t oldSignature = TSDB_QINFO_SET_QUERY_FLAG(pQInfo);
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in New Issue