public static String getMajorVersion() {
    String vers = VersionInfo.getVersion();

    String[] parts = vers.split("\\.");
    if (parts.length < 2) {
      throw new RuntimeException("Illegal Hadoop Version: " + vers +
          " (expected A.B.* format)");
    }

    switch (Integer.parseInt(parts[0])) {
    case 2:
    case 3:
      return HADOOP23VERSIONNAME;
    default:
      throw new IllegalArgumentException("Unrecognized Hadoop major version number: " + vers);
    }
  }
Return the "major" version of Hadoop currently on the classpath.
Releases in the 1.x and 2.x series are mapped to the appropriate
0.x release series, e.g. 1.x is mapped to "0.20S" and 2.x
is mapped to "0.23".
shims/common/src/main/java/org/apache/hadoop/hive/shims/ShimLoader.java