carbondata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ravipes...@apache.org
Subject [05/15] carbondata git commit: [CARBONDATA-1661] Fixed bug related to display of timestamp values in presto
Date Fri, 10 Nov 2017 05:16:26 GMT
[CARBONDATA-1661] Fixed bug related to display of timestamp values in presto

This closes #1459


Project: http://git-wip-us.apache.org/repos/asf/carbondata/repo
Commit: http://git-wip-us.apache.org/repos/asf/carbondata/commit/fa193318
Tree: http://git-wip-us.apache.org/repos/asf/carbondata/tree/fa193318
Diff: http://git-wip-us.apache.org/repos/asf/carbondata/diff/fa193318

Branch: refs/heads/pre-aggregate
Commit: fa193318278ad7a85b887856c6126e9fdebfe41d
Parents: 4673113
Author: Geetika Gupta <geetika.gupta@knoldus.in>
Authored: Wed Nov 1 16:42:20 2017 +0530
Committer: chenliang613 <chenliang613@huawei.com>
Committed: Wed Nov 8 23:22:32 2017 +0800

----------------------------------------------------------------------
 .../java/org/apache/carbondata/presto/PrestoFilterUtil.java | 2 ++
 .../presto/integrationtest/PrestoAllDataTypeTest.scala      | 9 ++++++++-
 2 files changed, 10 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/carbondata/blob/fa193318/integration/presto/src/main/java/org/apache/carbondata/presto/PrestoFilterUtil.java
----------------------------------------------------------------------
diff --git a/integration/presto/src/main/java/org/apache/carbondata/presto/PrestoFilterUtil.java
b/integration/presto/src/main/java/org/apache/carbondata/presto/PrestoFilterUtil.java
index 0982254..b8b2032 100644
--- a/integration/presto/src/main/java/org/apache/carbondata/presto/PrestoFilterUtil.java
+++ b/integration/presto/src/main/java/org/apache/carbondata/presto/PrestoFilterUtil.java
@@ -261,6 +261,8 @@ public class PrestoFilterUtil {
         return new BigDecimal(new BigInteger(String.valueOf(rawdata)),
             ((DecimalType) type).getScale());
       }
+    } else if (type.equals(TimestampType.TIMESTAMP)) {
+      return (Long)rawdata * 1000;
     }
 
     return rawdata;

http://git-wip-us.apache.org/repos/asf/carbondata/blob/fa193318/integration/presto/src/test/scala/org/apache/carbondata/presto/integrationtest/PrestoAllDataTypeTest.scala
----------------------------------------------------------------------
diff --git a/integration/presto/src/test/scala/org/apache/carbondata/presto/integrationtest/PrestoAllDataTypeTest.scala
b/integration/presto/src/test/scala/org/apache/carbondata/presto/integrationtest/PrestoAllDataTypeTest.scala
index 433ddd4..5eb06e7 100644
--- a/integration/presto/src/test/scala/org/apache/carbondata/presto/integrationtest/PrestoAllDataTypeTest.scala
+++ b/integration/presto/src/test/scala/org/apache/carbondata/presto/integrationtest/PrestoAllDataTypeTest.scala
@@ -402,4 +402,11 @@ class PrestoAllDataTypeTest extends FunSuiteLike with BeforeAndAfterAll
{
 
     assert(actualResult.equals(expectedResult))
   }
-}
\ No newline at end of file
+
+  test("test timestamp datatype using cast operator") {
+    val actualResult: List[Map[String, Any]] = PrestoServer
+      .executeQuery("SELECT NAME AS RESULT FROM TESTDB.TESTTABLE WHERE DOB = CAST('2016-04-14
15:00:09' AS TIMESTAMP)")
+    val expectedResult: List[Map[String, Any]] = List(Map("RESULT" -> "jatin"))
+    assert(actualResult.equals(expectedResult))
+  }
+}


Mime
View raw message