amrishlal commented on a change in pull request #6719:
URL: https://github.com/apache/incubator-pinot/pull/6719#discussion_r612097355



##########
File path: 
pinot-common/src/main/java/org/apache/pinot/common/utils/PinotDataType.java
##########
@@ -315,6 +408,58 @@ public Double convert(Object value, PinotDataType 
sourceType) {
     }
   },
 
+  TIMESTAMP {
+    @Override
+    public int toInt(Object value) {
+      throw new UnsupportedOperationException("Cannot convert value from 
TIMESTAMP to INTEGER");
+    }
+
+    @Override
+    public long toLong(Object value) {
+      return ((Timestamp) value).getTime();
+    }
+
+    @Override
+    public float toFloat(Object value) {
+      throw new UnsupportedOperationException("Cannot convert value from 
TIMESTAMP to FLOAT");
+    }
+
+    @Override
+    public double toDouble(Object value) {
+      return ((Timestamp) value).getTime();
+    }
+
+    @Override
+    public boolean toBoolean(Object value) {
+      throw new UnsupportedOperationException("Cannot convert value from 
TIMESTAMP to BOOLEAN");

Review comment:
       I would have done zero as `false` and all other timestamp values as 
`true`. This convention generalizes to work with everything and type conversion 
to `BOOLEAN` becomes simple :-)




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org
For additional commands, e-mail: commits-h...@pinot.apache.org

Reply via email to