@Override public MapJoinRowContainer copy() { MapJoinEagerRowContainer result = new MapJoinEagerRowContainer(); for(List<Object> item : list) { result.addRow(item); } return result; }
@Override public MapJoinRowContainer copy() { MapJoinEagerRowContainer result = new MapJoinEagerRowContainer(); for(List<Object> item : list) { result.addRow(item); } return result; }
private void loadNormal(MapJoinPersistableTableContainer container, ObjectInputStream in, Writable keyContainer, Writable valueContainer) throws Exception { int numKeys = in.readInt(); for (int keyIndex = 0; keyIndex < numKeys; keyIndex++) { MapJoinKeyObject key = new MapJoinKeyObject(); key.read(keyContext, in, keyContainer); if (container.get(key) == null) { container.put(key, new MapJoinEagerRowContainer()); } MapJoinEagerRowContainer values = (MapJoinEagerRowContainer) container.get(key); values.read(valueContext, in, valueContainer); container.put(key, values); } }
static MapJoinEagerRowContainer serde( MapJoinRowContainer container, String columns, String types) throws Exception { MapJoinEagerRowContainer result = new MapJoinEagerRowContainer(); ByteArrayInputStream bais; ObjectInputStream in; ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream out = new ObjectOutputStream(baos); LazyBinarySerDe serde = new LazyBinarySerDe(); Properties props = new Properties(); props.put(serdeConstants.LIST_COLUMNS, columns); props.put(serdeConstants.LIST_COLUMN_TYPES, types); SerDeUtils.initializeSerDe(serde, null, props, null); MapJoinObjectSerDeContext context = new MapJoinObjectSerDeContext(serde, true); container.write(context, out); out.close(); bais = new ByteArrayInputStream(baos.toByteArray()); in = new ObjectInputStream(bais); result.read(context, in, new BytesWritable()); return result; } }
private void loadNormal(MapJoinPersistableTableContainer container, ObjectInputStream in, Writable keyContainer, Writable valueContainer) throws Exception { int numKeys = in.readInt(); for (int keyIndex = 0; keyIndex < numKeys; keyIndex++) { MapJoinKeyObject key = new MapJoinKeyObject(); key.read(keyContext, in, keyContainer); if (container.get(key) == null) { container.put(key, new MapJoinEagerRowContainer()); } MapJoinEagerRowContainer values = (MapJoinEagerRowContainer) container.get(key); values.read(valueContext, in, valueContainer); container.put(key, values); } }
@Before public void setup() throws Exception { rowContainer = new MapJoinEagerRowContainer(); rowContainer.addRow(VALUE); container = new HashMapWrapper(); } @Test
MapJoinKeyObject key = new MapJoinKeyObject(); key.read(keyContext, in, keyContainer); MapJoinEagerRowContainer values = new MapJoinEagerRowContainer(); values.read(valueContext, in, valueContainer); tableContainer.put(key, values);
@Test public void testSerialization() throws Exception { MapJoinRowContainer container1 = new MapJoinEagerRowContainer(); container1.addRow(new Object[]{ new Text("f0"), null, new ShortWritable((short)0xf)}); container1.addRow(Arrays.asList(new Object[]{ null, new Text("f1"), new ShortWritable((short)0xf)})); container1.addRow(new Object[]{ null, null, new ShortWritable((short)0xf)}); container1.addRow(Arrays.asList(new Object[]{ new Text("f0"), new Text("f1"), new ShortWritable((short)0x1)})); MapJoinRowContainer container2 = Utilities.serde(container1, "f0,f1,filter", "string,string,smallint"); Utilities.testEquality(container1, container2); Assert.assertEquals(4, container1.rowCount()); Assert.assertEquals(1, container2.getAliasFilter()); }
MapJoinKeyObject key = new MapJoinKeyObject(); key.read(keyContext, in, keyContainer); MapJoinEagerRowContainer values = new MapJoinEagerRowContainer(); values.read(valueContext, in, valueContainer); tableContainer.put(key, values);
if (rowContainer == null) { if(value.length != 0) { rowContainer = new MapJoinEagerRowContainer(); rowContainer.addRow(value); } else {
if (rowContainer == null) { if(value.length != 0) { rowContainer = new MapJoinEagerRowContainer(); rowContainer.addRow(value); } else {
@Before public void setup() throws Exception { key = new MapJoinKeyObject(KEY); rowContainer = new MapJoinEagerRowContainer(); rowContainer.addRow(VALUE); baos = new ByteArrayOutputStream(); out = new ObjectOutputStream(baos); LazyBinarySerDe keySerde = new LazyBinarySerDe(); Properties keyProps = new Properties(); keyProps.put(serdeConstants.LIST_COLUMNS, "v1"); keyProps.put(serdeConstants.LIST_COLUMN_TYPES, "string"); SerDeUtils.initializeSerDe(keySerde, null, keyProps, null); LazyBinarySerDe valueSerde = new LazyBinarySerDe(); Properties valueProps = new Properties(); valueProps.put(serdeConstants.LIST_COLUMNS, "v1"); valueProps.put(serdeConstants.LIST_COLUMN_TYPES, "string"); SerDeUtils.initializeSerDe(valueSerde, null, keyProps, null); containerSerde = new MapJoinTableContainerSerDe( new MapJoinObjectSerDeContext(keySerde, false), new MapJoinObjectSerDeContext(valueSerde, false)); container = new HashMapWrapper(); }
@Override public MapJoinRowContainer copy() { MapJoinEagerRowContainer result = new MapJoinEagerRowContainer(); for(List<Object> item : list) { result.addRow(item); } return result; }
key.read(keyContext, in, keyContainer); if (tableContainer.get(key) == null) { tableContainer.put(key, new MapJoinEagerRowContainer());
MapJoinKeyObject key = new MapJoinKeyObject(); key.read(keyContext, in, keyContainer); MapJoinEagerRowContainer values = new MapJoinEagerRowContainer(); values.read(valueContext, in, valueContainer); tableContainer.put(key, values);
if (rowContainer == null) { if(value.length != 0) { rowContainer = new MapJoinEagerRowContainer(); rowContainer.addRow(value); } else {