Author: gates
Date: Fri May  2 15:41:58 2008
New Revision: 652935

URL: http://svn.apache.org/viewvc?rev=652935&view=rev
Log:
PIG-215: Cleanup a few dangling ends left by PIG-111.


Added:
    incubator/pig/trunk/conf/log4j.properties
Modified:
    incubator/pig/trunk/CHANGES.txt
    incubator/pig/trunk/conf/pig.properties
    incubator/pig/trunk/src/org/apache/pig/Main.java
    
incubator/pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/HExecutionEngine.java
    incubator/pig/trunk/src/org/apache/pig/impl/PigContext.java
    incubator/pig/trunk/src/org/apache/pig/impl/util/PropertiesUtil.java

Modified: incubator/pig/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/incubator/pig/trunk/CHANGES.txt?rev=652935&r1=652934&r2=652935&view=diff
==============================================================================
--- incubator/pig/trunk/CHANGES.txt (original)
+++ incubator/pig/trunk/CHANGES.txt Fri May  2 15:41:58 2008
@@ -267,6 +267,9 @@
        PIG-176: Change bag spilling so that bags below a certain threshold are
        not spilled, thus avoiding proliferation of small files (pi_song via
        gates).
-    
+
     PIG-227: making load/store function optional in stream input/output spec
     (acmurthy via olgan)
+
+    PIG-215: Cleanup a few dangling ends left by PIG-111 (pi_song via gates).
+    

Added: incubator/pig/trunk/conf/log4j.properties
URL: 
http://svn.apache.org/viewvc/incubator/pig/trunk/conf/log4j.properties?rev=652935&view=auto
==============================================================================
--- incubator/pig/trunk/conf/log4j.properties (added)
+++ incubator/pig/trunk/conf/log4j.properties Fri May  2 15:41:58 2008
@@ -0,0 +1,8 @@
+# ***** Set root logger level to DEBUG and its only appender to A.
+log4j.rootLogger=info, A
+
+# ***** A is set to be a ConsoleAppender.
+log4j.appender.A=org.apache.log4j.ConsoleAppender
+# ***** A uses PatternLayout.
+log4j.appender.A.layout=org.apache.log4j.PatternLayout
+log4j.appender.A.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n

Modified: incubator/pig/trunk/conf/pig.properties
URL: 
http://svn.apache.org/viewvc/incubator/pig/trunk/conf/pig.properties?rev=652935&r1=652934&r2=652935&view=diff
==============================================================================
--- incubator/pig/trunk/conf/pig.properties (original)
+++ incubator/pig/trunk/conf/pig.properties Fri May  2 15:41:58 2008
@@ -23,7 +23,7 @@
 verbose=false
 
 #exectype local|mapreduce, mapreduce is default
-exectype=local
+#exectype=mapreduce
 # hod realted properties
 #ssh.gateway
 #hod.expect.root

Modified: incubator/pig/trunk/src/org/apache/pig/Main.java
URL: 
http://svn.apache.org/viewvc/incubator/pig/trunk/src/org/apache/pig/Main.java?rev=652935&r1=652934&r2=652935&view=diff
==============================================================================
--- incubator/pig/trunk/src/org/apache/pig/Main.java (original)
+++ incubator/pig/trunk/src/org/apache/pig/Main.java Fri May  2 15:41:58 2008
@@ -99,7 +99,7 @@
 
         ExecMode mode = ExecMode.UNKNOWN;
         String file = null;
-        ExecType execType = ExecType.LOCAL;
+        ExecType execType = ExecType.MAPREDUCE ;
         String execTypeString = properties.getProperty("exectype");
         if(execTypeString!=null && execTypeString.length()>0){
             execType = PigServer.parseExecType(execTypeString);

Modified: 
incubator/pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/HExecutionEngine.java
URL: 
http://svn.apache.org/viewvc/incubator/pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/HExecutionEngine.java?rev=652935&r1=652934&r2=652935&view=diff
==============================================================================
--- 
incubator/pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/HExecutionEngine.java
 (original)
+++ 
incubator/pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/HExecutionEngine.java
 Fri May  2 15:41:58 2008
@@ -135,7 +135,7 @@
             }
         }
      
-        log.info("Connecting to hadoop file system at: " + 
properties.get(FILE_SYSTEM_LOCATION));
+        log.info("Connecting to hadoop file system at: "  + (nameNode==null? 
LOCAL: nameNode) )  ;
         ds = new HDataStorage(properties);
             
         Configuration configuration = 
ConfigurationUtil.toConfiguration(properties);

Modified: incubator/pig/trunk/src/org/apache/pig/impl/PigContext.java
URL: 
http://svn.apache.org/viewvc/incubator/pig/trunk/src/org/apache/pig/impl/PigContext.java?rev=652935&r1=652934&r2=652935&view=diff
==============================================================================
--- incubator/pig/trunk/src/org/apache/pig/impl/PigContext.java (original)
+++ incubator/pig/trunk/src/org/apache/pig/impl/PigContext.java Fri May  2 
15:41:58 2008
@@ -128,9 +128,7 @@
         
     public PigContext(ExecType execType, Properties properties){
         this.execType = execType;
-        this.properties = properties;
-    
-        initProperties();
+        this.properties = properties;   
         
         String pigJar = JarManager.findContainingJar(Main.class);
         String hadoopJar = JarManager.findContainingJar(FileSystem.class);
@@ -157,50 +155,6 @@
         packageImportList.add("com.yahoo.pig.yst.sds.ULT.");
         packageImportList.add("org.apache.pig.impl.builtin.");        
     }
-
-    private void initProperties() {
-        Properties fileProperties = new Properties();
-            
-        try{        
-            // first read the properties in the jar file
-            InputStream pis = 
MapReduceLauncher.class.getClassLoader().getResourceAsStream("properties");
-            if (pis != null) {
-                fileProperties.load(pis);
-            }
-            
-            //then read the properties in the home directory
-            try{
-                pis = new FileInputStream(System.getProperty("user.home") + 
"/.pigrc");
-            }catch(IOException e){}
-            if (pis != null) {
-                fileProperties.load(pis);
-            }
-        }catch (IOException e){
-            log.error(e);
-            throw new RuntimeException(e);
-        }
-        
-        //Now set these as system properties only if they are not already 
defined.
-        for (Object o: fileProperties.keySet()){
-            String propertyName = (String)o;
-            if (log.isDebugEnabled()) {
-                StringBuilder sb = new StringBuilder();
-                sb.append("Found system property ");
-                sb.append(propertyName);
-                sb.append(" in .pigrc");
-                log.debug(sb.toString());
-            }
-            if (System.getProperty(propertyName) == null){
-                System.setProperty(propertyName, 
fileProperties.getProperty(propertyName));
-                if (log.isDebugEnabled()) {
-                    StringBuilder sb = new StringBuilder();
-                    sb.append("Setting system property ");
-                    sb.append(propertyName);
-                    log.debug(sb.toString());
-                }
-            }
-        }
-    }    
     
     public void connect() throws ExecException {
 

Modified: incubator/pig/trunk/src/org/apache/pig/impl/util/PropertiesUtil.java
URL: 
http://svn.apache.org/viewvc/incubator/pig/trunk/src/org/apache/pig/impl/util/PropertiesUtil.java?rev=652935&r1=652934&r2=652935&view=diff
==============================================================================
--- incubator/pig/trunk/src/org/apache/pig/impl/util/PropertiesUtil.java 
(original)
+++ incubator/pig/trunk/src/org/apache/pig/impl/util/PropertiesUtil.java Fri 
May  2 15:41:58 2008
@@ -41,10 +41,7 @@
             }
         } catch (Exception e) {
             log.error("unable to parse .pigrc :", e);
-        }
-        
-        // merge all keys/values
-        pigrcProps.putAll(properties) ;
+        }        
                
                // Now put all the entries from pigrcProps into properties, but
                // only if they are not already set.  pig.properties takes
@@ -56,6 +53,19 @@
                        }
                }
                
+        //Now set these as system properties only if they are not already 
defined.
+        if (log.isDebugEnabled()) {
+            for (Object o: properties.keySet()) {
+                String propertyName = (String) o ;
+                StringBuilder sb = new StringBuilder() ;
+                sb.append("Found property ") ;
+                sb.append(propertyName) ;
+                sb.append("=") ;
+                sb.append(properties.get(propertyName).toString()) ;
+                log.debug(sb.toString()) ;
+            }
+        }
+               
                // For telling error fast when there are problems
                ConfigurationValidator.validatePigProperties(properties) ;
     }


Reply via email to