incubator-hcatalog-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r1297320 - in /incubator/hcatalog/trunk: ./ src/java/org/apache/hcatalog/data/ src/java/org/apache/hcatalog/mapreduce/ src/java/org/apache/hcatalog/pig/ src/test/org/apache/hcatalog/data/
Date Tue, 06 Mar 2012 02:03:24 GMT
Author: gates
Date: Tue Mar  6 02:03:24 2012
New Revision: 1297320

URL: http://svn.apache.org/viewvc?rev=1297320&view=rev
Log:
HCATALOG-281 HCat use table schema instead of partition schema to read partition data

Modified:
    incubator/hcatalog/trunk/CHANGES.txt
    incubator/hcatalog/trunk/src/java/org/apache/hcatalog/data/LazyHCatRecord.java
    incubator/hcatalog/trunk/src/java/org/apache/hcatalog/mapreduce/HCatBaseInputFormat.java
    incubator/hcatalog/trunk/src/java/org/apache/hcatalog/mapreduce/HCatRecordReader.java
    incubator/hcatalog/trunk/src/java/org/apache/hcatalog/mapreduce/HCatSplit.java
    incubator/hcatalog/trunk/src/java/org/apache/hcatalog/mapreduce/InternalUtil.java
    incubator/hcatalog/trunk/src/java/org/apache/hcatalog/pig/HCatLoader.java
    incubator/hcatalog/trunk/src/test/org/apache/hcatalog/data/TestHCatRecordSerDe.java
    incubator/hcatalog/trunk/src/test/org/apache/hcatalog/data/TestLazyHCatRecord.java

Modified: incubator/hcatalog/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/hcatalog/trunk/CHANGES.txt?rev=1297320&r1=1297319&r2=1297320&view=diff
==============================================================================
--- incubator/hcatalog/trunk/CHANGES.txt (original)
+++ incubator/hcatalog/trunk/CHANGES.txt Tue Mar  6 02:03:24 2012
@@ -77,6 +77,8 @@ Release 0.4.0 - Unreleased
   OPTIMIZATIONS
 
   BUG FIXES
+  HCAT-281 HCat use table schema instead of partition schema to read partition data (daijy
and khorgath via gates)
+
   HCAT-286 NPE in HdfsAuthorizationProvider (enis via gates)
 
   HCAT-290 Changes in HBase maven objects breaks hcat build (gates)

Modified: incubator/hcatalog/trunk/src/java/org/apache/hcatalog/data/LazyHCatRecord.java
URL: http://svn.apache.org/viewvc/incubator/hcatalog/trunk/src/java/org/apache/hcatalog/data/LazyHCatRecord.java?rev=1297320&r1=1297319&r2=1297320&view=diff
==============================================================================
--- incubator/hcatalog/trunk/src/java/org/apache/hcatalog/data/LazyHCatRecord.java (original)
+++ incubator/hcatalog/trunk/src/java/org/apache/hcatalog/data/LazyHCatRecord.java Tue Mar
 6 02:03:24 2012
@@ -29,12 +29,9 @@ public class LazyHCatRecord extends HCat
 
   private Object o;
   private StructObjectInspector soi;
-  private Map<Integer, Object> partCols;
   
   @Override
   public Object get(int fieldNum) {
-    Object pc = partCols.get(fieldNum);
-    if (pc != null) return pc;
     try {
       StructField fref = soi.getAllStructFieldRefs().get(fieldNum);
       return HCatRecordSerDe.serializeField(
@@ -63,7 +60,7 @@ public class LazyHCatRecord extends HCat
 
   @Override
   public int size() {
-    return soi.getAllStructFieldRefs().size() + partCols.size();
+    return soi.getAllStructFieldRefs().size();
   }
 
   @Override
@@ -103,8 +100,7 @@ public class LazyHCatRecord extends HCat
     throw new UnsupportedOperationException("not allowed to run copy() on LazyHCatRecord");
   }
   
-  public LazyHCatRecord(Object o, ObjectInspector oi, 
-                        Map<Integer, Object> partCols) 
+  public LazyHCatRecord(Object o, ObjectInspector oi)
   throws Exception {
 
     if (oi.getCategory() != Category.STRUCT) {
@@ -116,7 +112,6 @@ public class LazyHCatRecord extends HCat
 
     this.soi = (StructObjectInspector)oi;
     this.o = o;
-    this.partCols = partCols;
   }
 
   @Override

Modified: incubator/hcatalog/trunk/src/java/org/apache/hcatalog/mapreduce/HCatBaseInputFormat.java
URL: http://svn.apache.org/viewvc/incubator/hcatalog/trunk/src/java/org/apache/hcatalog/mapreduce/HCatBaseInputFormat.java?rev=1297320&r1=1297319&r2=1297320&view=diff
==============================================================================
--- incubator/hcatalog/trunk/src/java/org/apache/hcatalog/mapreduce/HCatBaseInputFormat.java
(original)
+++ incubator/hcatalog/trunk/src/java/org/apache/hcatalog/mapreduce/HCatBaseInputFormat.java
Tue Mar  6 02:03:24 2012
@@ -167,8 +167,7 @@ public abstract class HCatBaseInputForma
       for(org.apache.hadoop.mapred.InputSplit split : baseSplits) {
         splits.add(new HCatSplit(
             partitionInfo,
-            split,
-            allCols));
+            split,allCols));
       }
     }
 
@@ -217,7 +216,7 @@ public abstract class HCatBaseInputForma
 
       Configuration conf = storageHandler.getConf();
       InternalUtil.initializeInputSerDe(serde, conf, 
-                                  partitionInfo.getTableInfo());
+                                  partitionInfo.getTableInfo(),partitionInfo.getPartitionSchema());
                                   
     } catch (Exception e) {
       throw new IOException("Unable to create objectInspector "
@@ -225,28 +224,38 @@ public abstract class HCatBaseInputForma
           + e);
     }
 
-    Map<Integer,Object> partCols = getPartColsByPosition(partitionInfo, 
-                                                        hcatSplit);
+    Map<String,String> valuesNotInDataCols = getColValsNotInDataColumns(
+        getOutputSchema(jobContext),partitionInfo
+        );
 
     HCatRecordReader hcatRecordReader = new HCatRecordReader(storageHandler, 
                                                              recordReader, 
-                                                             serde, 
-                                                             partCols);
+                                                             serde,
+                                                             valuesNotInDataCols);
     return hcatRecordReader;
   }
 
-  /** gets the partition columns that are not part of the Hive storage */
-  private static Map<Integer, Object> getPartColsByPosition(PartInfo partInfo, 
-                                                            HCatSplit split)
-  {
-    Map<Integer, Object> partCols = new HashMap<Integer, Object>();
-
-    for (String partitionKey : partInfo.getPartitionValues().keySet()) {
-      partCols.put(split.getSchema().getPosition(partitionKey), 
-                   partInfo.getPartitionValues().get(partitionKey));
+  
+  /**
+   * gets values for fields requested by output schema which will not be in the data
+   */
+  private static Map<String,String> getColValsNotInDataColumns(HCatSchema outputSchema,
+      PartInfo partInfo){
+    HCatSchema dataSchema = partInfo.getPartitionSchema();
+    Map<String,String> vals = new HashMap<String,String>();
+    for (String fieldName : outputSchema.getFieldNames()){
+      if (dataSchema.getPosition(fieldName) == null){
+        // this entry of output is not present in the output schema
+        // so, we first check the table schema to see if it is a part col
+        
+        if (partInfo.getPartitionValues().containsKey(fieldName)){
+          vals.put(fieldName, partInfo.getPartitionValues().get(fieldName));
+        } else {
+          vals.put(fieldName, null);
+        }
+      }
     }
-
-    return partCols;
+    return vals;
   }
 
   /**

Modified: incubator/hcatalog/trunk/src/java/org/apache/hcatalog/mapreduce/HCatRecordReader.java
URL: http://svn.apache.org/viewvc/incubator/hcatalog/trunk/src/java/org/apache/hcatalog/mapreduce/HCatRecordReader.java?rev=1297320&r1=1297319&r2=1297320&view=diff
==============================================================================
--- incubator/hcatalog/trunk/src/java/org/apache/hcatalog/mapreduce/HCatRecordReader.java
(original)
+++ incubator/hcatalog/trunk/src/java/org/apache/hcatalog/mapreduce/HCatRecordReader.java
Tue Mar  6 02:03:24 2012
@@ -65,10 +65,10 @@ class HCatRecordReader extends RecordRea
 
     private SerDe serde;
 
-    private Map<Integer,Object> partCols;
+    private Map<String,String> valuesNotInDataCols;
 
     private HCatSchema outputSchema = null;
-    private HCatSchema tableSchema = null;
+    private HCatSchema dataSchema = null;
 
     /**
      * Instantiates a new hcat record reader.
@@ -78,11 +78,11 @@ class HCatRecordReader extends RecordRea
         org.apache.hadoop.mapred.RecordReader<WritableComparable, 
                      Writable> baseRecordReader, 
                      SerDe serde, 
-                     Map<Integer,Object> partCols) {
+                     Map<String,String> valuesNotInDataCols) {
       this.baseRecordReader = baseRecordReader;
       this.storageHandler = storageHandler;
       this.serde = serde;
-      this.partCols = partCols;
+      this.valuesNotInDataCols = valuesNotInDataCols;
     }
     
     /* (non-Javadoc)
@@ -106,10 +106,14 @@ class HCatRecordReader extends RecordRea
           throw new IOException("Not a HCatSplit");
         }
 
-        // Pull the table schema out of the Split info
-        // TODO This should be passed in teh TaskAttemptContext instead
-        tableSchema = ((HCatSplit)split).getTableSchema();
+        if (outputSchema == null){
+          outputSchema = ((HCatSplit) split).getTableSchema();
+        }
 
+        // Pull the table schema out of the Split info
+        // TODO This should be passed in the TaskAttemptContext instead
+        dataSchema = ((HCatSplit)split).getDataSchema();
+        
         Properties properties = new Properties();
         for (Map.Entry<String, String>param : 
             ((HCatSplit)split).getPartitionInfo()
@@ -136,31 +140,24 @@ class HCatRecordReader extends RecordRea
       HCatRecord r;
 
       try {
-        /*
-        return new DefaultHCatRecord((new LazyHCatRecord(
-                                            serde.deserialize(currentValue), 
-                               serde.getObjectInspector(), 
-                               partCols)).getAll());
-                               */
-        r = new LazyHCatRecord(serde.deserialize(currentValue), 
-          serde.getObjectInspector(), partCols);
-        if (outputSchema == null) {
-          // there's no projection being done
-          return new DefaultHCatRecord(r.getAll());
-        } else {
-          // For each field in the outputSchema, do the mapping
-          DefaultHCatRecord dr = new DefaultHCatRecord(outputSchema.size());
-          for (int i = 0; i < outputSchema.size(); i++) {
-            // Figure out the field to read
-            HCatFieldSchema ofs = outputSchema.get(i);
-            dr.set(i, r.get(ofs.getName(), tableSchema));
+
+        r = new LazyHCatRecord(serde.deserialize(currentValue),serde.getObjectInspector());
+        DefaultHCatRecord dr = new DefaultHCatRecord(outputSchema.size());
+        int i = 0;
+        for (String fieldName : outputSchema.getFieldNames()){
+          Integer dataPosn = null;
+          if ((dataPosn = dataSchema.getPosition(fieldName)) != null){
+            dr.set(i, r.get(fieldName,dataSchema));
+          } else {
+            dr.set(i, valuesNotInDataCols.get(fieldName));
           }
-          return dr;
+          i++;
         }
-            
+        
+        return dr;
           
       } catch (Exception e) { 
-        throw new IOException("Failed to create HCatRecord " + e);
+        throw new IOException("Failed to create HCatRecord ",e);
       }
     }
 

Modified: incubator/hcatalog/trunk/src/java/org/apache/hcatalog/mapreduce/HCatSplit.java
URL: http://svn.apache.org/viewvc/incubator/hcatalog/trunk/src/java/org/apache/hcatalog/mapreduce/HCatSplit.java?rev=1297320&r1=1297319&r2=1297320&view=diff
==============================================================================
--- incubator/hcatalog/trunk/src/java/org/apache/hcatalog/mapreduce/HCatSplit.java (original)
+++ incubator/hcatalog/trunk/src/java/org/apache/hcatalog/mapreduce/HCatSplit.java Tue Mar
 6 02:03:24 2012
@@ -65,10 +65,11 @@ public class HCatSplit extends InputSpli
      * @param tableSchema the table level schema
      */
     public HCatSplit(PartInfo partitionInfo, 
-        org.apache.hadoop.mapred.InputSplit baseMapRedSplit, 
+        org.apache.hadoop.mapred.InputSplit baseMapRedSplit,
         HCatSchema tableSchema) {
 
       this.partitionInfo = partitionInfo;
+      // dataSchema can be obtained from partitionInfo.getPartitionSchema()
       this.baseMapRedSplit = baseMapRedSplit;
       this.tableSchema = tableSchema;
     }
@@ -90,19 +91,19 @@ public class HCatSplit extends InputSpli
     }
 
     /**
-     * Sets the table schema.
-     * @param tableSchema the new table schema
+     * Gets the data schema.
+     * @return the table schema
      */
-    public void setTableSchema(HCatSchema tableSchema) {
-        this.tableSchema = tableSchema;
+    public HCatSchema getDataSchema() {
+        return this.partitionInfo.getPartitionSchema();
     }
-
+    
     /**
      * Gets the table schema.
      * @return the table schema
      */
     public HCatSchema getTableSchema() {
-        return tableSchema;
+      return this.tableSchema;
     }
 
     /* (non-Javadoc)
@@ -187,7 +188,4 @@ public class HCatSplit extends InputSpli
         WritableUtils.writeString(output, tableSchemaString);
     }
 
-    public HCatSchema getSchema() {
-      return tableSchema;
-    }
 }

Modified: incubator/hcatalog/trunk/src/java/org/apache/hcatalog/mapreduce/InternalUtil.java
URL: http://svn.apache.org/viewvc/incubator/hcatalog/trunk/src/java/org/apache/hcatalog/mapreduce/InternalUtil.java?rev=1297320&r1=1297319&r2=1297320&view=diff
==============================================================================
--- incubator/hcatalog/trunk/src/java/org/apache/hcatalog/mapreduce/InternalUtil.java (original)
+++ incubator/hcatalog/trunk/src/java/org/apache/hcatalog/mapreduce/InternalUtil.java Tue
Mar  6 02:03:24 2012
@@ -122,9 +122,9 @@ class InternalUtil {
   }
 
   static void initializeInputSerDe(SerDe serDe, Configuration conf, 
-                                   HCatTableInfo info)
+                                   HCatTableInfo info, HCatSchema s)
   throws SerDeException {
-    initializeSerDe(serDe, conf, info, info.getDataColumns()); 
+    initializeSerDe(serDe, conf, info, s); 
   }
 
   static void initializeSerDe(SerDe serDe, Configuration conf, 

Modified: incubator/hcatalog/trunk/src/java/org/apache/hcatalog/pig/HCatLoader.java
URL: http://svn.apache.org/viewvc/incubator/hcatalog/trunk/src/java/org/apache/hcatalog/pig/HCatLoader.java?rev=1297320&r1=1297319&r2=1297320&view=diff
==============================================================================
--- incubator/hcatalog/trunk/src/java/org/apache/hcatalog/pig/HCatLoader.java (original)
+++ incubator/hcatalog/trunk/src/java/org/apache/hcatalog/pig/HCatLoader.java Tue Mar  6 02:03:24
2012
@@ -127,6 +127,7 @@ public class HCatLoader extends HCatBase
         try {
           HCatSchema hcatTableSchema = (HCatSchema) props.get(HCatConstants.HCAT_TABLE_SCHEMA);
           outputSchema = hcatTableSchema;
+          HCatInputFormat.setOutputSchema(job, outputSchema);
         } catch (Exception e) {
           throw new IOException(e);
         }

Modified: incubator/hcatalog/trunk/src/test/org/apache/hcatalog/data/TestHCatRecordSerDe.java
URL: http://svn.apache.org/viewvc/incubator/hcatalog/trunk/src/test/org/apache/hcatalog/data/TestHCatRecordSerDe.java?rev=1297320&r1=1297319&r2=1297320&view=diff
==============================================================================
--- incubator/hcatalog/trunk/src/test/org/apache/hcatalog/data/TestHCatRecordSerDe.java (original)
+++ incubator/hcatalog/trunk/src/test/org/apache/hcatalog/data/TestHCatRecordSerDe.java Tue
Mar  6 02:03:24 2012
@@ -153,12 +153,10 @@ public class TestHCatRecordSerDe extends
       System.out.println("FOUR:"+s4.toString());
 
       // Test LazyHCatRecord init and read
-      LazyHCatRecord s5 = new LazyHCatRecord(o3,testSD.getObjectInspector(),
-              new HashMap<Integer, Object>());
+      LazyHCatRecord s5 = new LazyHCatRecord(o3,testSD.getObjectInspector());
       System.out.println("FIVE:"+s5.toString());
 
-      LazyHCatRecord s6 = new LazyHCatRecord(s4,hrsd.getObjectInspector(),
-              new HashMap<Integer, Object>());
+      LazyHCatRecord s6 = new LazyHCatRecord(s4,hrsd.getObjectInspector());
       System.out.println("SIX:"+s6.toString());
 
     }

Modified: incubator/hcatalog/trunk/src/test/org/apache/hcatalog/data/TestLazyHCatRecord.java
URL: http://svn.apache.org/viewvc/incubator/hcatalog/trunk/src/test/org/apache/hcatalog/data/TestLazyHCatRecord.java?rev=1297320&r1=1297319&r2=1297320&view=diff
==============================================================================
--- incubator/hcatalog/trunk/src/test/org/apache/hcatalog/data/TestLazyHCatRecord.java (original)
+++ incubator/hcatalog/trunk/src/test/org/apache/hcatalog/data/TestLazyHCatRecord.java Tue
Mar  6 02:03:24 2012
@@ -53,12 +53,10 @@ public class TestLazyHCatRecord extends 
   private final long LONG_CONST = 5000000000L;
   private final double DOUBLE_CONST = 3.141592654;
   private final String STRING_CONST = "hello world";
-  private final String PART_CONST = "20120221";
 
 
   public void testGet() throws Exception {
-    HCatRecord r = new LazyHCatRecord(getHCatRecord(), getObjectInspector(),
-        new HashMap<Integer, Object>());
+    HCatRecord r = new LazyHCatRecord(getHCatRecord(), getObjectInspector());
     assertEquals(INT_CONST, ((Integer)r.get(0)).intValue());
     assertEquals(LONG_CONST, ((Long)r.get(1)).longValue());
     assertEquals(DOUBLE_CONST, ((Double)r.get(2)).doubleValue());
@@ -67,8 +65,7 @@ public class TestLazyHCatRecord extends 
 
   public void testGetWithName() throws Exception {
     TypeInfo ti = getTypeInfo();
-    HCatRecord r = new LazyHCatRecord(getHCatRecord(), getObjectInspector(ti),
-    new HashMap<Integer, Object>());
+    HCatRecord r = new LazyHCatRecord(getHCatRecord(), getObjectInspector(ti));
     HCatSchema schema = HCatSchemaUtils.getHCatSchema(ti)
                                           .get(0).getStructSubSchema();
     assertEquals(INT_CONST, ((Integer)r.get("an_int", schema)).intValue());
@@ -78,8 +75,7 @@ public class TestLazyHCatRecord extends 
   }
 
   public void testGetAll() throws Exception {
-    HCatRecord r = new LazyHCatRecord(getHCatRecord(), getObjectInspector(),
-        new HashMap<Integer, Object>());
+    HCatRecord r = new LazyHCatRecord(getHCatRecord(), getObjectInspector());
     List<Object> list = r.getAll();
     assertEquals(INT_CONST, ((Integer)list.get(0)).intValue());
     assertEquals(LONG_CONST, ((Long)list.get(1)).longValue());
@@ -88,8 +84,7 @@ public class TestLazyHCatRecord extends 
   }
 
   public void testSet() throws Exception {
-    HCatRecord r = new LazyHCatRecord(getHCatRecord(), getObjectInspector(),
-        new HashMap<Integer, Object>());
+    HCatRecord r = new LazyHCatRecord(getHCatRecord(), getObjectInspector());
     boolean sawException = false;
     try {
       r.set(3, "Mary had a little lamb");
@@ -100,14 +95,12 @@ public class TestLazyHCatRecord extends 
   }
 
   public void testSize() throws Exception {
-    HCatRecord r = new LazyHCatRecord(getHCatRecord(), getObjectInspector(),
-        new HashMap<Integer, Object>());
+    HCatRecord r = new LazyHCatRecord(getHCatRecord(), getObjectInspector());
     assertEquals(4, r.size());
   }
 
   public void testReadFields() throws Exception {
-    HCatRecord r = new LazyHCatRecord(getHCatRecord(), getObjectInspector(),
-        new HashMap<Integer, Object>());
+    HCatRecord r = new LazyHCatRecord(getHCatRecord(), getObjectInspector());
     boolean sawException = false;
     try {
       r.readFields(null);
@@ -118,8 +111,7 @@ public class TestLazyHCatRecord extends 
   }
 
   public void testWrite() throws Exception {
-    HCatRecord r = new LazyHCatRecord(getHCatRecord(), getObjectInspector(),
-        new HashMap<Integer, Object>());
+    HCatRecord r = new LazyHCatRecord(getHCatRecord(), getObjectInspector());
     boolean sawException = false;
     try {
       r.write(null);
@@ -130,8 +122,7 @@ public class TestLazyHCatRecord extends 
   }
 
   public void testSetWithName() throws Exception {
-    HCatRecord r = new LazyHCatRecord(getHCatRecord(), getObjectInspector(),
-        new HashMap<Integer, Object>());
+    HCatRecord r = new LazyHCatRecord(getHCatRecord(), getObjectInspector());
     boolean sawException = false;
     try {
       r.set("fred", null, "bob");
@@ -142,8 +133,7 @@ public class TestLazyHCatRecord extends 
   }
 
   public void testRemove() throws Exception {
-    HCatRecord r = new LazyHCatRecord(getHCatRecord(), getObjectInspector(),
-        new HashMap<Integer, Object>());
+    HCatRecord r = new LazyHCatRecord(getHCatRecord(), getObjectInspector());
     boolean sawException = false;
     try {
       r.remove(0);
@@ -154,8 +144,7 @@ public class TestLazyHCatRecord extends 
   }
 
   public void testCopy() throws Exception {
-    HCatRecord r = new LazyHCatRecord(getHCatRecord(), getObjectInspector(),
-        new HashMap<Integer, Object>());
+    HCatRecord r = new LazyHCatRecord(getHCatRecord(), getObjectInspector());
     boolean sawException = false;
     try {
       r.copy(null);
@@ -166,8 +155,7 @@ public class TestLazyHCatRecord extends 
   }
 
   public void testGetWritable() throws Exception {
-    HCatRecord r = new LazyHCatRecord(getHCatRecord(), getObjectInspector(),
-        new HashMap<Integer, Object>()).getWritable();
+    HCatRecord r = new LazyHCatRecord(getHCatRecord(), getObjectInspector()).getWritable();
     assertEquals(INT_CONST, ((Integer)r.get(0)).intValue());
     assertEquals(LONG_CONST, ((Long)r.get(1)).longValue());
     assertEquals(DOUBLE_CONST, ((Double)r.get(2)).doubleValue());
@@ -175,55 +163,6 @@ public class TestLazyHCatRecord extends 
     assertEquals("org.apache.hcatalog.data.DefaultHCatRecord", r.getClass().getName());
   }
 
-  public void testGetPartitioned() throws Exception {
-    HCatRecord r = new LazyHCatRecord(getHCatRecord(), getObjectInspector(),
-        getPartCols());
-    assertEquals(INT_CONST, ((Integer)r.get(0)).intValue());
-    assertEquals(LONG_CONST, ((Long)r.get(1)).longValue());
-    assertEquals(DOUBLE_CONST, ((Double)r.get(2)).doubleValue());
-    assertEquals(STRING_CONST, (String)r.get(3));
-    assertEquals(PART_CONST, (String)r.get(4));
-  }
-
-  public void testGetWithNamePartitioned() throws Exception {
-    TypeInfo ti = getTypeInfo();
-    HCatRecord r = new LazyHCatRecord(getHCatRecord(), getObjectInspector(ti),
-        getPartCols());
-    HCatSchema schema = HCatSchemaUtils.getHCatSchema(ti)
-                                          .get(0).getStructSubSchema();
-    assertEquals(INT_CONST, ((Integer)r.get("an_int", schema)).intValue());
-    assertEquals(LONG_CONST, ((Long)r.get("a_long", schema)).longValue());
-    assertEquals(DOUBLE_CONST, ((Double)r.get("a_double", schema)).doubleValue());
-    assertEquals(STRING_CONST, (String)r.get("a_string", schema));
-  }
-
-  public void testGetAllPartitioned() throws Exception {
-    HCatRecord r = new LazyHCatRecord(getHCatRecord(), getObjectInspector(),
-        getPartCols());
-    List<Object> list = r.getAll();
-    assertEquals(INT_CONST, ((Integer)list.get(0)).intValue());
-    assertEquals(LONG_CONST, ((Long)list.get(1)).longValue());
-    assertEquals(DOUBLE_CONST, ((Double)list.get(2)).doubleValue());
-    assertEquals(STRING_CONST, (String)list.get(3));
-    assertEquals(PART_CONST, (String)r.get(4));
-  }
-
-  public void testSizePartitioned() throws Exception {
-    HCatRecord r = new LazyHCatRecord(getHCatRecord(), getObjectInspector(),
-        getPartCols());
-    assertEquals(5, r.size());
-  }
-
-  public void testGetWritablePartitioned() throws Exception {
-    HCatRecord r = new LazyHCatRecord(getHCatRecord(), getObjectInspector(),
-        getPartCols()).getWritable();
-    assertEquals(INT_CONST, ((Integer)r.get(0)).intValue());
-    assertEquals(LONG_CONST, ((Long)r.get(1)).longValue());
-    assertEquals(DOUBLE_CONST, ((Double)r.get(2)).doubleValue());
-    assertEquals(STRING_CONST, (String)r.get(3));
-    assertEquals(PART_CONST, (String)r.get(4));
-    assertEquals("org.apache.hcatalog.data.DefaultHCatRecord", r.getClass().getName());
-  }
 
   private HCatRecord getHCatRecord() throws Exception {
 
@@ -262,10 +201,4 @@ public class TestLazyHCatRecord extends 
     return HCatRecordObjectInspectorFactory.getHCatRecordObjectInspector(
           (StructTypeInfo)getTypeInfo());
   }
-
-  private Map<Integer, Object> getPartCols() {
-    Map<Integer, Object> pc = new HashMap<Integer, Object>(1);
-    pc.put(4, PART_CONST);
-    return pc;
-  }
 }



Mime
View raw message