public static TypeInfo convertPrimitiveType(RelDataType rType) {
    switch (rType.getSqlTypeName()) {
    case BOOLEAN:
      return TypeInfoFactory.booleanTypeInfo;
    case TINYINT:
      return TypeInfoFactory.byteTypeInfo;
    case SMALLINT:
      return TypeInfoFactory.shortTypeInfo;
    case INTEGER:
      return TypeInfoFactory.intTypeInfo;
    case BIGINT:
      return TypeInfoFactory.longTypeInfo;
    case FLOAT:
      return TypeInfoFactory.floatTypeInfo;
    case DOUBLE:
      return TypeInfoFactory.doubleTypeInfo;
    case DATE:
      return TypeInfoFactory.dateTypeInfo;
    case TIMESTAMP:
      return TypeInfoFactory.timestampTypeInfo;
    case TIMESTAMP_WITH_LOCAL_TIME_ZONE:
      HiveConf conf;
      try {
        conf = Hive.get().getConf();
      } catch (HiveException e) {
        throw new RuntimeException(e);
      }
      return TypeInfoFactory.getTimestampTZTypeInfo(conf.getLocalTimeZone());
    case INTERVAL_YEAR:
    case INTERVAL_MONTH:
    case INTERVAL_YEAR_MONTH:
      return TypeInfoFactory.intervalYearMonthTypeInfo;
    case INTERVAL_DAY:
    case INTERVAL_DAY_HOUR:
    case INTERVAL_DAY_MINUTE:
    case INTERVAL_DAY_SECOND:
    case INTERVAL_HOUR:
    case INTERVAL_HOUR_MINUTE:
    case INTERVAL_HOUR_SECOND:
    case INTERVAL_MINUTE:
    case INTERVAL_MINUTE_SECOND:
    case INTERVAL_SECOND:
      return TypeInfoFactory.intervalDayTimeTypeInfo;
    case BINARY:
      return TypeInfoFactory.binaryTypeInfo;
    case DECIMAL:
      return TypeInfoFactory.getDecimalTypeInfo(rType.getPrecision(), rType.getScale());
    case VARCHAR:
      int varcharLength = rType.getPrecision();
      if (varcharLength < 1 || varcharLength > HiveVarchar.MAX_VARCHAR_LENGTH)
        return TypeInfoFactory.getPrimitiveTypeInfo(serdeConstants.STRING_TYPE_NAME);
      else
        return TypeInfoFactory.getVarcharTypeInfo(varcharLength);
    case CHAR:
      int charLength = rType.getPrecision();
      if (charLength < 1 || charLength > HiveChar.MAX_CHAR_LENGTH)
        return TypeInfoFactory.getPrimitiveTypeInfo(serdeConstants.STRING_TYPE_NAME);
      else
        return TypeInfoFactory.getCharTypeInfo(charLength);
    default:
      return TypeInfoFactory.voidTypeInfo;
    }

  }
******************** Convert Hive Types To Calcite Types **********************
ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/translator/TypeConverter.java