@Override public void addRow(List<Object> t) { if (dummyRow != null || hashMapResult.hasRows()) { throw new RuntimeException("Cannot add rows when not empty"); } dummyRow = t; wasFirstCalledOnDummyRow = false; }
@Override public void addRow(List<Object> t) { if (dummyRow != null || hashMapResult.hasRows()) { throw new RuntimeException("Cannot add rows when not empty"); } dummyRow = t; }
@Override public void addRow(List<Object> t) { if (dummyRow != null || hashMapResult.hasRows()) { throw new RuntimeException("Cannot add rows when not empty"); } dummyRow = t; }
public JoinUtil.JoinResult setFromOutput(Output output) throws HiveException { int keyHash = HashCodeUtil.murmurHash(output.getData(), 0, output.getLength()); if (bloom1 != null && !bloom1.testLong(keyHash)) { /* * if the keyHash is missing in the bloom filter, then the value cannot * exist in any of the spilled partition - return NOMATCH */ dummyRow = null; aliasFilter = (byte) 0xff; hashMapResult.forget(); return JoinResult.NOMATCH; } partitionId = keyHash & (hashPartitions.length - 1); // If the target hash table is on disk, spill this row to disk as well to be processed later if (isOnDisk(partitionId)) { toSpillPartitionId = partitionId; hashMapResult.forget(); return JoinUtil.JoinResult.SPILL; } else { aliasFilter = hashPartitions[partitionId].hashMap.getValueResult(output.getData(), 0, output.getLength(), hashMapResult, /* matchTracker */ null); dummyRow = null; if (hashMapResult.hasRows()) { return JoinUtil.JoinResult.MATCH; } else { aliasFilter = (byte) 0xff; return JoinUtil.JoinResult.NOMATCH; } } }
private void verifyHashMapResult(BytesBytesMultiHashMap map, byte[] key, byte[]... values) { BytesBytesMultiHashMap.Result hashMapResult = new BytesBytesMultiHashMap.Result(); byte state = map.getValueResult(key, 0, key.length, hashMapResult, null); HashSet<ByteBuffer> hs = new HashSet<ByteBuffer>(); int count = 0; if (hashMapResult.hasRows()) { WriteBuffers.ByteSegmentRef ref = hashMapResult.first(); while (ref != null) { count++; hs.add(ref.copy()); ref = hashMapResult.next(); } } assertEquals(state, count); assertEquals(values.length, count); for (int i = 0; i < values.length; ++i) { assertTrue(hs.contains(ByteBuffer.wrap(values[i]))); } }
@Override public boolean hasRows() { return hashMapResult.hasRows() || (dummyRow != null); }
@Override public boolean hasRows() { return hashMapResult.hasRows() || (dummyRow != null); }
@Test public void testGetNonExistent() throws Exception { BytesBytesMultiHashMap map = new BytesBytesMultiHashMap(CAPACITY, LOAD_FACTOR, WB_SIZE); RandomKvSource kv = new RandomKvSource(1, 100); map.put(kv, -1); byte[] key = kv.getLastKey(); key[0] = (byte)(key[0] + 1); FixedKeyKvSource kv2 = new FixedKeyKvSource(kv.getLastKey(), 0, 100); map.put(kv2, -1); key[0] = (byte)(key[0] + 1); BytesBytesMultiHashMap.Result hashMapResult = new BytesBytesMultiHashMap.Result(); map.getValueResult(key, 0, key.length, hashMapResult, null); assertTrue(!hashMapResult.hasRows()); map.getValueResult(key, 0, 0, hashMapResult, null); assertTrue(!hashMapResult.hasRows()); }
public JoinUtil.JoinResult setDirect(byte[] bytes, int offset, int length, BytesBytesMultiHashMap.Result hashMapResult) { aliasFilter = hashMap.getValueResult(bytes, offset, length, hashMapResult); dummyRow = null; if (hashMapResult.hasRows()) { return JoinUtil.JoinResult.MATCH; } else { aliasFilter = (byte) 0xff; return JoinUtil.JoinResult.NOMATCH; } } }
@Override public void addRow(List<Object> t) { if (dummyRow != null || hashMapResult.hasRows()) { throw new RuntimeException("Cannot add rows when not empty"); } dummyRow = t; }
@Override public boolean isSingleRow() { if (!hashMapResult.hasRows()) { return (dummyRow != null); } return hashMapResult.isSingleRow(); }
public JoinUtil.JoinResult setFromOutput(Output output) { aliasFilter = hashMap.getValueResult( output.getData(), 0, output.getLength(), hashMapResult); dummyRow = null; if (hashMapResult.hasRows()) { return JoinUtil.JoinResult.MATCH; } else { aliasFilter = (byte) 0xff; return JoinUtil.JoinResult.NOMATCH; } }
@Override public boolean isSingleRow() { if (!hashMapResult.hasRows()) { return (dummyRow != null); } return hashMapResult.isSingleRow(); }
@Override public boolean hasRows() { return hashMapResult.hasRows() || (dummyRow != null && !wasFirstCalledOnDummyRow); }
@Override public boolean hasRows() { return hashMapResult.hasRows() || (dummyRow != null); }
@Override public boolean isSingleRow() { if (!hashMapResult.hasRows()) { return (dummyRow != null); } return hashMapResult.isSingleRow(); }
public JoinUtil.JoinResult setFromOutput(Output output, MatchTracker matchTracker) { aliasFilter = hashMap.getValueResult( output.getData(), 0, output.getLength(), hashMapResult, matchTracker); dummyRow = null; wasFirstCalledOnDummyRow = false; if (hashMapResult.hasRows()) { return JoinUtil.JoinResult.MATCH; } else { aliasFilter = (byte) 0xff; return JoinUtil.JoinResult.NOMATCH; } }
public JoinUtil.JoinResult setDirect(byte[] bytes, int offset, int length, BytesBytesMultiHashMap.Result hashMapResult, MatchTracker matchTracker) { aliasFilter = hashMap.getValueResult(bytes, offset, length, hashMapResult, matchTracker); dummyRow = null; if (hashMapResult.hasRows()) { return JoinUtil.JoinResult.MATCH; } else { aliasFilter = (byte) 0xff; return JoinUtil.JoinResult.NOMATCH; } } }
@Override public boolean isSingleRow() { if (!hashMapResult.hasRows()) { return (dummyRow != null); } return hashMapResult.isSingleRow(); }
public JoinUtil.JoinResult setFromOutput(Output output) { aliasFilter = hashMap.getValueResult( output.getData(), 0, output.getLength(), hashMapResult, /* matchTracker */ null); dummyRow = null; wasFirstCalledOnDummyRow = false; if (hashMapResult.hasRows()) { return JoinUtil.JoinResult.MATCH; } else { aliasFilter = (byte) 0xff; return JoinUtil.JoinResult.NOMATCH; } }