assertNotNull(b.getMapValueElement(new Text(col1))); assertNotNull(b.getMapValueElement(new Text(col2)));
((LazyString)b.getMapValueElement( new IntWritable(2))).getWritableObject()); assertNull(b.getMapValueElement(new IntWritable(-1))); ((LazyString)b.getMapValueElement( new IntWritable(0))).getWritableObject()); ((LazyString)b.getMapValueElement( new IntWritable(8))).getWritableObject()); assertNull(b.getMapValueElement(new IntWritable(12345)));
((LazyString)b.getMapValueElement( new Text("2"))).getWritableObject()); assertNull(b.getMapValueElement(new Text("-1"))); ((LazyString)b.getMapValueElement( new Text("0"))).getWritableObject()); ((LazyString)b.getMapValueElement( new Text("8"))).getWritableObject()); assertNull(b.getMapValueElement(new Text("-")));
((LazyHBaseCellMap) fieldData).getMapValueElement(expectedQualifiers.get(k)) .toString().trim()); k++; assertNull(((LazyHBaseCellMap) fieldData).getMapValueElement(notPresentKey));
} else if (fieldData instanceof LazyHBaseCellMap) { assertEquals(expectedFieldsData[i], ((LazyHBaseCellMap) fieldData) .getMapValueElement(expectedQualifiers.get(j)).toString().trim()); assertNull(((LazyHBaseCellMap) fieldData).getMapValueElement(notPresentKey));
IntWritable expectedIntValue = new IntWritable(1); LazyPrimitive<?, ?> lazyPrimitive = (LazyPrimitive<?, ?>) hbaseCellMap.getMapValueElement(expectedIntValue); expectedIntValue = new IntWritable(Integer.MIN_VALUE); lazyPrimitive = (LazyPrimitive<?, ?>) hbaseCellMap.getMapValueElement(expectedIntValue); expectedIntValue = new IntWritable(Integer.MAX_VALUE); lazyPrimitive = (LazyPrimitive<?, ?>) hbaseCellMap.getMapValueElement(expectedIntValue); ByteWritable expectedByteValue = new ByteWritable((byte) 1); lazyPrimitive = (LazyPrimitive<?, ?>) hbaseCellMap.getMapValueElement(expectedByteValue); expectedByteValue = new ByteWritable(Byte.MIN_VALUE); lazyPrimitive = (LazyPrimitive<?, ?>) hbaseCellMap.getMapValueElement(expectedByteValue); expectedByteValue = new ByteWritable(Byte.MAX_VALUE); lazyPrimitive = (LazyPrimitive<?, ?>) hbaseCellMap.getMapValueElement(expectedByteValue); ShortWritable expectedShortValue = new ShortWritable((short) 1); lazyPrimitive = (LazyPrimitive<?, ?>) hbaseCellMap.getMapValueElement(expectedShortValue); expectedShortValue = new ShortWritable(Short.MIN_VALUE);
private void deserializeAndSerializeHiveMapHBaseColumnFamilyII( HBaseSerDe hbaseSerDe, Result r, Put p, Object [] expectedData, byte [][] columnFamilies, byte [][] columnQualifiersAndValues) throws SerDeException { StructObjectInspector soi = (StructObjectInspector) hbaseSerDe.getObjectInspector(); List<? extends StructField> fieldRefs = soi.getAllStructFieldRefs(); assertEquals(9, fieldRefs.size()); // Deserialize Object row = hbaseSerDe.deserialize(new ResultWritable(r)); for (int j = 0; j < fieldRefs.size(); j++) { Object fieldData = soi.getStructFieldData(row, fieldRefs.get(j)); assertNotNull(fieldData); if (fieldData instanceof LazyPrimitive<?, ?>) { assertEquals(expectedData[j], ((LazyPrimitive<?, ?>) fieldData).getWritableObject()); } else if (fieldData instanceof LazyHBaseCellMap) { LazyPrimitive<?, ?> lazyPrimitive = (LazyPrimitive<?, ?>) ((LazyHBaseCellMap) fieldData).getMapValueElement(expectedData[j]); assertEquals(expectedData[j], lazyPrimitive.getWritableObject()); } else { fail("Error: field data not an instance of LazyPrimitive<?, ?> or LazyHBaseCellMap"); } } // Serialize Put serializedPut = ((PutWritable) hbaseSerDe.serialize(row, soi)).getPut(); assertEquals("Serialized data: ", p.toString(), serializedPut.toString()); }
} else if (fieldData instanceof LazyHBaseCellMap) { LazyPrimitive<?, ?> lazyPrimitive = (LazyPrimitive<?, ?>) ((LazyHBaseCellMap) fieldData).getMapValueElement(expectedData[i][j]); assertEquals(expectedData[i][j], lazyPrimitive.getWritableObject()); } else {