Volodymyr Vysotskyi created DRILL-6959:
------------------------------------------
Summary: Query with filter with cast to timestamp literal does not
return any results
Key: DRILL-6959
URL: https://issues.apache.org/jira/browse/DRILL-6959
Project: Apache Drill
Issue Type: Bug
Affects Versions: 1.15.0
Reporter: Volodymyr Vysotskyi
Assignee: Volodymyr Vysotskyi
Fix For: 1.16.0
When filter in the query has a cast of timestamp literal, the query does not
return any results.
Steps to reproduce:
1. Create a table with timestamp values with milliseconds
{code:sql}
create table dfs.tmp.test_timestamp_filter as (select timestamp '2018-01-01
12:12:12.123' as c1, timestamp '9999-12-31 23:59:59.999' as c2);
{code}
2. Run query with filter and cast to timestamp:
{code:sql}
select * from dfs.tmp.test_timestamp_filter where c1 = cast('2018-01-01
12:12:12.123' as timestamp(3));
{code}
This query should return a single row, but it does not return any results.
The following query returns the correct result:
{code:sql}
select * from dfs.tmp.test_timestamp_filter where c1 = timestamp '2018-01-01
12:12:12.123';
{code}
{noformat}
+--------------------------+--------------------------+
| c1 | c2 |
+--------------------------+--------------------------+
| 2018-01-01 12:12:12.123 | 9999-12-31 23:59:59.999 |
+--------------------------+--------------------------+
1 row selected (0.139 seconds)
{noformat}
The problem in {{DrillConstExecutor}}, when it used to simplify cast, timestamp
precision is lost and it is trimmed to the value with 0 precision.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)