This is an automated email from the ASF dual-hosted git repository.
yao 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 db98799 [KYUUBI #2019] Hive Backend Engine - GetTableTypes Operation
db98799 is described below
commit db9879980d9fc256b818c00a9d2395d8279dd375
Author: KenjiFujima <[email protected]>
AuthorDate: Fri Mar 18 22:02:49 2022 +0800
[KYUUBI #2019] Hive Backend Engine - GetTableTypes Operation
### _Why are the changes needed?_
Hive Backend Engine - GetTableTypes Operation.
### _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 #2170 from KenjiFujima/KYUUBI-2019.
Closes #2019
a2144b06 [KenjiFujima] [KYUUBI #2019] Hive Backend Engine - GetTableTypes
Operation
Authored-by: KenjiFujima <[email protected]>
Signed-off-by: Kent Yao <[email protected]>
---
.../engine/hive/operation/GetTableTypes.scala | 30 ++++++++++++++++++++++
.../hive/operation/HiveOperationManager.scala | 3 ++-
.../engine/hive/operation/HiveOperationSuite.scala | 14 ++++++++++
3 files changed, 46 insertions(+), 1 deletion(-)
diff --git
a/externals/kyuubi-hive-sql-engine/src/main/scala/org/apache/kyuubi/engine/hive/operation/GetTableTypes.scala
b/externals/kyuubi-hive-sql-engine/src/main/scala/org/apache/kyuubi/engine/hive/operation/GetTableTypes.scala
new file mode 100644
index 0000000..7046988
--- /dev/null
+++
b/externals/kyuubi-hive-sql-engine/src/main/scala/org/apache/kyuubi/engine/hive/operation/GetTableTypes.scala
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.kyuubi.engine.hive.operation
+
+import org.apache.hive.service.cli.operation.Operation
+
+import org.apache.kyuubi.operation.OperationType
+import org.apache.kyuubi.session.Session
+
+class GetTableTypes(session: Session)
+ extends HiveOperation(OperationType.GET_TABLE_TYPES, session) {
+
+ override val internalHiveOperation: Operation =
+ delegatedOperationManager.newGetTableTypesOperation(hive)
+}
diff --git
a/externals/kyuubi-hive-sql-engine/src/main/scala/org/apache/kyuubi/engine/hive/operation/HiveOperationManager.scala
b/externals/kyuubi-hive-sql-engine/src/main/scala/org/apache/kyuubi/engine/hive/operation/HiveOperationManager.scala
index 35277cc..68a4082 100644
---
a/externals/kyuubi-hive-sql-engine/src/main/scala/org/apache/kyuubi/engine/hive/operation/HiveOperationManager.scala
+++
b/externals/kyuubi-hive-sql-engine/src/main/scala/org/apache/kyuubi/engine/hive/operation/HiveOperationManager.scala
@@ -70,7 +70,8 @@ class HiveOperationManager() extends
OperationManager("HiveOperationManager") {
}
override def newGetTableTypesOperation(session: Session): Operation = {
- throw KyuubiSQLException.featureNotSupported()
+ val operation = new GetTableTypes(session)
+ addOperation(operation)
}
override def newGetColumnsOperation(
diff --git
a/externals/kyuubi-hive-sql-engine/src/test/scala/org/apache/kyuubi/engine/hive/operation/HiveOperationSuite.scala
b/externals/kyuubi-hive-sql-engine/src/test/scala/org/apache/kyuubi/engine/hive/operation/HiveOperationSuite.scala
index 1e4d2a6..1afe089 100644
---
a/externals/kyuubi-hive-sql-engine/src/test/scala/org/apache/kyuubi/engine/hive/operation/HiveOperationSuite.scala
+++
b/externals/kyuubi-hive-sql-engine/src/test/scala/org/apache/kyuubi/engine/hive/operation/HiveOperationSuite.scala
@@ -149,6 +149,20 @@ class HiveOperationSuite extends HiveJDBCTestHelper {
}
}
+ test("get table types") {
+ withJdbcStatement() { statement =>
+ val resultSet = statement.getConnection.getMetaData.getTableTypes
+ val expected = Set("TABLE", "VIEW", "INDEX_TABLE", "MATERIALIZED_VIEW")
+ var tableTypes = Set[String]()
+ while (resultSet.next()) {
+ assert(expected.contains(resultSet.getString(TABLE_TYPE)))
+ tableTypes += resultSet.getString(TABLE_TYPE)
+ }
+ assert(!resultSet.next())
+ assert(expected.size === tableTypes.size)
+ }
+ }
+
test("basic execute statements, create, insert query") {
withJdbcStatement("hive_engine_test") { statement =>
statement.execute("CREATE TABLE hive_engine_test(id int, value string)
stored as orc")