You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by GitBox <gi...@apache.org> on 2021/02/15 11:07:17 UTC

[GitHub] [incubator-pinot] KKcorps opened a new pull request #6581: Add support for getObject to Pinot JDBC driver

KKcorps opened a new pull request #6581:
URL: https://github.com/apache/incubator-pinot/pull/6581


   Currently, Pinot JDBC ResultSet doesn't support getObject. This PR addresses this issue. 
   Do note that only datatype supported by Pinot can be called and there is still no support for custom datatypes as well datatype conversion.


----------------------------------------------------------------
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:
users@infra.apache.org



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


[GitHub] [incubator-pinot] fx19880617 merged pull request #6581: Add support for getObject to Pinot JDBC driver

Posted by GitBox <gi...@apache.org>.
fx19880617 merged pull request #6581:
URL: https://github.com/apache/incubator-pinot/pull/6581


   


----------------------------------------------------------------
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:
users@infra.apache.org



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


[GitHub] [incubator-pinot] fx19880617 commented on a change in pull request #6581: Add support for getObject to Pinot JDBC driver

Posted by GitBox <gi...@apache.org>.
fx19880617 commented on a change in pull request #6581:
URL: https://github.com/apache/incubator-pinot/pull/6581#discussion_r576652602



##########
File path: pinot-clients/pinot-jdbc-client/src/main/java/org/apache/pinot/client/PinotResultSet.java
##########
@@ -297,6 +299,54 @@ public String getString(int columnIndex)
     return val;
   }
 
+  @Override
+  public Object getObject(int columnIndex)
+      throws SQLException {
+
+    String dataType = _columnDataTypes.getOrDefault(columnIndex, "");
+
+    if (dataType.isEmpty()) {
+      throw new SQLDataException("Data type not supported for " + dataType);
+    }
+
+    switch (dataType) {
+      case "STRING":
+        return getString(columnIndex);
+      case "INT":
+        return getInt(columnIndex);
+      case "LONG":
+        return getLong(columnIndex);
+      case "FLOAT":
+        return getFloat(columnIndex);
+      case "DOUBLE":
+        return getDouble(columnIndex);
+      case "BOOLEAN":
+        return getBoolean(columnIndex);
+      case "BYTES":
+        return getBytes(columnIndex);
+      default:
+        throw new SQLDataException("Data type not supported for " + dataType);
+    }
+  }
+
+  @Override
+  public <T> T getObject(int columnIndex, Class<T> type)

Review comment:
       Can you write a test for this? Wanna check if the type cast works




----------------------------------------------------------------
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:
users@infra.apache.org



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


[GitHub] [incubator-pinot] fx19880617 commented on a change in pull request #6581: Add support for getObject to Pinot JDBC driver

Posted by GitBox <gi...@apache.org>.
fx19880617 commented on a change in pull request #6581:
URL: https://github.com/apache/incubator-pinot/pull/6581#discussion_r576652602



##########
File path: pinot-clients/pinot-jdbc-client/src/main/java/org/apache/pinot/client/PinotResultSet.java
##########
@@ -297,6 +299,54 @@ public String getString(int columnIndex)
     return val;
   }
 
+  @Override
+  public Object getObject(int columnIndex)
+      throws SQLException {
+
+    String dataType = _columnDataTypes.getOrDefault(columnIndex, "");
+
+    if (dataType.isEmpty()) {
+      throw new SQLDataException("Data type not supported for " + dataType);
+    }
+
+    switch (dataType) {
+      case "STRING":
+        return getString(columnIndex);
+      case "INT":
+        return getInt(columnIndex);
+      case "LONG":
+        return getLong(columnIndex);
+      case "FLOAT":
+        return getFloat(columnIndex);
+      case "DOUBLE":
+        return getDouble(columnIndex);
+      case "BOOLEAN":
+        return getBoolean(columnIndex);
+      case "BYTES":
+        return getBytes(columnIndex);
+      default:
+        throw new SQLDataException("Data type not supported for " + dataType);
+    }
+  }
+
+  @Override
+  public <T> T getObject(int columnIndex, Class<T> type)

Review comment:
       Can you write a test for this?




----------------------------------------------------------------
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:
users@infra.apache.org



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