Java Code Examples for org.apache.flink.api.java.hadoop.mapred.utils.HadoopUtils

The following examples show how to use org.apache.flink.api.java.hadoop.mapred.utils.HadoopUtils. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: flink   Source File: HiveCatalog.java    License: Apache License 2.0 6 votes vote down vote up
private static HiveConf createHiveConf(@Nullable String hiveConfDir) {
	LOG.info("Setting hive conf dir as {}", hiveConfDir);

	try {
		HiveConf.setHiveSiteLocation(
			hiveConfDir == null ?
				null : Paths.get(hiveConfDir, "hive-site.xml").toUri().toURL());
	} catch (MalformedURLException e) {
		throw new CatalogException(
			String.format("Failed to get hive-site.xml from %s", hiveConfDir), e);
	}

	// create HiveConf from hadoop configuration
	return new HiveConf(HadoopUtils.getHadoopConfiguration(new org.apache.flink.configuration.Configuration()),
		HiveConf.class);
}
 
Example 2
Source Project: flink   Source File: HiveCatalog.java    License: Apache License 2.0 6 votes vote down vote up
private static HiveConf createHiveConf(@Nullable String hiveConfDir) {
	LOG.info("Setting hive conf dir as {}", hiveConfDir);

	try {
		HiveConf.setHiveSiteLocation(
			hiveConfDir == null ?
				null : Paths.get(hiveConfDir, "hive-site.xml").toUri().toURL());
	} catch (MalformedURLException e) {
		throw new CatalogException(
			String.format("Failed to get hive-site.xml from %s", hiveConfDir), e);
	}

	// create HiveConf from hadoop configuration
	Configuration hadoopConf = HadoopUtils.getHadoopConfiguration(new org.apache.flink.configuration.Configuration());

	// Add mapred-site.xml. We need to read configurations like compression codec.
	for (String possibleHadoopConfPath : HadoopUtils.possibleHadoopConfPaths(new org.apache.flink.configuration.Configuration())) {
		File mapredSite = new File(new File(possibleHadoopConfPath), "mapred-site.xml");
		if (mapredSite.exists()) {
			hadoopConf.addResource(new Path(mapredSite.getAbsolutePath()));
			break;
		}
	}
	return new HiveConf(hadoopConf, HiveConf.class);
}
 
Example 3
Source Project: Flink-CEPplus   Source File: HadoopInputFormatBase.java    License: Apache License 2.0 5 votes vote down vote up
public HadoopInputFormatBase(org.apache.hadoop.mapred.InputFormat<K, V> mapredInputFormat, Class<K> key, Class<V> value, JobConf job) {
	super(job.getCredentials());
	this.mapredInputFormat = mapredInputFormat;
	this.keyClass = key;
	this.valueClass = value;
	HadoopUtils.mergeHadoopConf(job);
	this.jobConf = job;
	ReflectionUtils.setConf(mapredInputFormat, jobConf);
}
 
Example 4
Source Project: flink   Source File: HadoopInputFormatBase.java    License: Apache License 2.0 5 votes vote down vote up
public HadoopInputFormatBase(org.apache.hadoop.mapred.InputFormat<K, V> mapredInputFormat, Class<K> key, Class<V> value, JobConf job) {
	super(job.getCredentials());
	this.mapredInputFormat = mapredInputFormat;
	this.keyClass = key;
	this.valueClass = value;
	HadoopUtils.mergeHadoopConf(job);
	this.jobConf = job;
	ReflectionUtils.setConf(mapredInputFormat, jobConf);
}
 
Example 5
Source Project: flink   Source File: HadoopInputFormatBase.java    License: Apache License 2.0 5 votes vote down vote up
public HadoopInputFormatBase(org.apache.hadoop.mapred.InputFormat<K, V> mapredInputFormat, Class<K> key, Class<V> value, JobConf job) {
	super(job.getCredentials());
	this.mapredInputFormat = mapredInputFormat;
	this.keyClass = key;
	this.valueClass = value;
	HadoopUtils.mergeHadoopConf(job);
	this.jobConf = job;
	ReflectionUtils.setConf(mapredInputFormat, jobConf);
}
 
Example 6
Source Project: Flink-CEPplus   Source File: HadoopOutputFormatBase.java    License: Apache License 2.0 4 votes vote down vote up
public HadoopOutputFormatBase(org.apache.hadoop.mapred.OutputFormat<K, V> mapredOutputFormat, JobConf job) {
	super(job.getCredentials());
	this.mapredOutputFormat = mapredOutputFormat;
	HadoopUtils.mergeHadoopConf(job);
	this.jobConf = job;
}
 
Example 7
Source Project: flink   Source File: HadoopOutputFormatBase.java    License: Apache License 2.0 4 votes vote down vote up
public HadoopOutputFormatBase(org.apache.hadoop.mapred.OutputFormat<K, V> mapredOutputFormat, JobConf job) {
	super(job.getCredentials());
	this.mapredOutputFormat = mapredOutputFormat;
	HadoopUtils.mergeHadoopConf(job);
	this.jobConf = job;
}
 
Example 8
Source Project: flink   Source File: HadoopOutputFormatBase.java    License: Apache License 2.0 4 votes vote down vote up
public HadoopOutputFormatBase(org.apache.hadoop.mapred.OutputFormat<K, V> mapredOutputFormat, JobConf job) {
	super(job.getCredentials());
	this.mapredOutputFormat = mapredOutputFormat;
	HadoopUtils.mergeHadoopConf(job);
	this.jobConf = job;
}