You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kyuubi.apache.org by ul...@apache.org on 2023/01/16 02:50:44 UTC
[kyuubi] branch master updated: [KYUUBI #4170] [Arrow] Fix `fallthrough` cases in type conversion and resultset handling in kyuubi-hive-jdbc
This is an automated email from the ASF dual-hosted git repository.
ulyssesyou pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kyuubi.git
The following commit(s) were added to refs/heads/master by this push:
new 3c5b09889 [KYUUBI #4170] [Arrow] Fix `fallthrough` cases in type conversion and resultset handling in kyuubi-hive-jdbc
3c5b09889 is described below
commit 3c5b0988912cdc0bf164288203091624c5bd002d
Author: liangbowen <li...@gf.com.cn>
AuthorDate: Mon Jan 16 10:50:27 2023 +0800
[KYUUBI #4170] [Arrow] Fix `fallthrough` cases in type conversion and resultset handling in kyuubi-hive-jdbc
### _Why are the changes needed?_
Fix possible `fallthrough` cases:
- in DECIMAL_TYPE case of `ArrowUtils#toArrowType`
- in "arrow" case of `KyuubiStatement#executeAsync`
The cases above are discovered from warning from javac output which will be eliminated after this PR:
```
/home/runner/work/kyuubi/kyuubi/kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/KyuubiStatement.java:283: warning: [fallthrough] possible fall-through into case
default:
^
/home/runner/work/kyuubi/kyuubi/kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/arrow/ArrowUtils.java:83: warning: [fallthrough] possible fall-through into case
case DATE_TYPE:
^
```
### _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
- [ ] [Run test](https://kyuubi.apache.org/docs/latest/develop_tools/testing.html#running-tests) locally before make a pull request
Closes #4170 from bowenliang123/arrow-fallthrough.
Closes #4170
be3d342e [liangbowen] fix fallthrough in "arrow" case of KyuubiStatement#executeAsync
07365d80 [liangbowen] fix fallthrough in DECIMAL_TYPE case of ArrowUtils#toArrowType
Authored-by: liangbowen <li...@gf.com.cn>
Signed-off-by: ulysses-you <ul...@apache.org>
---
.../src/main/java/org/apache/kyuubi/jdbc/hive/KyuubiStatement.java | 1 +
.../src/main/java/org/apache/kyuubi/jdbc/hive/arrow/ArrowUtils.java | 2 ++
2 files changed, 3 insertions(+)
diff --git a/kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/KyuubiStatement.java b/kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/KyuubiStatement.java
index ee3dc71a9..ab7c06a55 100644
--- a/kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/KyuubiStatement.java
+++ b/kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/KyuubiStatement.java
@@ -280,6 +280,7 @@ public class KyuubiStatement implements SQLStatement, KyuubiLoggable {
.setScrollable(isScrollableResultset)
.setSchema(columnNames, columnTypes, columnAttributes)
.build();
+ break;
default:
resultSet =
new KyuubiQueryResultSet.Builder(this)
diff --git a/kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/arrow/ArrowUtils.java b/kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/arrow/ArrowUtils.java
index 1d1587b54..9a777d4c2 100644
--- a/kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/arrow/ArrowUtils.java
+++ b/kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/arrow/ArrowUtils.java
@@ -79,6 +79,8 @@ public class ArrowUtils {
if (jdbcColumnAttributes != null) {
return ArrowType.Decimal.createDecimal(
jdbcColumnAttributes.precision, jdbcColumnAttributes.scale, null);
+ } else {
+ throw new IllegalStateException("Missing precision and scale where it is mandatory.");
}
case DATE_TYPE:
return new ArrowType.Date(DateUnit.DAY);