You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2019/06/06 23:39:05 UTC

[GitHub] [flink] bowenli86 commented on a change in pull request #8657: [FLINK-12772][hive] Support mapping ARRAY, MAP, ROW (STRUCT) between Flink and Hive in HiveCatalog

bowenli86 commented on a change in pull request #8657: [FLINK-12772][hive] Support mapping ARRAY, MAP, ROW (STRUCT) between Flink and Hive in HiveCatalog
URL: https://github.com/apache/flink/pull/8657#discussion_r291410673
 
 

 ##########
 File path: flink-connectors/flink-connector-hive/src/main/java/org/apache/flink/table/catalog/hive/util/HiveTypeUtil.java
 ##########
 @@ -70,77 +80,111 @@ public static String toHiveTypeName(DataType type) {
 	public static TypeInfo toHiveTypeInfo(DataType type) {
 		checkNotNull(type, "type cannot be null");
 
-		if (type.equals(DataTypes.BOOLEAN())) {
-			return TypeInfoFactory.booleanTypeInfo;
-		} else if (type.equals(DataTypes.TINYINT())) {
-			return TypeInfoFactory.byteTypeInfo;
-		} else if (type.equals(DataTypes.SMALLINT())) {
-			return TypeInfoFactory.shortTypeInfo;
-		} else if (type.equals(DataTypes.INT())) {
-			return TypeInfoFactory.intTypeInfo;
-		} else if (type.equals(DataTypes.BIGINT())) {
-			return TypeInfoFactory.longTypeInfo;
-		} else if (type.equals(DataTypes.FLOAT())) {
-			return TypeInfoFactory.floatTypeInfo;
-		} else if (type.equals(DataTypes.DOUBLE())) {
-			return TypeInfoFactory.doubleTypeInfo;
-		} else if (type.equals(DataTypes.STRING())) {
-			return TypeInfoFactory.stringTypeInfo;
-		} else if (type.equals(DataTypes.DATE())) {
-			return TypeInfoFactory.dateTypeInfo;
-		} else if (type.equals(DataTypes.BYTES())) {
-			return TypeInfoFactory.binaryTypeInfo;
-		} else if (type.equals(DataTypes.TIMESTAMP())) {
-			return TypeInfoFactory.timestampTypeInfo;
-		} else {
-			LogicalType logicalType = type.getLogicalType();
-			Class clazz = logicalType.getClass();
-
-			if (clazz == BinaryType.class || clazz == VarBinaryType.class) {
-				// Hive doesn't support variable-length binary string
+		if (type instanceof AtomicDataType) {
 
 Review comment:
   note that the part in this `if` clause doesn't change logic and is only added one tab 

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services