Hi,
I want to filter TIMESTAMP data. Below is my input:
f1,f2,f3,f4
1,2015-05-02,2015-05-02 05:02:15,2015-05-02 05:02:15
2,2014-02-03,2014-06-09 12:12:57,2015-05-02 05:02:15
3,2015-05-02,2013-05-02 15:52:15,2015-05-02 05:02:15
4,2014-02-03,2012-06-09 22:56:57,2015-05-02 05:02:15
below is list of lingual command :
lingual catalog --schema logP -add
lingual catalog --schema logP --stereotype logPVT --add --columns f1,f2,f3,f4 -type int,date,timestamp,timestamp
lingual catalog --schema logP --table logP2 --stereotype logPVT -add /user/hduser/timestampData.csv
Query :
1) Data in lingual table :
select * from "logP"."logP2"
output:
+-----+-------------+------------------------+------------------------+
| f1 | f2 | f3 | f4 |
+-----+-------------+------------------------+------------------------+
| 1 | 2015-05-02 | 2015-05-02 05:02:15.0 | 2015-05-02 05:02:15.0 |
| 2 | 2014-02-03 | 2014-06-09 12:12:57.0 | 2015-05-02 05:02:15.0 |
| 3 | 2015-05-02 | 2013-05-02 15:52:15.0 | 2015-05-02 05:02:15.0 |
| 4 | 2014-02-03 | 2012-06-09 22:56:57.0 | 2015-05-02 05:02:15.0 |
+-----+-------------+------------------------+------------------------+
2) comparing two timestamp field:
select * from "logP"."logP2" where "f3" = "f4";
output :
+-----+-------------+------------------------+------------------------+
| f1 | f2 | f3 | f4 |
+-----+-------------+------------------------+------------------------+
| 1 | 2015-05-02 | 2015-05-02 05:02:15.0 | 2015-05-02 05:02:15.0 |
+-----+-------------+------------------------+------------------------+
It produces correct result.
3) Comparing TIMESTAMP field with literals(constants) :
select * from "logP"."logP2" where "f3" = timestamp '2015-05-02 05:02:15.0';
actual output :
+-----+-----+-----+-----+
| f1 | f2 | f3 | f4 |
+-----+-----+-----+-----+
+-----+-----+-----+-----+
select * from "logP"."logP2" where "f3" = timestamp '2015-05-02 05:02:15';
actual output :
+-----+-----+-----+-----+
| f1 | f2 | f3 | f4 |
+-----+-----+-----+-----+
+-----+-----+-----+-----+
expected result :
+-----+-------------+------------------------+------------------------+
| f1 | f2 | f3 | f4 |
+-----+-------------+------------------------+------------------------+
| 1 | 2015-05-02 | 2015-05-02 05:02:15.0 | 2015-05-02 05:02:15.0 |
+-----+-------------+------------------------+------------------------+
Can any body point out where i am doing wrong or any other way to compare TIMESTAMP field equals literal(constant), why actual and excepted results are differ.
why while comparing timestamp with literal is not giving any results.
i am using lingual 1.2.1 and Hadoop 2.6.0-cdh5.4.2
Thanks
Santlal Gupta