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


##########
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:
   > for BIT(n), if we represent the value as bigint(decimal) in hive, will the 
original intent have been lost? a select would return 56 which visually doesn't 
represent how it is originally stored
   
   I think users migiht be able to convert the result **56** to bit 
**"111000"** themselves instead hive internally.  :)
   
   I will research how to do convert result using hive functions or UDFs as you 
suggsted. or maybe we can rewrite query sql to "select bin(col)" after hive 
compile.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to