Skip to content

Commit 95e3558

Browse files
bowenliang123pan3793
authored andcommitted
[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 313d9f5 [Bowen Liang] implment isSigned method in KyuubiResultSetMetaData Authored-by: Bowen Liang <liangbowen@gf.com.cn> Signed-off-by: Cheng Pan <chengpan@apache.org> (cherry picked from commit 5d98366) Signed-off-by: Cheng Pan <chengpan@apache.org>
1 parent dc41500 commit 95e3558

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/KyuubiResultSetMetaData.java

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,4 +132,38 @@ protected int toZeroIndex(int column) throws SQLException {
132132
}
133133
return column - 1;
134134
}
135+
136+
@Override
137+
public boolean isSigned(int column) throws SQLException {
138+
TTypeId typeId = columnTypes.get(toZeroIndex(column));
139+
switch (typeId) {
140+
case TINYINT_TYPE:
141+
case SMALLINT_TYPE:
142+
case INT_TYPE:
143+
case BIGINT_TYPE:
144+
case FLOAT_TYPE:
145+
case DOUBLE_TYPE:
146+
case DECIMAL_TYPE:
147+
case TIMESTAMP_TYPE:
148+
case DATE_TYPE:
149+
case INTERVAL_YEAR_MONTH_TYPE:
150+
case INTERVAL_DAY_TIME_TYPE:
151+
case TIMESTAMPLOCALTZ_TYPE:
152+
return true;
153+
154+
case BOOLEAN_TYPE:
155+
case STRING_TYPE:
156+
case VARCHAR_TYPE:
157+
case CHAR_TYPE:
158+
case NULL_TYPE:
159+
case BINARY_TYPE:
160+
case ARRAY_TYPE:
161+
case MAP_TYPE:
162+
case STRUCT_TYPE:
163+
case UNION_TYPE:
164+
case USER_DEFINED_TYPE:
165+
default:
166+
return false;
167+
}
168+
}
135169
}

0 commit comments

Comments
 (0)