@Test public void testCompatibleHiveTypeWithModifiers() { Integer[] gpdbModifiers; String compatibleTypeName; gpdbModifiers = new Integer[]{5}; compatibleTypeName = HiveUtilities.toCompatibleHiveType(DataType.BPCHAR, gpdbModifiers); assertEquals(compatibleTypeName, EnumHiveToGpdbType.CharType.getTypeName() + "(" + Joiner.on(",").join(gpdbModifiers) + ")"); gpdbModifiers = new Integer[]{10}; compatibleTypeName = HiveUtilities.toCompatibleHiveType(DataType.VARCHAR, gpdbModifiers); assertEquals(compatibleTypeName, EnumHiveToGpdbType.VarcharType.getTypeName() + "(" + Joiner.on(",").join(gpdbModifiers) + ")"); gpdbModifiers = new Integer[]{38, 18}; compatibleTypeName = HiveUtilities.toCompatibleHiveType(DataType.NUMERIC, gpdbModifiers); assertEquals(compatibleTypeName, EnumHiveToGpdbType.DecimalType.getTypeName() + "(" + Joiner.on(",").join(gpdbModifiers) + ")"); try { compatibleTypeName = HiveUtilities.toCompatibleHiveType(DataType.UNSUPPORTED_TYPE, gpdbModifiers); fail("should fail because there is no mapped Hive type"); } catch (UnsupportedTypeException e) { String errorMsg = "Unable to find compatible Hive type for given GPDB's type: " + DataType.UNSUPPORTED_TYPE; assertEquals(errorMsg, e.getMessage()); } }
public static String toCompatibleHiveType(DataType type, Integer[] modifiers) { EnumHiveToGpdbType hiveToGpdbType = EnumHiveToGpdbType.getCompatibleHiveToGpdbType(type); return EnumHiveToGpdbType.getFullHiveTypeName(hiveToGpdbType, modifiers); }
HiveUtilities { public static String toCompatibleHiveType(DataType type, Integer[] modifiers) { EnumHiveToGpdbType hiveToGpdbType = EnumHiveToGpdbType.getCompatibleHiveToGpdbType(type); return EnumHiveToGpdbType.getFullHiveTypeName(hiveToGpdbType, modifiers); } }
HiveUtilities { public static String toCompatibleHiveType(DataType type, Integer[] modifiers) { EnumHiveToGpdbType hiveToGpdbType = EnumHiveToGpdbType.getCompatibleHiveToGpdbType(type); return EnumHiveToGpdbType.getFullHiveTypeName(hiveToGpdbType, modifiers); }  }
HiveUtilities { public static String toCompatibleHiveType(DataType type, Integer[] modifiers) { EnumHiveToGpdbType hiveToGpdbType = EnumHiveToGpdbType.getCompatibleHiveToGpdbType(type); return EnumHiveToGpdbType.getFullHiveTypeName(hiveToGpdbType, modifiers); }  static Metadata.Field mapHiveType(FieldSchema hiveColumn); static String toCompatibleHiveType(DataType type, Integer[] modifiers); static void validateTypeCompatible(DataType gpdbDataType, Integer[] gpdbTypeMods, String hiveType, String gpdbColumnName); static HiveUserData parseHiveUserData(RequestContext context); static Deserializer createDeserializer(String serdeClassName); static Reader getOrcReader(Configuration configuration, RequestContext requestContext); }
HiveUtilities { public static String toCompatibleHiveType(DataType type, Integer[] modifiers) { EnumHiveToGpdbType hiveToGpdbType = EnumHiveToGpdbType.getCompatibleHiveToGpdbType(type); return EnumHiveToGpdbType.getFullHiveTypeName(hiveToGpdbType, modifiers); }  static Metadata.Field mapHiveType(FieldSchema hiveColumn); static String toCompatibleHiveType(DataType type, Integer[] modifiers); static void validateTypeCompatible(DataType gpdbDataType, Integer[] gpdbTypeMods, String hiveType, String gpdbColumnName); static HiveUserData parseHiveUserData(RequestContext context); static Deserializer createDeserializer(String serdeClassName); static Reader getOrcReader(Configuration configuration, RequestContext requestContext);  }