You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kyuubi.apache.org by ch...@apache.org on 2022/09/14 05:14:12 UTC

[incubator-kyuubi] branch master updated: [KYUUBI #3484] Implement isSigned method of ResultSetMetaData for Kyuubi JDBC driver

This is an automated email from the ASF dual-hosted git repository.

chengpan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-kyuubi.git


The following commit(s) were added to refs/heads/master by this push:
     new 5d9836649 [KYUUBI #3484] Implement isSigned method of ResultSetMetaData for Kyuubi JDBC driver
5d9836649 is described below

commit 5d98366495564061f9df1fd753c17d5d46ece0ef
Author: Bowen Liang <li...@gf.com.cn>
AuthorDate: Wed Sep 14 13:14:01 2022 +0800

    [KYUUBI #3484] Implement isSigned method of ResultSetMetaData for Kyuubi JDBC driver
    
    ### _Why are the changes needed?_
    
    Implement isSigned method of ResultSetMetaData for KyuubiHiveDriver.
    
    isSigned is required in getSchema of Spark JDBC source. Without Implementing it, blue part is workaround for HiveDriver , but for KyuubiHiveDriver it will fail.
    
    ### _How was this patch tested?_
    - [ ] Add some test cases that check the changes thoroughly including negative and positive cases if possible
    
    - [ ] Add screenshots for manual tests if appropriate
    
    - [x] [Run test](https://kyuubi.apache.org/docs/latest/develop_tools/testing.html#running-tests) locally before make a pull request
    
    Closes #3485 from bowenliang123/3484-jdbcdriver-issigned.
    
    Closes #3484
    
    313d9f5b [Bowen Liang] implment isSigned method in KyuubiResultSetMetaData
    
    Authored-by: Bowen Liang <li...@gf.com.cn>
    Signed-off-by: Cheng Pan <ch...@apache.org>
---
 .../kyuubi/jdbc/hive/KyuubiResultSetMetaData.java  | 34 ++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/KyuubiResultSetMetaData.java b/kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/KyuubiResultSetMetaData.java
index 87e501c4f..bec1ca7fd 100644
--- a/kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/KyuubiResultSetMetaData.java
+++ b/kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/KyuubiResultSetMetaData.java
@@ -132,4 +132,38 @@ public class KyuubiResultSetMetaData implements SQLResultSetMetaData {
     }
     return column - 1;
   }
+
+  @Override
+  public boolean isSigned(int column) throws SQLException {
+    TTypeId typeId = columnTypes.get(toZeroIndex(column));
+    switch (typeId) {
+      case TINYINT_TYPE:
+      case SMALLINT_TYPE:
+      case INT_TYPE:
+      case BIGINT_TYPE:
+      case FLOAT_TYPE:
+      case DOUBLE_TYPE:
+      case DECIMAL_TYPE:
+      case TIMESTAMP_TYPE:
+      case DATE_TYPE:
+      case INTERVAL_YEAR_MONTH_TYPE:
+      case INTERVAL_DAY_TIME_TYPE:
+      case TIMESTAMPLOCALTZ_TYPE:
+        return true;
+
+      case BOOLEAN_TYPE:
+      case STRING_TYPE:
+      case VARCHAR_TYPE:
+      case CHAR_TYPE:
+      case NULL_TYPE:
+      case BINARY_TYPE:
+      case ARRAY_TYPE:
+      case MAP_TYPE:
+      case STRUCT_TYPE:
+      case UNION_TYPE:
+      case USER_DEFINED_TYPE:
+      default:
+        return false;
+    }
+  }
 }