parquet-hive/parquet-hive-binding/parquet-hive-binding-factory/src/main/java/org/apache/parquet/hive/HiveBindingFactory.java
@SuppressWarnings({"unchecked", "rawtypes"})
  Class<? extends HiveBinding> createInternal(Class hiveVersionInfo) {
    String hiveVersion;
    try {
      Method getVersionMethod = hiveVersionInfo.
          getMethod(HIVE_VERSION_METHOD_NAME, (Class[])null);
      String rawVersion = (String)getVersionMethod.invoke(null, (Object[])null);
      LOG.debug("Raw Version from {} is '{}'", hiveVersionInfo.getSimpleName(), rawVersion);
      hiveVersion = trimVersion(rawVersion);
    } catch (Exception e) {
      throw new UnexpectedHiveVersionProviderError("Unexpected error whilst " +
          "determining Hive version", e);
    }
    if(hiveVersion.equalsIgnoreCase(HIVE_VERSION_UNKNOWN)) {
      LOG.debug("Unknown hive version, attempting to guess");
      return createBindingForUnknownVersion();
    }
    if(hiveVersion.startsWith(HIVE_VERSION_010)) {
      LOG.debug("Hive version {}, returning {}", hiveVersion, Hive010Binding.class.getSimpleName());
      return Hive010Binding.class;
    } else if(hiveVersion.startsWith(HIVE_VERSION_011)) {
      LOG.debug("Hive version " + hiveVersion + ", returning " +
          Hive010Binding.class.getSimpleName() + " as it's expected the 0.10 " +
          "binding will work with 0.11");
      return Hive010Binding.class;
    } else if(hiveVersion.startsWith(HIVE_VERSION_013)) {
      throw new HiveBindingInstantiationError("Hive 0.13 contains native Parquet support " + 
          "and the parquet-hive jars from the parquet project should not be included " +
          "in Hive's classpath.");
    }
    LOG.debug("Hive version {}, returning {}", hiveVersion,
        Hive012Binding.class.getSimpleName());
    // as of 11/26/2013 it looks like the 0.12 binding will work for 0.13
    return Hive012Binding.class;
  }
@SuppressWarnings({"unchecked", "rawtypes"})
  Class<? extends HiveBinding> createInternal(Class hiveVersionInfo) {
    String hiveVersion;
    try {
      Method getVersionMethod = hiveVersionInfo.
          getMethod(HIVE_VERSION_METHOD_NAME, (Class[])null);
      String rawVersion = (String)getVersionMethod.invoke(null, (Object[])null);
      LOG.debug("Raw Version from {} is '{}'", hiveVersionInfo.getSimpleName(), rawVersion);
      hiveVersion = trimVersion(rawVersion);
    } catch (Exception e) {
      throw new UnexpectedHiveVersionProviderError("Unexpected error whilst " +
          "determining Hive version", e);
    }
    if(hiveVersion.equalsIgnoreCase(HIVE_VERSION_UNKNOWN)) {
      LOG.debug("Unknown hive version, attempting to guess");
      return createBindingForUnknownVersion();
    }
    if(hiveVersion.startsWith(HIVE_VERSION_010)) {
      LOG.debug("Hive version {}, returning {}", hiveVersion, Hive010Binding.class.getSimpleName());
      return Hive010Binding.class;
    } else if(hiveVersion.startsWith(HIVE_VERSION_011)) {
      LOG.debug("Hive version " + hiveVersion + ", returning " +
          Hive010Binding.class.getSimpleName() + " as it's expected the 0.10 " +
          "binding will work with 0.11");
      return Hive010Binding.class;
    } else if(hiveVersion.startsWith(HIVE_VERSION_013)) {
      throw new HiveBindingInstantiationError("Hive 0.13 contains native Parquet support " + 
          "and the parquet-hive jars from the parquet project should not be included " +
          "in Hive's classpath.");
    }
    LOG.debug("Hive version {}, returning {}", hiveVersion,
        Hive012Binding.class.getSimpleName());
    // as of 11/26/2013 it looks like the 0.12 binding will work for 0.13
    return Hive012Binding.class;
  }
@ SuppressWarnings ( { "unchecked" , "rawtypes" } ) Class < ? extends HiveBinding > createInternal ( Class hiveVersionInfo ) { String hiveVersion ; try { Method getVersionMethod = hiveVersionInfo . getMethod ( HIVE_VERSION_METHOD_NAME , ( Class [ ] ) null ) ; String rawVersion = ( String ) getVersionMethod . invoke ( null , ( Object [ ] ) null ) ; LOG . debug ( "Raw Version from {} is '{}'" , hiveVersionInfo . getSimpleName ( ) , rawVersion ) ; hiveVersion = trimVersion ( rawVersion ) ; } catch ( Exception e ) { throw new UnexpectedHiveVersionProviderError ( "Unexpected error whilst " + "determining Hive version" , e ) ; } if ( hiveVersion . equalsIgnoreCase ( HIVE_VERSION_UNKNOWN ) ) { LOG . debug ( "Unknown hive version, attempting to guess" ) ; return createBindingForUnknownVersion ( ) ; } if ( hiveVersion . startsWith ( HIVE_VERSION_010 ) ) { LOG . debug ( "Hive version {}, returning {}" , hiveVersion , Hive010Binding . class . getSimpleName ( ) ) ; return Hive010Binding . class ; } else if ( hiveVersion . startsWith ( HIVE_VERSION_011 ) ) { LOG . debug ( "Hive version " + hiveVersion + ", returning " + Hive010Binding . class . getSimpleName ( ) + " as it's expected the 0.10 " + "binding will work with 0.11" ) ; return Hive010Binding . class ; } else if ( hiveVersion . startsWith ( HIVE_VERSION_013 ) ) { throw new HiveBindingInstantiationError ( "Hive 0.13 contains native Parquet support " + "and the parquet-hive jars from the parquet project should not be included " + "in Hive's classpath." ) ; } LOG . debug ( "Hive version {}, returning {}" , hiveVersion , Hive012Binding . class . getSimpleName ( ) ) ; // as of 11/26/2013 it looks like the 0.12 binding will work for 0.13 return Hive012Binding . class ; }
Internal method visible for testing purposes
Internal method visible for testing purposes