Xikui Wang has uploaded a new change for review.
https://asterix-gerrit.ics.uci.edu/1994
Change subject: [HYR] Remove table size from InMemoryHashJoin interface
......................................................................
[HYR] Remove table size from InMemoryHashJoin interface
- user model changes: no
- storage format changes: no
- interface changes: yes
Details:
As this info is available in HashTable already, table size should not
be part of the interface.
Change-Id: I02a677ecfef80ccd4332447a6dcb5d480be6fe80
---
M
hyracks-fullstack/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/join/HybridHashJoinOperatorDescriptor.java
M
hyracks-fullstack/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/join/InMemoryHashJoin.java
M
hyracks-fullstack/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/join/InMemoryHashJoinOperatorDescriptor.java
M
hyracks-fullstack/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/structures/ISerializableTable.java
M
hyracks-fullstack/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/structures/SerializableHashTable.java
5 files changed, 27 insertions(+), 36 deletions(-)
git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb
refs/changes/94/1994/1
diff --git
a/hyracks-fullstack/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/join/HybridHashJoinOperatorDescriptor.java
b/hyracks-fullstack/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/join/HybridHashJoinOperatorDescriptor.java
index d9e6180..665bb2b 100644
---
a/hyracks-fullstack/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/join/HybridHashJoinOperatorDescriptor.java
+++
b/hyracks-fullstack/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/join/HybridHashJoinOperatorDescriptor.java
@@ -309,10 +309,10 @@
.createPartitioner();
int tableSize = (int) (state.memoryForHashtable *
recordsPerFrame * factor);
ISerializableTable table = new
SimpleSerializableHashTable(tableSize, ctx);
- state.joiner = new InMemoryHashJoin(ctx, tableSize, new
FrameTupleAccessor(rd0), hpc0,
- new FrameTupleAccessor(rd1), rd1, hpc1,
- new FrameTuplePairComparator(keys0, keys1,
comparators), isLeftOuter, nullWriters1, table,
- predEvaluator, null);
+ state.joiner =
+ new InMemoryHashJoin(ctx, new
FrameTupleAccessor(rd0), hpc0, new FrameTupleAccessor(rd1),
+ rd1, hpc1, new
FrameTuplePairComparator(keys0, keys1, comparators), isLeftOuter,
+ nullWriters1, table, predEvaluator, null);
bufferForPartitions = new IFrame[state.nPartitions];
state.fWriters = new RunFileWriter[state.nPartitions];
for (int i = 0; i < state.nPartitions; i++) {
@@ -505,10 +505,11 @@
continue;
}
table.reset();
- InMemoryHashJoin joiner = new
InMemoryHashJoin(ctx, tableSize,
- new FrameTupleAccessor(rd0), hpcRep0,
new FrameTupleAccessor(rd1), rd1, hpcRep1,
- new FrameTuplePairComparator(keys0,
keys1, comparators), isLeftOuter,
- nullWriters1, table, predEvaluator,
null);
+ InMemoryHashJoin joiner =
+ new InMemoryHashJoin(ctx, new
FrameTupleAccessor(rd0), hpcRep0,
+ new FrameTupleAccessor(rd1),
rd1, hpcRep1,
+ new
FrameTuplePairComparator(keys0, keys1, comparators), isLeftOuter,
+ nullWriters1, table,
predEvaluator, null);
if (buildWriter != null) {
RunFileReader buildReader =
buildWriter.createDeleteOnCloseReader();
diff --git
a/hyracks-fullstack/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/join/InMemoryHashJoin.java
b/hyracks-fullstack/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/join/InMemoryHashJoin.java
index ec1c3a9..7f34d13 100644
---
a/hyracks-fullstack/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/join/InMemoryHashJoin.java
+++
b/hyracks-fullstack/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/join/InMemoryHashJoin.java
@@ -56,7 +56,6 @@
private final boolean isLeftOuter;
private final ArrayTupleBuilder missingTupleBuild;
private final ISerializableTable table;
- private final int tableSize;
private final TuplePointer storedTuplePointer;
private final boolean reverseOutputOrder; //Should we reverse the order of
tuples, we are writing in output
private final IPredicateEvaluator predEvaluator;
@@ -67,23 +66,22 @@
private static final Logger LOGGER =
Logger.getLogger(InMemoryHashJoin.class.getName());
- public InMemoryHashJoin(IHyracksTaskContext ctx, int tableSize,
FrameTupleAccessor accessorProbe,
+ public InMemoryHashJoin(IHyracksTaskContext ctx, FrameTupleAccessor
accessorProbe,
ITuplePartitionComputer tpcProbe, FrameTupleAccessor
accessorBuild, RecordDescriptor rDBuild,
ITuplePartitionComputer tpcBuild, FrameTuplePairComparator
comparator, boolean isLeftOuter,
IMissingWriter[] missingWritersBuild, ISerializableTable table,
IPredicateEvaluator predEval,
ISimpleFrameBufferManager bufferManager)
throws HyracksDataException {
- this(ctx, tableSize, accessorProbe, tpcProbe, accessorBuild, rDBuild,
tpcBuild, comparator, isLeftOuter,
+ this(ctx, accessorProbe, tpcProbe, accessorBuild, rDBuild, tpcBuild,
comparator, isLeftOuter,
missingWritersBuild, table, predEval, false, bufferManager);
}
- public InMemoryHashJoin(IHyracksTaskContext ctx, int tableSize,
FrameTupleAccessor accessorProbe,
+ public InMemoryHashJoin(IHyracksTaskContext ctx, FrameTupleAccessor
accessorProbe,
ITuplePartitionComputer tpcProbe, FrameTupleAccessor accessorBuild,
RecordDescriptor rDBuild, ITuplePartitionComputer tpcBuild,
FrameTuplePairComparator comparator,
boolean isLeftOuter, IMissingWriter[] missingWritersBuild,
ISerializableTable table,
IPredicateEvaluator predEval, boolean reverse,
ISimpleFrameBufferManager bufferManager)
throws HyracksDataException {
- this.tableSize = tableSize;
this.table = table;
storedTuplePointer = new TuplePointer();
buffers = new ArrayList<>();
@@ -109,12 +107,12 @@
reverseOutputOrder = reverse;
this.tupleAccessor = new TupleInFrameListAccessor(rDBuild, buffers);
this.bufferManager = bufferManager;
- if (tableSize != 0) {
+ if (table.getTableSize() != 0) {
isTableCapacityNotZero = true;
} else {
isTableCapacityNotZero = false;
}
- LOGGER.fine("InMemoryHashJoin has been created for a table size of " +
tableSize + " for Thread ID "
+ LOGGER.fine("InMemoryHashJoin has been created for a table size of " +
table.getTableSize() + " for Thread ID "
+ Thread.currentThread().getId() + ".");
}
@@ -124,7 +122,7 @@
accessorBuild.reset(buffer);
int tCount = accessorBuild.getTupleCount();
for (int i = 0; i < tCount; ++i) {
- int entry = tpcBuild.partition(accessorBuild, i, tableSize);
+ int entry = tpcBuild.partition(accessorBuild, i,
table.getTableSize());
storedTuplePointer.reset(bIndex, i);
// If an insertion fails, then tries to insert the same tuple
pointer again after compacting the table.
if (!table.insert(entry, storedTuplePointer)) {
@@ -160,7 +158,7 @@
void join(int tid, IFrameWriter writer) throws HyracksDataException {
boolean matchFound = false;
if (isTableCapacityNotZero) {
- int entry = tpcProbe.partition(accessorProbe, tid, tableSize);
+ int entry = tpcProbe.partition(accessorProbe, tid,
table.getTableSize());
int tupleCount = table.getTupleCount(entry);
for (int i = 0; i < tupleCount; i++) {
table.getTuplePointer(entry, i, storedTuplePointer);
diff --git
a/hyracks-fullstack/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/join/InMemoryHashJoinOperatorDescriptor.java
b/hyracks-fullstack/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/join/InMemoryHashJoinOperatorDescriptor.java
index 702dae6..d81d955 100644
---
a/hyracks-fullstack/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/join/InMemoryHashJoinOperatorDescriptor.java
+++
b/hyracks-fullstack/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/join/InMemoryHashJoinOperatorDescriptor.java
@@ -104,21 +104,6 @@
this.memSizeInFrames = memSizeInFrames;
}
- public InMemoryHashJoinOperatorDescriptor(IOperatorDescriptorRegistry
spec, int[] keys0, int[] keys1,
- IBinaryHashFunctionFactory[] hashFunctionFactories,
IBinaryComparatorFactory[] comparatorFactories,
- RecordDescriptor recordDescriptor, int tableSize, int
memSizeInFrames) {
- this(spec, keys0, keys1, hashFunctionFactories, comparatorFactories,
recordDescriptor, tableSize, null,
- memSizeInFrames);
- }
-
- public InMemoryHashJoinOperatorDescriptor(IOperatorDescriptorRegistry
spec, int[] keys0, int[] keys1,
- IBinaryHashFunctionFactory[] hashFunctionFactories,
IBinaryComparatorFactory[] comparatorFactories,
- RecordDescriptor recordDescriptor, boolean isLeftOuter,
IMissingWriterFactory[] nullWriterFactories1,
- int tableSize, int memSizeInFrames) {
- this(spec, keys0, keys1, hashFunctionFactories, comparatorFactories,
null, recordDescriptor, isLeftOuter,
- nullWriterFactories1, tableSize, memSizeInFrames);
- }
-
@Override
public void contributeActivities(IActivityGraphBuilder builder) {
ActivityId hbaId = new ActivityId(odId, 0);
@@ -203,10 +188,10 @@
state = new
HashBuildTaskState(ctx.getJobletContext().getJobId(),
new TaskId(getActivityId(), partition));
ISerializableTable table = new
SerializableHashTable(tableSize, ctx, bufferManager);
- state.joiner = new InMemoryHashJoin(ctx, tableSize, new
FrameTupleAccessor(rd0), hpc0,
- new FrameTupleAccessor(rd1), rd1, hpc1,
- new FrameTuplePairComparator(keys0, keys1,
comparators), isLeftOuter, nullWriters1, table,
- predEvaluator, bufferManager);
+ state.joiner =
+ new InMemoryHashJoin(ctx, new
FrameTupleAccessor(rd0), hpc0, new FrameTupleAccessor(rd1),
+ rd1, hpc1, new
FrameTuplePairComparator(keys0, keys1, comparators), isLeftOuter,
+ nullWriters1, table, predEvaluator,
bufferManager);
}
@Override
diff --git
a/hyracks-fullstack/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/structures/ISerializableTable.java
b/hyracks-fullstack/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/structures/ISerializableTable.java
index d0e0616..dea9c98 100644
---
a/hyracks-fullstack/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/structures/ISerializableTable.java
+++
b/hyracks-fullstack/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/structures/ISerializableTable.java
@@ -64,4 +64,6 @@
* Prints out the internal information of this table.
*/
String printInfo();
+
+ int getTableSize();
}
diff --git
a/hyracks-fullstack/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/structures/SerializableHashTable.java
b/hyracks-fullstack/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/structures/SerializableHashTable.java
index ca97be3..3910e41 100644
---
a/hyracks-fullstack/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/structures/SerializableHashTable.java
+++
b/hyracks-fullstack/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/structures/SerializableHashTable.java
@@ -566,4 +566,9 @@
this.second = second;
}
}
+
+ @Override
+ public int getTableSize() {
+ return tableSize;
+ }
}
--
To view, visit https://asterix-gerrit.ics.uci.edu/1994
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I02a677ecfef80ccd4332447a6dcb5d480be6fe80
Gerrit-PatchSet: 1
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Xikui Wang <[email protected]>