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



##########
File path: 
pinot-common/src/main/java/org/apache/pinot/common/utils/PinotDataType.java
##########
@@ -538,6 +540,64 @@ public String convert(Object value, PinotDataType 
sourceType) {
     }
   },
 
+  JSON {
+    @Override
+    public int toInt(Object value) {
+      return Integer.parseInt(value.toString().trim());
+    }
+
+    @Override
+    public long toLong(Object value) {
+      return Long.parseLong(value.toString().trim());
+    }
+
+    @Override
+    public float toFloat(Object value) {
+      return Float.parseFloat(value.toString().trim());
+    }
+
+    @Override
+    public double toDouble(Object value) {
+      return Double.parseDouble(value.toString().trim());
+    }
+
+    @Override
+    public boolean toBoolean(Object value) {
+      return Boolean.parseBoolean(value.toString().trim());
+    }
+
+    @Override
+    public Timestamp toTimestamp(Object value) {
+      return (value instanceof Long) ? new Timestamp(((Long) 
value).longValue())
+          : Timestamp.valueOf(value.toString().trim());
+    }
+
+    @Override
+    public String toString(Object value) {
+      return value.toString();
+    }
+
+    @Override
+    public byte[] toBytes(Object value) {
+      if (value instanceof String) {
+        // Assume that input JSON string value is Base64 encoded.
+        try {
+          return Base64.getDecoder().decode(((String) 
value).getBytes("UTF-8"));

Review comment:
       Fixed.




-- 
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