You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@hive.apache.org by GitBox <gi...@apache.org> on 2022/05/18 17:01:22 UTC

[GitHub] [hive] nrg4878 commented on a diff in pull request #3276: HIVE-26046: MySQL's bit datatype is default to void datatype in hive

nrg4878 commented on code in PR #3276:
URL: https://github.com/apache/hive/pull/3276#discussion_r876134671


##########
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/dataconnector/jdbc/MySQLConnectorProvider.java:
##########
@@ -90,10 +90,20 @@ protected String getDataType(String dbDataType, int size) {
     // map any db specific types here.
     switch (dbDataType.toLowerCase())
     {
+    case "bit":
+      return toHiveBitType(size);
     default:
       mappedType = ColumnType.VOID_TYPE_NAME;
       break;
     }
     return mappedType;
   }
+
+  private String toHiveBitType(int size) {
+    if (size <= 1) {
+      return ColumnType.BOOLEAN_TYPE_NAME;
+    } else {
+      return ColumnType.BIGINT_TYPE_NAME;

Review Comment:
   so bit datatype in MYSQL stores and array of bits. for any column, bit-type, with size > 1, the proposal is to use bigint. If I understand this correctly, b'111000' will be read as '111000' (numerical). Isnt this incorrect as these are not equivalent? But also to be able to read this datatype, should we read as "select bin(col)" while reading from remote table? Can you give me an example of how you tested this and what the results were? Thank you



-- 
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: gitbox-unsubscribe@hive.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org