You are viewing a plain text version of this content. The canonical link for it is here.
Posted to hcatalog-commits@incubator.apache.org by to...@apache.org on 2012/05/01 18:48:50 UTC

svn commit: r1332774 - in /incubator/hcatalog/trunk/src/java/org/apache/hcatalog: data/HCatRecordSerDe.java data/JsonSerDe.java mapreduce/FileOutputCommitterContainer.java

Author: toffer
Date: Tue May  1 18:48:50 2012
New Revision: 1332774

URL: http://svn.apache.org/viewvc?rev=1332774&view=rev
Log:
undo dirty commit 1332773

Modified:
    incubator/hcatalog/trunk/src/java/org/apache/hcatalog/data/HCatRecordSerDe.java
    incubator/hcatalog/trunk/src/java/org/apache/hcatalog/data/JsonSerDe.java
    incubator/hcatalog/trunk/src/java/org/apache/hcatalog/mapreduce/FileOutputCommitterContainer.java

Modified: incubator/hcatalog/trunk/src/java/org/apache/hcatalog/data/HCatRecordSerDe.java
URL: http://svn.apache.org/viewvc/incubator/hcatalog/trunk/src/java/org/apache/hcatalog/data/HCatRecordSerDe.java?rev=1332774&r1=1332773&r2=1332774&view=diff
==============================================================================
--- incubator/hcatalog/trunk/src/java/org/apache/hcatalog/data/HCatRecordSerDe.java (original)
+++ incubator/hcatalog/trunk/src/java/org/apache/hcatalog/data/HCatRecordSerDe.java Tue May  1 18:48:50 2012
@@ -87,8 +87,8 @@ public class HCatRecordSerDe implements 
     }
 
 
-    LOG.debug("columns: {} {}",columnNameProperty,columnNames);
-    LOG.debug("types: {} {}", columnTypeProperty, columnTypes);
+    LOG.debug("columns: {}",columnNameProperty,columnNames);
+    LOG.debug("types: {}", columnTypeProperty, columnTypes);
     assert (columnNames.size() == columnTypes.size());
 
     rowTypeInfo = (StructTypeInfo) TypeInfoFactory.getStructTypeInfo(columnNames, columnTypes);

Modified: incubator/hcatalog/trunk/src/java/org/apache/hcatalog/data/JsonSerDe.java
URL: http://svn.apache.org/viewvc/incubator/hcatalog/trunk/src/java/org/apache/hcatalog/data/JsonSerDe.java?rev=1332774&r1=1332773&r2=1332774&view=diff
==============================================================================
--- incubator/hcatalog/trunk/src/java/org/apache/hcatalog/data/JsonSerDe.java (original)
+++ incubator/hcatalog/trunk/src/java/org/apache/hcatalog/data/JsonSerDe.java Tue May  1 18:48:50 2012
@@ -150,12 +150,10 @@ public class JsonSerDe implements SerDe 
         populateRecord(r,token,p,schema);
       }
     } catch (JsonParseException e) {
-        LOG.warn("Error [{}] parsing json text [{}].", e, t);
-        LOG.debug(null,e);
+        LOG.warn("Error [{}] parsing json location [{}].", e.getMessage(), e.getLocation());
       throw new SerDeException(e);
     } catch (IOException e) {
-        LOG.warn("Error [{}] parsing json text [{}].", e, t);
-        LOG.debug(null,e);
+        LOG.warn("Error [{}] parsing json text [{}].", e.getMessage(),t);
       throw new SerDeException(e);
     }
 

Modified: incubator/hcatalog/trunk/src/java/org/apache/hcatalog/mapreduce/FileOutputCommitterContainer.java
URL: http://svn.apache.org/viewvc/incubator/hcatalog/trunk/src/java/org/apache/hcatalog/mapreduce/FileOutputCommitterContainer.java?rev=1332774&r1=1332773&r2=1332774&view=diff
==============================================================================
--- incubator/hcatalog/trunk/src/java/org/apache/hcatalog/mapreduce/FileOutputCommitterContainer.java (original)
+++ incubator/hcatalog/trunk/src/java/org/apache/hcatalog/mapreduce/FileOutputCommitterContainer.java Tue May  1 18:48:50 2012
@@ -48,8 +48,6 @@ import org.apache.hcatalog.data.schema.H
 import org.apache.hcatalog.data.schema.HCatSchemaUtils;
 import org.apache.hcatalog.har.HarOutputCommitterPostProcessor;
 import org.apache.thrift.TException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 import java.io.IOException;
 import java.net.URI;
@@ -66,7 +64,6 @@ import java.util.Map.Entry;
  */
 class FileOutputCommitterContainer extends OutputCommitterContainer {
 
-    private static final Logger LOG = LoggerFactory.getLogger(FileOutputCommitterContainer.class);
     private final boolean dynamicPartitioningUsed;
     private boolean partitionsDiscovered;
 
@@ -439,18 +436,20 @@ class FileOutputCommitterContainer exten
 
         partition.setParameters(params);
 
-        // Sets permissions and group name on partition dirs and files.
+        // Sets permissions and group name on partition dirs.
 
         Path partPath = new Path(partLocnRoot);
-        int i = 0;
-        for (FieldSchema partKey : table.getPartitionKeys()) {
-            if (i++ != 0) {
-                applyGroupAndPerms(fs, partPath, perms, grpName, false);
-            }
+        for(FieldSchema partKey : table.getPartitionKeys()){
             partPath = constructPartialPartPath(partPath, partKey.getName().toLowerCase(), partKVs);
+//        LOG.info("Setting perms for "+partPath.toString());
+            fs.setPermission(partPath, perms);
+            try{
+                fs.setOwner(partPath, null, grpName);
+            } catch(AccessControlException ace){
+                // log the messages before ignoring. Currently, logging is not built in Hcatalog.
+//          LOG.warn(ace);
+            }
         }
-        // Apply the group and permissions to the leaf partition and files.
-        applyGroupAndPerms(fs, partPath, perms, grpName, true);
         if (dynamicPartitioningUsed){
             String dynamicPartitionDestination = getFinalDynamicPartitionDestination(table,partKVs);
             if (harProcessor.isEnabled()){
@@ -467,30 +466,7 @@ class FileOutputCommitterContainer exten
         return partition;
     }
 
-    private void applyGroupAndPerms(FileSystem fs, Path dir, FsPermission permission,
-            String group, boolean recursive)
-            throws IOException {
-        fs.setPermission(dir, permission);
-        try {
-            fs.setOwner(dir, null, group);
-        } catch (AccessControlException ace) {
-            LOG.warn("Error changing group of " + dir, ace);
-        }
-        if (recursive) {
-            for (FileStatus fileStatus : fs.listStatus(dir)) {
-                if (fileStatus.isDir()) {
-                    applyGroupAndPerms(fs, fileStatus.getPath(), permission, group, recursive);
-                } else {
-                    fs.setPermission(fileStatus.getPath(), permission);
-                    try {
-                        fs.setOwner(dir, null, group);
-                    } catch (AccessControlException ace) {
-                        LOG.warn("Error changing group of " + dir, ace);
-                    }
-                }
-            }
-        }
-    }
+
 
     private String getFinalDynamicPartitionDestination(Table table, Map<String,String> partKVs) {
         // file:///tmp/hcat_junit_warehouse/employee/_DYN0.7770480401313761/emp_country=IN/emp_state=KA  ->