FangYongs commented on code in PR #22757:
URL: https://github.com/apache/flink/pull/22757#discussion_r1226192007


##########
flink-table/flink-sql-jdbc-driver/src/main/java/org/apache/flink/table/jdbc/FlinkResultSet.java:
##########
@@ -353,8 +373,67 @@ public ResultSetMetaData getMetaData() throws SQLException 
{
 
     @Override
     public Object getObject(int columnIndex) throws SQLException {
-        // TODO support get object
-        throw new SQLFeatureNotSupportedException("FlinkResultSet#getObject is 
not supported");
+        checkClosed();
+        checkValidRow();
+        checkValidColumn(columnIndex);
+        try {
+            Object object = fieldGetterList.get(columnIndex - 
1).getFieldOrNull(currentRow);
+            DataType dataType = dataTypeList.get(columnIndex - 1);
+            return convertToJavaObject(object, dataType.getLogicalType());
+        } catch (Exception e) {
+            throw new SQLDataException(e);
+        }
+    }
+
+    private Object convertToJavaObject(Object object, LogicalType dataType) 
throws SQLException {
+        switch (dataType.getTypeRoot()) {
+            case BOOLEAN:
+            case TINYINT:
+            case SMALLINT:
+            case INTEGER:
+            case BIGINT:
+            case FLOAT:
+            case DOUBLE:
+            case BINARY:
+            case VARBINARY:
+                {
+                    return object;
+                }
+            case VARCHAR:
+            case CHAR:
+                {
+                    return object.toString();

Review Comment:
   Thanks @libenchao , added



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to