@Test
  public void testGetTypeInfoForPrimitiveCategory() {
    // varchar should take string length into account.
    // varchar(5), varchar(10) => varchar(10)
    assertEquals(varchar10, FunctionRegistry.getTypeInfoForPrimitiveCategory(
        (PrimitiveTypeInfo) varchar5, (PrimitiveTypeInfo) varchar10, PrimitiveCategory.VARCHAR));
    assertEquals(varchar10, FunctionRegistry.getTypeInfoForPrimitiveCategory(
        (PrimitiveTypeInfo) varchar10, (PrimitiveTypeInfo) varchar5, PrimitiveCategory.VARCHAR));

    assertEquals(char10, FunctionRegistry.getTypeInfoForPrimitiveCategory(
        (PrimitiveTypeInfo) char5, (PrimitiveTypeInfo) char10, PrimitiveCategory.CHAR));
    assertEquals(char10, FunctionRegistry.getTypeInfoForPrimitiveCategory(
        (PrimitiveTypeInfo) char10, (PrimitiveTypeInfo) char5, PrimitiveCategory.CHAR));

    assertEquals(varchar10, FunctionRegistry.getTypeInfoForPrimitiveCategory(
        (PrimitiveTypeInfo) varchar5, (PrimitiveTypeInfo) char10, PrimitiveCategory.VARCHAR));

    // non-qualified types should simply return the TypeInfo associated with that type
    assertEquals(TypeInfoFactory.stringTypeInfo, FunctionRegistry.getTypeInfoForPrimitiveCategory(
        (PrimitiveTypeInfo) varchar10, TypeInfoFactory.stringTypeInfo,
        PrimitiveCategory.STRING));
    assertEquals(TypeInfoFactory.stringTypeInfo, FunctionRegistry.getTypeInfoForPrimitiveCategory(
        TypeInfoFactory.stringTypeInfo,
        TypeInfoFactory.stringTypeInfo,
        PrimitiveCategory.STRING));
    assertEquals(TypeInfoFactory.doubleTypeInfo, FunctionRegistry.getTypeInfoForPrimitiveCategory(
        TypeInfoFactory.doubleTypeInfo,
        TypeInfoFactory.stringTypeInfo,
        PrimitiveCategory.DOUBLE));
  }
Method to print out the comparison/conversion behavior for data types.
ql/src/test/org/apache/hadoop/hive/ql/exec/TestFunctionRegistry.java