You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@kyuubi.apache.org by GitBox <gi...@apache.org> on 2022/12/09 10:09:41 UTC

[GitHub] [incubator-kyuubi] bowenliang123 commented on a diff in pull request #3943: [KYUUBI #3942] adapt Spark's JDBC DataTypes to Hive data type definitions in KyuubiHiveDialect

bowenliang123 commented on code in PR #3943:
URL: https://github.com/apache/incubator-kyuubi/pull/3943#discussion_r1044289427


##########
extensions/spark/kyuubi-extension-spark-jdbc-dialect/src/main/scala/org/apache/spark/sql/dialect/KyuubiHiveDialect.scala:
##########
@@ -34,4 +36,24 @@ object KyuubiHiveDialect extends JdbcDialect {
     colName.split('.').map(part => s"`$part`").mkString(".")
   }
 
+  override def getJDBCType(dt: DataType): Option[JdbcType] = dt match {
+
+    // "INTEGER" is synonym for INT since Hive 2.2.0
+    // fallback to "INT" for better compatibility
+    case IntegerType => Option(JdbcType("INT", java.sql.Types.INTEGER))
+
+    // "DOUBLE PRECISION" alias for "DOUBLE", only available starting with Hive 2.2.0
+    // fallback to "DOUBLE" for better compatibility
+    case DoubleType => Option(JdbcType("DOUBLE", java.sql.Types.DOUBLE))
+
+    // adapt to Hive data type definition

Review Comment:
   Added links to docs and issue of  Hive data type definitions.



-- 
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