You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@kyuubi.apache.org by "ymZhao1001 (via GitHub)" <gi...@apache.org> on 2023/09/18 06:53:43 UTC
[GitHub] [kyuubi] ymZhao1001 opened a new pull request, #5303: KYUUBI #5302] add hive support for the JDBC engine to run hive2 sql
ymZhao1001 opened a new pull request, #5303:
URL: https://github.com/apache/kyuubi/pull/5303
<!--
Thanks for sending a pull request!
Here are some tips for you:
1. If this is your first time, please read our contributor guidelines: https://kyuubi.readthedocs.io/en/latest/community/CONTRIBUTING.html
2. If the PR is related to an issue in https://github.com/apache/kyuubi/issues, add '[KYUUBI #XXXX]' in your PR title, e.g., '[KYUUBI #XXXX] Your PR title ...'.
3. If the PR is unfinished, add '[WIP]' in your PR title, e.g., '[WIP][KYUUBI #XXXX] Your PR title ...'.
-->
### _Why are the changes needed?_
<!--
Please clarify why the changes are needed. For instance,
1. If you add a feature, you can talk about the use case of it.
2. If you fix a bug, you can clarify why it is a bug.
-->
### _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.readthedocs.io/en/master/contributing/code/testing.html#running-tests) locally before make a pull request
### _Was this patch authored or co-authored using generative AI tooling?_
<!--
If a generative AI tooling has been used in the process of authoring this patch, please include
phrase 'Generated-by: ' followed by the name of the tool and its version.
If no, write 'No'.
Please refer to the [ASF Generative Tooling Guidance](https://www.apache.org/legal/generative-tooling.html) for details.
-->
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org
[GitHub] [kyuubi] pan3793 commented on a diff in pull request #5303: [KYUUBI #5302] add hive support for the JDBC engine to run hive2 sql
Posted by "pan3793 (via GitHub)" <gi...@apache.org>.
pan3793 commented on code in PR #5303:
URL: https://github.com/apache/kyuubi/pull/5303#discussion_r1328339320
##########
externals/kyuubi-jdbc-engine/src/main/scala/org/apache/kyuubi/engine/jdbc/hive/HiveRowSetHelper.scala:
##########
@@ -0,0 +1,158 @@
+/*
+ * 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.jdbc.hive
+
+import java.sql.{Date, Types}
+import java.time.LocalDateTime
+
+import scala.collection.JavaConverters._
+
+import org.apache.hive.service.rpc.thrift._
+
+import org.apache.kyuubi.engine.jdbc.schema.{Column, RowSetHelper}
+import org.apache.kyuubi.util.RowSetUtils.{bitSetToBuffer, formatDate, formatLocalDateTime}
+
+class HiveRowSetHelper extends RowSetHelper {
+
+ protected def toTColumn(
+ rows: Seq[Seq[Any]],
+ ordinal: Int,
+ sqlType: Int): TColumn = {
+ val nulls = new java.util.BitSet()
+ sqlType match {
+ case Types.BIT | Types.BOOLEAN =>
+ val values = getOrSetAsNull[java.lang.Boolean](rows, ordinal, nulls, true)
+ TColumn.boolVal(new TBoolColumn(values, nulls))
+
+ case Types.TINYINT =>
+ val values = getOrSetAsNull[java.lang.Byte](rows, ordinal, nulls, 0.toByte)
+ TColumn.byteVal(new TByteColumn(values, nulls))
+
+ case Types.SMALLINT =>
+ val values = getOrSetAsNull[java.lang.Short](rows, ordinal, nulls, 0.toShort)
+ TColumn.i16Val(new TI16Column(values, nulls))
+
+ case Types.INTEGER =>
+ val values = getOrSetAsNull[java.lang.Integer](rows, ordinal, nulls, 0)
+ TColumn.i32Val(new TI32Column(values, nulls))
+
+ case Types.BIGINT =>
+ val values = getOrSetAsNull[java.lang.Long](rows, ordinal, nulls, 0L)
+ TColumn.i64Val(new TI64Column(values, nulls))
+
+ case Types.REAL | Types.FLOAT =>
+ val values = getOrSetAsNull[java.lang.Float](rows, ordinal, nulls, 0.toFloat)
+ .asScala.map(n => java.lang.Double.valueOf(n.toString)).asJava
+ TColumn.doubleVal(new TDoubleColumn(values, nulls))
+
+ case Types.DOUBLE =>
+ val values = getOrSetAsNull[java.lang.Double](rows, ordinal, nulls, 0.toDouble)
+ TColumn.doubleVal(new TDoubleColumn(values, nulls))
+
+ case Types.CHAR | Types.VARCHAR =>
+ val values = getOrSetAsNull[String](rows, ordinal, nulls, "")
+ TColumn.stringVal(new TStringColumn(values, nulls))
+
+ case _ =>
+ val rowSize = rows.length
+ val values = new java.util.ArrayList[String](rowSize)
+ var i = 0
+ while (i < rowSize) {
+ val row = rows(i)
+ nulls.set(i, row(ordinal) == null)
+ val value =
+ if (row(ordinal) == null) {
+ ""
+ } else {
+ toHiveString(row(ordinal), sqlType)
+ }
+ values.add(value)
+ i += 1
+ }
+ TColumn.stringVal(new TStringColumn(values, nulls))
+ }
+ }
+
+ protected def toTColumnValue(ordinal: Int, row: List[Any], types: List[Column]): TColumnValue = {
+ types(ordinal).sqlType match {
+ case Types.BIT | Types.BOOLEAN =>
+ val boolValue = new TBoolValue
+ if (row(ordinal) != null) boolValue.setValue(row(ordinal).asInstanceOf[Boolean])
+ TColumnValue.boolVal(boolValue)
+
+ case Types.TINYINT =>
+ val byteValue = new TByteValue()
+ if (row(ordinal) != null) byteValue.setValue(row(ordinal).asInstanceOf[Byte])
+ TColumnValue.byteVal(byteValue)
+
+ case Types.SMALLINT =>
+ val tI16Value = new TI16Value()
+ if (row(ordinal) != null) tI16Value.setValue(row(ordinal).asInstanceOf[Short])
+ TColumnValue.i16Val(tI16Value)
+
+ case Types.INTEGER =>
+ val tI32Value = new TI32Value
+ if (row(ordinal) != null) tI32Value.setValue(row(ordinal).asInstanceOf[Int])
+ TColumnValue.i32Val(tI32Value)
+
+ case Types.BIGINT =>
+ val tI64Value = new TI64Value
+ if (row(ordinal) != null) tI64Value.setValue(row(ordinal).asInstanceOf[Long])
+ TColumnValue.i64Val(tI64Value)
+
+ case Types.REAL | Types.FLOAT =>
+ val tDoubleValue = new TDoubleValue
+ if (row(ordinal) != null) {
+ val doubleValue = java.lang.Double.valueOf(row(ordinal).asInstanceOf[Float].toString)
+ tDoubleValue.setValue(doubleValue)
+ }
+ TColumnValue.doubleVal(tDoubleValue)
+
+ case Types.DOUBLE =>
+ val tDoubleValue = new TDoubleValue
+ if (row(ordinal) != null) tDoubleValue.setValue(row(ordinal).asInstanceOf[Double])
+ TColumnValue.doubleVal(tDoubleValue)
+
+ case Types.CHAR | Types.VARCHAR =>
+ val tStringValue = new TStringValue
+ if (row(ordinal) != null) tStringValue.setValue(row(ordinal).asInstanceOf[String])
+ TColumnValue.stringVal(tStringValue)
+
+ case _ =>
+ val tStrValue = new TStringValue
+ if (row(ordinal) != null) {
+ tStrValue.setValue(
+ toHiveString(row(ordinal), types(ordinal).sqlType))
+ }
+ TColumnValue.stringVal(tStrValue)
+ }
+ }
+
+ protected def toHiveString(data: Any, sqlType: Int): String = {
+ (data, sqlType) match {
+ case (date: Date, Types.DATE) =>
+ formatDate(date)
+ case (dateTime: LocalDateTime, Types.TIMESTAMP) =>
+ formatLocalDateTime(dateTime)
+ case (decimal: java.math.BigDecimal, Types.DECIMAL) =>
+ decimal.toPlainString
+ // TODO support bitmap and hll
Review Comment:
Does Hive support such things?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org
[GitHub] [kyuubi] codecov-commenter commented on pull request #5303: [KYUUBI #5302] add hive support for the JDBC engine to run hive2 sql
Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #5303:
URL: https://github.com/apache/kyuubi/pull/5303#issuecomment-1723010993
## [Codecov](https://app.codecov.io/gh/apache/kyuubi/pull/5303?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
> Merging [#5303](https://app.codecov.io/gh/apache/kyuubi/pull/5303?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) (ffc0cf1) into [master](https://app.codecov.io/gh/apache/kyuubi/commit/814b0513081c6ec0657842f96a657f37ccb148fe?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) (814b051) will **not change** coverage.
> Report is 1 commits behind head on master.
> The diff coverage is `n/a`.
> :exclamation: Current head ffc0cf1 differs from pull request most recent head a9e2daf. Consider uploading reports for the commit a9e2daf to get more accurate results
```diff
@@ Coverage Diff @@
## master #5303 +/- ##
======================================
Coverage 0.00% 0.00%
======================================
Files 590 590
Lines 33368 33368
Branches 4413 4413
======================================
Misses 33368 33368
```
:mega: We’re building smart automated test selection to slash your CI/CD build times. [Learn more](https://about.codecov.io/iterative-testing/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org
[GitHub] [kyuubi] pan3793 commented on pull request #5303: [KYUUBI #5302] add hive support for the JDBC engine to run hive2 sql
Posted by "pan3793 (via GitHub)" <gi...@apache.org>.
pan3793 commented on PR #5303:
URL: https://github.com/apache/kyuubi/pull/5303#issuecomment-1722879807
Generally, the integration test is required on adding new dialect to JDBC engine to ensure the implementation correctness.
https://github.com/apache/kyuubi/blob/3cf5a20b7a9b1e58764a1ada981cb5a68b69e70e/integration-tests/kyuubi-jdbc-it/src/test/scala/org/apache/kyuubi/it/jdbc/doris/OperationWithServerSuite.scala
And please fill in the PR description, such information is VERY important to an open-source project for community cooperation.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org
[GitHub] [kyuubi] ymZhao1001 commented on a diff in pull request #5303: [KYUUBI #5302] add hive support for the JDBC engine to run hive2 sql
Posted by "ymZhao1001 (via GitHub)" <gi...@apache.org>.
ymZhao1001 commented on code in PR #5303:
URL: https://github.com/apache/kyuubi/pull/5303#discussion_r1328343535
##########
externals/kyuubi-jdbc-engine/src/main/scala/org/apache/kyuubi/engine/jdbc/dialect/HiveDialect.scala:
##########
@@ -0,0 +1,93 @@
+/*
+ * 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.jdbc.dialect
+
+import java.sql.{Connection, ResultSet, Statement}
+import java.util
+
+import org.apache.kyuubi.KyuubiSQLException
+import org.apache.kyuubi.engine.jdbc.hive.{HiveRowSetHelper, HiveSchemaHelper}
+import org.apache.kyuubi.engine.jdbc.schema.{RowSetHelper, SchemaHelper}
+import org.apache.kyuubi.operation.Operation
+import org.apache.kyuubi.session.Session
+
+class HiveDialect extends JdbcDialect {
+
+ override def createStatement(connection: Connection, fetchSize: Int): Statement = {
+ val statement =
+ connection.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY)
+ statement.setFetchSize(fetchSize)
+ statement
+ }
+
+ override def getTypeInfoOperation(session: Session): Operation = {
+ throw KyuubiSQLException.featureNotSupported()
+ }
+
+ override def getCatalogsOperation(session: Session): Operation = {
+ throw KyuubiSQLException.featureNotSupported()
+ }
+
+ override def getSchemasOperation(session: Session): Operation = {
+ throw KyuubiSQLException.featureNotSupported()
Review Comment:
@pan3793 ok. i just try this idea, and want to know, Is it necessary to use jdbc to support hive (or hive2)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org
[GitHub] [kyuubi] ymZhao1001 commented on pull request #5303: [KYUUBI #5302] add hive support for the JDBC engine to run hive2 sql
Posted by "ymZhao1001 (via GitHub)" <gi...@apache.org>.
ymZhao1001 commented on PR #5303:
URL: https://github.com/apache/kyuubi/pull/5303#issuecomment-1722844943
[https://github.com/apache/kyuubi/issues/5302](url)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org
Re: [PR] [KYUUBI #5302] add hive support for the JDBC engine to run hive2 sql [kyuubi]
Posted by "hungrytortoise (via GitHub)" <gi...@apache.org>.
hungrytortoise commented on PR #5303:
URL: https://github.com/apache/kyuubi/pull/5303#issuecomment-1865973310
why closed this topic,it's very useful ithink
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org
Re: [PR] [KYUUBI #5302] add hive support for the JDBC engine to run hive2 sql [kyuubi]
Posted by "ymZhao1001 (via GitHub)" <gi...@apache.org>.
ymZhao1001 closed pull request #5303: [KYUUBI #5302] add hive support for the JDBC engine to run hive2 sql
URL: https://github.com/apache/kyuubi/pull/5303
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org
Re: [PR] [KYUUBI #5302] add hive support for the JDBC engine to run hive2 sql [kyuubi]
Posted by "ic4y (via GitHub)" <gi...@apache.org>.
ic4y commented on PR #5303:
URL: https://github.com/apache/kyuubi/pull/5303#issuecomment-2160251596
This is a very useful feature, why not continue to promote it? @ymZhao1001 @pan3793
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org
[GitHub] [kyuubi] pan3793 commented on a diff in pull request #5303: [KYUUBI #5302] add hive support for the JDBC engine to run hive2 sql
Posted by "pan3793 (via GitHub)" <gi...@apache.org>.
pan3793 commented on code in PR #5303:
URL: https://github.com/apache/kyuubi/pull/5303#discussion_r1328338755
##########
externals/kyuubi-jdbc-engine/src/main/scala/org/apache/kyuubi/engine/jdbc/dialect/HiveDialect.scala:
##########
@@ -0,0 +1,93 @@
+/*
+ * 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.jdbc.dialect
+
+import java.sql.{Connection, ResultSet, Statement}
+import java.util
+
+import org.apache.kyuubi.KyuubiSQLException
+import org.apache.kyuubi.engine.jdbc.hive.{HiveRowSetHelper, HiveSchemaHelper}
+import org.apache.kyuubi.engine.jdbc.schema.{RowSetHelper, SchemaHelper}
+import org.apache.kyuubi.operation.Operation
+import org.apache.kyuubi.session.Session
+
+class HiveDialect extends JdbcDialect {
+
+ override def createStatement(connection: Connection, fetchSize: Int): Statement = {
+ val statement =
+ connection.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY)
+ statement.setFetchSize(fetchSize)
+ statement
+ }
+
+ override def getTypeInfoOperation(session: Session): Operation = {
+ throw KyuubiSQLException.featureNotSupported()
+ }
+
+ override def getCatalogsOperation(session: Session): Operation = {
+ throw KyuubiSQLException.featureNotSupported()
+ }
+
+ override def getSchemasOperation(session: Session): Operation = {
+ throw KyuubiSQLException.featureNotSupported()
+ }
+
+ override def getTablesQuery(
+ catalog: String,
+ schema: String,
+ tableName: String,
+ tableTypes: util.List[String]): String = {
+ throw KyuubiSQLException.featureNotSupported()
+ }
+
+ override def getTableTypesOperation(session: Session): Operation = {
+ throw KyuubiSQLException.featureNotSupported()
+ }
+
+ override def getColumnsQuery(
+ session: Session,
+ catalogName: String,
+ schemaName: String,
+ tableName: String,
+ columnName: String): String = {
+ throw KyuubiSQLException.featureNotSupported()
+ }
+
+ override def getFunctionsOperation(session: Session): Operation = {
+ throw KyuubiSQLException.featureNotSupported()
+ }
+
+ override def getPrimaryKeysOperation(session: Session): Operation = {
+ throw KyuubiSQLException.featureNotSupported()
+ }
+
+ override def getCrossReferenceOperation(session: Session): Operation = {
+ throw KyuubiSQLException.featureNotSupported()
+ }
+
+ override def getRowSetHelper(): RowSetHelper = {
+ new HiveRowSetHelper
+ }
+
+ override def getSchemaHelper(): SchemaHelper = {
+ new HiveSchemaHelper
+ }
+
+ override def name(): String = {
+ "hive2"
Review Comment:
A little bit weird name. I know you want to route the Hive QL(aka. HQL) to HiveServer2, but naming the dialect "hive2" is confusing, I think "hive" is fine
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org
[GitHub] [kyuubi] pan3793 commented on a diff in pull request #5303: [KYUUBI #5302] add hive support for the JDBC engine to run hive2 sql
Posted by "pan3793 (via GitHub)" <gi...@apache.org>.
pan3793 commented on code in PR #5303:
URL: https://github.com/apache/kyuubi/pull/5303#discussion_r1328341259
##########
externals/kyuubi-jdbc-engine/src/main/scala/org/apache/kyuubi/engine/jdbc/dialect/HiveDialect.scala:
##########
@@ -0,0 +1,93 @@
+/*
+ * 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.jdbc.dialect
+
+import java.sql.{Connection, ResultSet, Statement}
+import java.util
+
+import org.apache.kyuubi.KyuubiSQLException
+import org.apache.kyuubi.engine.jdbc.hive.{HiveRowSetHelper, HiveSchemaHelper}
+import org.apache.kyuubi.engine.jdbc.schema.{RowSetHelper, SchemaHelper}
+import org.apache.kyuubi.operation.Operation
+import org.apache.kyuubi.session.Session
+
+class HiveDialect extends JdbcDialect {
+
+ override def createStatement(connection: Connection, fetchSize: Int): Statement = {
+ val statement =
+ connection.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY)
+ statement.setFetchSize(fetchSize)
+ statement
+ }
+
+ override def getTypeInfoOperation(session: Session): Operation = {
+ throw KyuubiSQLException.featureNotSupported()
+ }
+
+ override def getCatalogsOperation(session: Session): Operation = {
+ throw KyuubiSQLException.featureNotSupported()
+ }
+
+ override def getSchemasOperation(session: Session): Operation = {
+ throw KyuubiSQLException.featureNotSupported()
Review Comment:
obviously, Hive supports it. please read through the code instead of simply copy-paste
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org
[GitHub] [kyuubi] pan3793 commented on a diff in pull request #5303: [KYUUBI #5302] add hive support for the JDBC engine to run hive2 sql
Posted by "pan3793 (via GitHub)" <gi...@apache.org>.
pan3793 commented on code in PR #5303:
URL: https://github.com/apache/kyuubi/pull/5303#discussion_r1328351413
##########
externals/kyuubi-jdbc-engine/src/main/scala/org/apache/kyuubi/engine/jdbc/dialect/HiveDialect.scala:
##########
@@ -0,0 +1,93 @@
+/*
+ * 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.jdbc.dialect
+
+import java.sql.{Connection, ResultSet, Statement}
+import java.util
+
+import org.apache.kyuubi.KyuubiSQLException
+import org.apache.kyuubi.engine.jdbc.hive.{HiveRowSetHelper, HiveSchemaHelper}
+import org.apache.kyuubi.engine.jdbc.schema.{RowSetHelper, SchemaHelper}
+import org.apache.kyuubi.operation.Operation
+import org.apache.kyuubi.session.Session
+
+class HiveDialect extends JdbcDialect {
+
+ override def createStatement(connection: Connection, fetchSize: Int): Statement = {
+ val statement =
+ connection.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY)
+ statement.setFetchSize(fetchSize)
+ statement
+ }
+
+ override def getTypeInfoOperation(session: Session): Operation = {
+ throw KyuubiSQLException.featureNotSupported()
+ }
+
+ override def getCatalogsOperation(session: Session): Operation = {
+ throw KyuubiSQLException.featureNotSupported()
+ }
+
+ override def getSchemasOperation(session: Session): Operation = {
+ throw KyuubiSQLException.featureNotSupported()
Review Comment:
there are different use cases.
- Hive engine: Kyuubi takes lifecycle management for the engine process
- JDBC engine: Kyuubi only routes queries to existing HiveServer2(it's an independent component outside of Kyuubi system)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org