use of org.apache.hadoop.hive.accumulo.AccumuloHiveRow in project hive by apache.
the class TestHiveAccumuloTableInputFormat method testGetOnlyName.
@Test
public void testGetOnlyName() throws Exception {
FileInputFormat.addInputPath(conf, new Path("unused"));
InputSplit[] splits = inputformat.getSplits(conf, 0);
assertEquals(splits.length, 1);
RecordReader<Text, AccumuloHiveRow> reader = inputformat.getRecordReader(splits[0], conf, null);
Text rowId = new Text("r1");
AccumuloHiveRow row = new AccumuloHiveRow();
assertTrue(reader.next(rowId, row));
assertEquals(row.getRowId(), rowId.toString());
assertTrue(row.hasFamAndQual(COLUMN_FAMILY, NAME));
assertArrayEquals(row.getValue(COLUMN_FAMILY, NAME), "brian".getBytes());
rowId = new Text("r2");
assertTrue(reader.next(rowId, row));
assertEquals(row.getRowId(), rowId.toString());
assertTrue(row.hasFamAndQual(COLUMN_FAMILY, NAME));
assertArrayEquals(row.getValue(COLUMN_FAMILY, NAME), "mark".getBytes());
rowId = new Text("r3");
assertTrue(reader.next(rowId, row));
assertEquals(row.getRowId(), rowId.toString());
assertTrue(row.hasFamAndQual(COLUMN_FAMILY, NAME));
assertArrayEquals(row.getValue(COLUMN_FAMILY, NAME), "dennis".getBytes());
assertFalse(reader.next(rowId, row));
}
use of org.apache.hadoop.hive.accumulo.AccumuloHiveRow in project hive by apache.
the class TestAccumuloSerDe method invalidColMapping.
@Test(expected = InvalidColumnMappingException.class)
public void invalidColMapping() throws Exception {
Properties properties = new Properties();
Configuration conf = new Configuration();
properties.setProperty(AccumuloSerDeParameters.COLUMN_MAPPINGS, "cf,cf:f2,cf:f3");
properties.setProperty(serdeConstants.LIST_COLUMNS, "field2,field3,field4");
serde.initialize(conf, properties);
AccumuloHiveRow row = new AccumuloHiveRow();
row.setRowId("r1");
Object obj = serde.deserialize(row);
assertTrue(obj instanceof LazyAccumuloRow);
LazyAccumuloRow lazyRow = (LazyAccumuloRow) obj;
lazyRow.getField(0);
}
Aggregations