提交 a18a2c0a 编写于 作者: Y yihaoDeng

[TD-4614]fix in operator bug

上级 f2e01999
...@@ -2287,7 +2287,7 @@ static bool doFilterByBlockStatistics(SQueryRuntimeEnv* pRuntimeEnv, SDataStatis ...@@ -2287,7 +2287,7 @@ static bool doFilterByBlockStatistics(SQueryRuntimeEnv* pRuntimeEnv, SDataStatis
if (pDataStatis == NULL || pQueryAttr->numOfFilterCols == 0) { if (pDataStatis == NULL || pQueryAttr->numOfFilterCols == 0) {
return true; return true;
} }
bool ret = true;
for (int32_t k = 0; k < pQueryAttr->numOfFilterCols; ++k) { for (int32_t k = 0; k < pQueryAttr->numOfFilterCols; ++k) {
SSingleColumnFilterInfo *pFilterInfo = &pQueryAttr->pFilterInfo[k]; SSingleColumnFilterInfo *pFilterInfo = &pQueryAttr->pFilterInfo[k];
...@@ -2324,26 +2324,34 @@ static bool doFilterByBlockStatistics(SQueryRuntimeEnv* pRuntimeEnv, SDataStatis ...@@ -2324,26 +2324,34 @@ static bool doFilterByBlockStatistics(SQueryRuntimeEnv* pRuntimeEnv, SDataStatis
} }
SDataStatis* pDataBlockst = &pDataStatis[index]; SDataStatis* pDataBlockst = &pDataStatis[index];
if (pFilterInfo->info.type == TSDB_DATA_TYPE_FLOAT) { if (pFilterInfo->info.type == TSDB_DATA_TYPE_FLOAT) {
float minval = (float)(*(double *)(&pDataBlockst->min)); float minval = (float)(*(double *)(&pDataBlockst->min));
float maxval = (float)(*(double *)(&pDataBlockst->max)); float maxval = (float)(*(double *)(&pDataBlockst->max));
for (int32_t i = 0; i < pFilterInfo->numOfFilters; ++i) { for (int32_t i = 0; i < pFilterInfo->numOfFilters; ++i) {
if (pFilterInfo->pFilters[i].fp(&pFilterInfo->pFilters[i], (char *)&minval, (char *)&maxval, TSDB_DATA_TYPE_FLOAT)) { if (pFilterInfo->pFilters[i].filterInfo.lowerRelOptr == TSDB_RELATION_IN) {
return true; continue;
}
ret &= pFilterInfo->pFilters[i].fp(&pFilterInfo->pFilters[i], (char *)&minval, (char *)&maxval, TSDB_DATA_TYPE_FLOAT);
if (ret == false) {
return false;
} }
} }
} else { } else {
for (int32_t i = 0; i < pFilterInfo->numOfFilters; ++i) { for (int32_t i = 0; i < pFilterInfo->numOfFilters; ++i) {
if (pFilterInfo->pFilters[i].fp(&pFilterInfo->pFilters[i], (char *)&pDataBlockst->min, (char *)&pDataBlockst->max, pFilterInfo->info.type)) { if (pFilterInfo->pFilters[i].filterInfo.lowerRelOptr == TSDB_RELATION_IN) {
return true; continue;
}
ret &= pFilterInfo->pFilters[i].fp(&pFilterInfo->pFilters[i], (char *)&pDataBlockst->min, (char *)&pDataBlockst->max, pFilterInfo->info.type);
if (ret == false) {
return false;
} }
} }
} }
} }
return false; return ret;
} }
static bool overlapWithTimeWindow(SQueryAttr* pQueryAttr, SDataBlockInfo* pBlockInfo) { static bool overlapWithTimeWindow(SQueryAttr* pQueryAttr, SDataBlockInfo* pBlockInfo) {
......
...@@ -90,11 +90,12 @@ uint32_t taosFloatHash(const char *key, uint32_t UNUSED_PARAM(len)) { ...@@ -90,11 +90,12 @@ uint32_t taosFloatHash(const char *key, uint32_t UNUSED_PARAM(len)) {
if (FLT_EQUAL(f, 0.0)) { if (FLT_EQUAL(f, 0.0)) {
return 0; return 0;
} }
if (f >= (FLT_MAX/BASE - DLT) || f <= (FLT_MIN/BASE - DLT)){ if (fabs(f) < FLT_MAX/BASE - DLT) {
return 0x7fc00000; int t = (int)(round(BASE * (f + DLT)));
return (uint32_t)t;
} else {
return 0x7fc00000;
} }
int t = (int)round(BASE * (f + DLT));
return (uint32_t)t;
} }
uint32_t taosDoubleHash(const char *key, uint32_t UNUSED_PARAM(len)) { uint32_t taosDoubleHash(const char *key, uint32_t UNUSED_PARAM(len)) {
double f = GET_DOUBLE_VAL(key); double f = GET_DOUBLE_VAL(key);
...@@ -105,11 +106,12 @@ uint32_t taosDoubleHash(const char *key, uint32_t UNUSED_PARAM(len)) { ...@@ -105,11 +106,12 @@ uint32_t taosDoubleHash(const char *key, uint32_t UNUSED_PARAM(len)) {
if (FLT_EQUAL(f, 0.0)) { if (FLT_EQUAL(f, 0.0)) {
return 0; return 0;
} }
if (f >= (DBL_MAX/BASE - DLT) || f <= (DBL_MIN/BASE - DLT)){ if (fabs(f) < DBL_MAX/BASE - DLT) {
return 0x7fc00000; int t = (int)(round(BASE * (f + DLT)));
} return (uint32_t)t;
int t = (int)(round(BASE * (f + DLT))); } else {
return (uint32_t)t; return 0x7fc00000;
}
} }
uint32_t taosIntHash_64(const char *key, uint32_t UNUSED_PARAM(len)) { uint32_t taosIntHash_64(const char *key, uint32_t UNUSED_PARAM(len)) {
uint64_t val = *(uint64_t *)key; uint64_t val = *(uint64_t *)key;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册