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 2023/04/06 01:50:01 UTC
[kyuubi] branch branch-1.7 updated: [KYUUBI #4666] Support flink varbinary type in query operation
This is an automated email from the ASF dual-hosted git repository.
chengpan pushed a commit to branch branch-1.7
in repository https://gitbox.apache.org/repos/asf/kyuubi.git
The following commit(s) were added to refs/heads/branch-1.7 by this push:
new 6671ecd30 [KYUUBI #4666] Support flink varbinary type in query operation
6671ecd30 is described below
commit 6671ecd30215979c8a6319607f5a3c51acf5990b
Author: Ruguo Yu <ji...@163.com>
AuthorDate: Thu Apr 6 09:49:33 2023 +0800
[KYUUBI #4666] Support flink varbinary type in query operation
### _Why are the changes needed?_
closed #1770
Support flink `varbinary` type in query operation
### _How was this patch tested?_
- [x] 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.readthedocs.io/en/master/develop_tools/testing.html#running-tests) locally before make a pull request
Closes #4666 from yuruguo/support-flink-varbinary-type.
Closes #4666
e05675e03 [Ruguo Yu] Support flink varbinary type in query operation
Authored-by: Ruguo Yu <ji...@163.com>
Signed-off-by: Cheng Pan <ch...@apache.org>
(cherry picked from commit 1241a3891431cda602269bd49dcb8621ad77bbb5)
Signed-off-by: Cheng Pan <ch...@apache.org>
---
.../kyuubi/engine/flink/operation/ExecuteStatement.scala | 2 +-
.../scala/org/apache/kyuubi/engine/flink/schema/RowSet.scala | 3 ++-
.../kyuubi/engine/flink/operation/FlinkOperationSuite.scala | 10 ++++++++++
3 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/externals/kyuubi-flink-sql-engine/src/main/scala/org/apache/kyuubi/engine/flink/operation/ExecuteStatement.scala b/externals/kyuubi-flink-sql-engine/src/main/scala/org/apache/kyuubi/engine/flink/operation/ExecuteStatement.scala
index 976b39c2b..269ae8fc8 100644
--- a/externals/kyuubi-flink-sql-engine/src/main/scala/org/apache/kyuubi/engine/flink/operation/ExecuteStatement.scala
+++ b/externals/kyuubi-flink-sql-engine/src/main/scala/org/apache/kyuubi/engine/flink/operation/ExecuteStatement.scala
@@ -192,7 +192,7 @@ class ExecuteStatement(
row.setField(i, d.toObjectArray(arrayType.getElementType))
case _ =>
}
- case _: BinaryType =>
+ case _: BinaryType | _: VarBinaryType =>
row.setField(i, r.getBinary(i))
case _: BigIntType =>
row.setField(i, r.getLong(i))
diff --git a/externals/kyuubi-flink-sql-engine/src/main/scala/org/apache/kyuubi/engine/flink/schema/RowSet.scala b/externals/kyuubi-flink-sql-engine/src/main/scala/org/apache/kyuubi/engine/flink/schema/RowSet.scala
index ad83f9c2b..13cf5e717 100644
--- a/externals/kyuubi-flink-sql-engine/src/main/scala/org/apache/kyuubi/engine/flink/schema/RowSet.scala
+++ b/externals/kyuubi-flink-sql-engine/src/main/scala/org/apache/kyuubi/engine/flink/schema/RowSet.scala
@@ -307,6 +307,7 @@ object RowSet {
case _: MapType => TTypeId.MAP_TYPE
case _: RowType => TTypeId.STRUCT_TYPE
case _: BinaryType => TTypeId.BINARY_TYPE
+ case _: VarBinaryType => TTypeId.BINARY_TYPE
case _: TimeType => TTypeId.STRING_TYPE
case t @ (_: ZonedTimestampType | _: LocalZonedTimestampType | _: MultisetType |
_: YearMonthIntervalType | _: DayTimeIntervalType) =>
@@ -369,7 +370,7 @@ object RowSet {
// Only match string in nested type values
"\"" + s + "\""
- case (bin: Array[Byte], _: BinaryType) =>
+ case (bin: Array[Byte], _ @(_: BinaryType | _: VarBinaryType)) =>
new String(bin, StandardCharsets.UTF_8)
case (other, _) =>
diff --git a/externals/kyuubi-flink-sql-engine/src/test/scala/org/apache/kyuubi/engine/flink/operation/FlinkOperationSuite.scala b/externals/kyuubi-flink-sql-engine/src/test/scala/org/apache/kyuubi/engine/flink/operation/FlinkOperationSuite.scala
index 0b628010c..6c9ad5134 100644
--- a/externals/kyuubi-flink-sql-engine/src/test/scala/org/apache/kyuubi/engine/flink/operation/FlinkOperationSuite.scala
+++ b/externals/kyuubi-flink-sql-engine/src/test/scala/org/apache/kyuubi/engine/flink/operation/FlinkOperationSuite.scala
@@ -833,6 +833,16 @@ class FlinkOperationSuite extends WithFlinkSQLEngine with HiveJDBCTestHelper {
}
}
+ test("execute statement - select varbinary") {
+ withJdbcStatement() { statement =>
+ val resultSet = statement.executeQuery("select cast('kyuubi' as varbinary)")
+ assert(resultSet.next())
+ assert(resultSet.getString(1) == "kyuubi")
+ val metaData = resultSet.getMetaData
+ assert(metaData.getColumnType(1) === java.sql.Types.BINARY)
+ }
+ }
+
test("execute statement - select float") {
withJdbcStatement()({ statement =>
val resultSet = statement.executeQuery("SELECT cast(0.1 as float)")