You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pig.apache.org by ch...@apache.org on 2014/10/26 22:11:44 UTC
svn commit: r1634397 - in /pig/trunk: CHANGES.txt
src/org/apache/pig/backend/hadoop/executionengine/HExecutionEngine.java
Author: cheolsoo
Date: Sun Oct 26 21:11:44 2014
New Revision: 1634397
URL: http://svn.apache.org/r1634397
Log:
PIG-4247: S3 properties are not picked up from core-site.xml in local mode (cheolsoo)
Modified:
pig/trunk/CHANGES.txt
pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/HExecutionEngine.java
Modified: pig/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/pig/trunk/CHANGES.txt?rev=1634397&r1=1634396&r2=1634397&view=diff
==============================================================================
--- pig/trunk/CHANGES.txt (original)
+++ pig/trunk/CHANGES.txt Sun Oct 26 21:11:44 2014
@@ -26,6 +26,8 @@ IMPROVEMENTS
BUG FIXES
+PIG-4247: S3 properties are not picked up from core-site.xml in local mode (cheolsoo)
+
PIG-4242: For indented xmls with multiline content (e.g. wikipedia) XMLLoader cuts out the begining of every line
(holdfenytolvaj via daijy)
Modified: pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/HExecutionEngine.java
URL: http://svn.apache.org/viewvc/pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/HExecutionEngine.java?rev=1634397&r1=1634396&r2=1634397&view=diff
==============================================================================
--- pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/HExecutionEngine.java (original)
+++ pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/HExecutionEngine.java Sun Oct 26 21:11:44 2014
@@ -24,6 +24,7 @@ import java.io.PrintStream;
import java.net.URL;
import java.util.Iterator;
import java.util.Map;
+import java.util.Map.Entry;
import java.util.Properties;
import org.apache.commons.logging.Log;
@@ -109,6 +110,23 @@ public abstract class HExecutionEngine i
init(this.pigContext.getProperties());
}
+ // Loads S3 properties from core-site.xml including aws keys that are needed
+ // for both local and non-local mode.
+ public JobConf getS3Conf() throws ExecException {
+ JobConf jc = new JobConf();
+ jc.addResource(CORE_SITE);
+ Iterator<Entry<String, String>> i = jc.iterator();
+ while (i.hasNext()) {
+ Entry<String, String> e = i.next();
+ String key = e.getKey();
+ String value = e.getValue();
+ if (key.startsWith("fs.s3") || key.startsWith("fs.s3n")) {
+ jc.set(key, value);
+ }
+ }
+ return jc;
+ }
+
public JobConf getLocalConf() {
JobConf jc = new JobConf(false);
@@ -147,6 +165,7 @@ public abstract class HExecutionEngine i
return jc;
}
+ @SuppressWarnings("resource")
private void init(Properties properties) throws ExecException {
String cluster = null;
String nameNode = null;
@@ -168,9 +187,10 @@ public abstract class HExecutionEngine i
// existing properties All of the above is accomplished in the method
// call below
- JobConf jc = null;
+ JobConf jc = getS3Conf();
if (!this.pigContext.getExecType().isLocal()) {
- jc = getExecConf(properties);
+ JobConf execConf = getExecConf(properties);
+ ConfigurationUtil.mergeConf(jc, execConf);
// Trick to invoke static initializer of DistributedFileSystem to
// add hdfs-default.xml into configuration
@@ -184,7 +204,8 @@ public abstract class HExecutionEngine i
properties.setProperty(FILE_SYSTEM_LOCATION, "file:///");
properties.setProperty(ALTERNATIVE_FILE_SYSTEM_LOCATION, "file:///");
- jc = getLocalConf();
+ JobConf localConf = getLocalConf();
+ ConfigurationUtil.mergeConf(jc, localConf);
}
// the method below alters the properties object by overriding the