### Question:
HiveUtilities { public static void validateTypeCompatible(DataType gpdbDataType, Integer[] gpdbTypeMods, String hiveType, String gpdbColumnName) { EnumHiveToGpdbType hiveToGpdbType = EnumHiveToGpdbType.getHiveToGpdbType(hiveType); EnumGpdbType expectedGpdbType = hiveToGpdbType.getGpdbType(); if (!expectedGpdbType.getDataType().equals(gpdbDataType)) { throw new UnsupportedTypeException("Invalid definition for column " + gpdbColumnName + ": expected GPDB type " + expectedGpdbType.getDataType() + ", actual GPDB type " + gpdbDataType); } switch (gpdbDataType) { case NUMERIC: case VARCHAR: case BPCHAR: if (gpdbTypeMods != null && gpdbTypeMods.length > 0) { Integer[] hiveTypeModifiers = EnumHiveToGpdbType .extractModifiers(hiveType); for (int i = 0; i < hiveTypeModifiers.length; i++) { if (gpdbTypeMods[i] < hiveTypeModifiers[i]) throw new UnsupportedTypeException( "Invalid definition for column " + gpdbColumnName + ": modifiers are not compatible, " + Arrays.toString(hiveTypeModifiers) + ", " + Arrays.toString(gpdbTypeMods)); } } break; } }  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);  }### Answer:
@Test public void validateSchema() throws Exception { String columnName = "abc"; Integer[] gpdbModifiers = {}; HiveUtilities.validateTypeCompatible(DataType.SMALLINT, gpdbModifiers, EnumHiveToGpdbType.TinyintType.getTypeName(), columnName); HiveUtilities.validateTypeCompatible(DataType.SMALLINT, gpdbModifiers, EnumHiveToGpdbType.SmallintType.getTypeName(), columnName); gpdbModifiers = new Integer[]{38, 18}; HiveUtilities.validateTypeCompatible(DataType.NUMERIC, gpdbModifiers, "decimal(38,18)", columnName); gpdbModifiers = new Integer[]{}; HiveUtilities.validateTypeCompatible(DataType.NUMERIC, gpdbModifiers, "decimal(38,18)", columnName); gpdbModifiers = null; HiveUtilities.validateTypeCompatible(DataType.NUMERIC, gpdbModifiers, "decimal(38,18)", columnName); gpdbModifiers = new Integer[]{11, 3}; HiveUtilities.validateTypeCompatible(DataType.NUMERIC, gpdbModifiers, "decimal(10,2)", columnName); try { gpdbModifiers = new Integer[]{38, 17}; HiveUtilities.validateTypeCompatible(DataType.NUMERIC, gpdbModifiers, "decimal(38,18)", columnName); fail("should fail with incompatible modifiers message"); } catch (UnsupportedTypeException e) { String errorMsg = "Invalid definition for column " + columnName + ": modifiers are not compatible, " + Arrays.toString(new String[]{"38", "18"}) + ", " + Arrays.toString(new String[]{"38", "17"}); assertEquals(errorMsg, e.getMessage()); } try { gpdbModifiers = new Integer[]{}; HiveUtilities.validateTypeCompatible(DataType.NUMERIC, gpdbModifiers, "boolean", columnName); fail("should fail with incompatible types message"); } catch (UnsupportedTypeException e) { String errorMsg = "Invalid definition for column " + columnName + ": expected GPDB type " + DataType.BOOLEAN + ", actual GPDB type " + DataType.NUMERIC; assertEquals(errorMsg, e.getMessage()); } }