opti:add case for double and float

This commit is contained in:
lyh250-666 2024-10-25 14:39:03 +08:00
parent b8725618f0
commit fa9f273449
2 changed files with 41 additions and 2 deletions

View File

@ -5034,8 +5034,13 @@ int32_t fltSclBuildRangePoints(SFltSclOperator *oper, SArray *points) {
SValueNode *valueNode = (SValueNode *)cell->pNode;
SFltSclDatum valDatum;
FLT_ERR_RET(fltSclBuildDatumFromValueNode(&valDatum, valueNode));
if(valueNode->node.resType.type == TSDB_DATA_TYPE_FLOAT || valueNode->node.resType.type == TSDB_DATA_TYPE_DOUBLE) {
minDatum.i = TMIN(minDatum.i, valDatum.d);
maxDatum.i = TMAX(maxDatum.i, valDatum.d);
} else {
minDatum.i = TMIN(minDatum.i, valDatum.i);
maxDatum.i = TMAX(maxDatum.i, valDatum.i);
}
cell = cell->pNext;
}
SFltSclPoint startPt = {.start = true, .excl = false, .val = minDatum};

View File

@ -95,4 +95,38 @@ endi
if $data20 != @ Time Range: [1657441840000, 1657441980000]@ then
return -1
endi
sql explain verbose true select * from tb1 where fts in ('2022-07-10 16:31:00', '2022-07-10 16:33:00', 1657441840000, true);
if $rows != 4 then
return -1
endi
if $data20 != @ Time Range: [0, 1657441980000]@ then
return -1
endi
sql explain verbose true select * from tb1 where fts in ('2022-07-10 16:31:00', '2022-07-10 16:33:00', 1657441840000, false);
if $rows != 4 then
return -1
endi
if $data20 != @ Time Range: [1, 1657441980000]@ then
return -1
endi
sql explain verbose true select * from tb1 where fts in ('2022-07-10 16:31:00', '2022-07-10 16:33:00', 1657441840000, 1.02);
if $rows != 4 then
return -1
endi
if $data20 != @ Time Range: [1, 1657441980000]@ then
return -1
endi
sql explain verbose true select * from tb1 where fts in ('2022-07-10 16:31:00', '2022-07-10 16:33:00', 1657441840000, -1.02);
if $rows != 4 then
return -1
endi
if $data20 != @ Time Range: [-1, 1657441980000]@ then
return -1
endi
sql_error explain verbose true select * from tb1 where fts in ('2022-07-10 16:31:00', '2022-07-10 16:33:00', 1657441840000, 'abc');
system sh/exec.sh -n dnode1 -s stop -x SIGINT