提交 72d8302f 编写于 作者: S Shenglian Zhou

[TD-4972]<fix>:fix error about double precision conversion on timestamp expr value

上级 4233a5a5
...@@ -3341,6 +3341,7 @@ static int32_t doExtractColumnFilterInfo(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, ...@@ -3341,6 +3341,7 @@ static int32_t doExtractColumnFilterInfo(SSqlCmd* pCmd, SQueryInfo* pQueryInfo,
if (pRight->flags & (1 << EXPR_FLAG_NS_TIMESTAMP)) { if (pRight->flags & (1 << EXPR_FLAG_NS_TIMESTAMP)) {
pRight->value.i64 = pRight->value.i64 =
convertTimePrecision(pRight->value.i64, TSDB_TIME_PRECISION_NANO, timePrecision); convertTimePrecision(pRight->value.i64, TSDB_TIME_PRECISION_NANO, timePrecision);
pRight->flags &= ~(1 << EXPR_FLAG_NS_TIMESTAMP);
} }
} }
...@@ -4905,6 +4906,7 @@ int32_t getTimeRange(STimeWindow* win, tSqlExpr* pRight, int32_t optr, int16_t t ...@@ -4905,6 +4906,7 @@ int32_t getTimeRange(STimeWindow* win, tSqlExpr* pRight, int32_t optr, int16_t t
*/ */
if (pRight->flags & (1 << EXPR_FLAG_NS_TIMESTAMP)) { if (pRight->flags & (1 << EXPR_FLAG_NS_TIMESTAMP)) {
pRight->value.i64 = convertTimePrecision(pRight->value.i64, TSDB_TIME_PRECISION_NANO, timePrecision); pRight->value.i64 = convertTimePrecision(pRight->value.i64, TSDB_TIME_PRECISION_NANO, timePrecision);
pRight->flags &= ~(1 << EXPR_FLAG_NS_TIMESTAMP);
} }
tVariantDump(&pRight->value, (char*)&val, TSDB_DATA_TYPE_BIGINT, true); tVariantDump(&pRight->value, (char*)&val, TSDB_DATA_TYPE_BIGINT, true);
......
...@@ -352,18 +352,24 @@ if $rows != 0 then ...@@ -352,18 +352,24 @@ if $rows != 0 then
return -1 return -1
endi endi
print ==========================> td-4783 print ==========================> td-4783,td-4792
sql create table where_ts(ts timestamp, f int) sql create table where_ts(ts timestamp, f int)
sql insert into where_ts values('2021-06-19 16:22:00', 1); sql insert into where_ts values('2021-06-19 16:22:00', 1);
sql insert into where_ts values('2021-06-19 16:23:00', 2); sql insert into where_ts values('2021-06-19 16:23:00', 2);
sql insert into where_ts values('2021-06-19 16:24:00', 3); sql insert into where_ts values('2021-06-19 16:24:00', 3);
sql insert into where_ts values('2021-06-19 16:25:00', 1); sql insert into where_ts values('2021-06-19 16:25:00', 1);
sql select * from (select * from where_ts) where ts<'2021-06-19 16:25:00' and ts>'2021-06-19 16:22:00' sql select * from (select * from where_ts) where ts<'2021-06-19 16:25:00' and ts>'2021-06-19 16:22:00'
if $row != 2 then if $rows != 2 then
return -1 return -1
endi endi
print $data00, $data01 print $data00, $data01
if $data01 != 2 then if $data01 != 2 then
return -1 return -1
endi endi
sql insert into where_ts values(now, 5);
sleep 10
sql select * from (select * from where_ts) where ts<now;
if $rows != 5 then
return -1
endi
system sh/exec.sh -n dnode1 -s stop -x SIGINT system sh/exec.sh -n dnode1 -s stop -x SIGINT
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册