Skip to content

Commit

Permalink
Merge branch 'main' into 4485-isRefreshing
Browse files Browse the repository at this point in the history
  • Loading branch information
niloc132 committed Jan 2, 2024
2 parents cf04ac0 + f4f1d2b commit a773b1c
Show file tree
Hide file tree
Showing 25 changed files with 3,913 additions and 2,653 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
*/
package io.deephaven.engine.table.impl.by;

import io.deephaven.base.MathUtil;
import io.deephaven.base.verify.Assert;
import io.deephaven.chunk.WritableIntChunk;
import io.deephaven.chunk.attributes.ChunkLengths;
import io.deephaven.chunk.attributes.ChunkPositions;
import io.deephaven.engine.rowset.chunkattributes.RowKeys;
import io.deephaven.engine.table.impl.util.ChunkUtils;
import io.deephaven.hash.PrimeFinder;
import io.deephaven.util.SafeCloseable;

/**
Expand All @@ -21,7 +21,6 @@ public class HashedRunFinder {

public static class HashedRunContext implements SafeCloseable {
final int tableSize;
final int tableMask;

// the hash table is [outputPosition, position, overflow]
// the overflow is only [position, overflow]
Expand All @@ -31,14 +30,12 @@ public static class HashedRunContext implements SafeCloseable {
public HashedRunContext(int size) {
if (size == 0) {
tableSize = 0;
tableMask = 0;
table = null;
overflow = null;
return;
}
// load factor of half, rounded up
tableSize = 1 << MathUtil.ceilLog2(size * 2);
tableMask = tableSize - 1;
// load factor of 75%, rounded up to nearest prime for double hashing
tableSize = PrimeFinder.nextPrime((int) (size / 0.75));
table = WritableIntChunk.makeWritableChunk(tableSize * 3);
overflow = WritableIntChunk.makeWritableChunk((size - 1) * 2);
table.fillWithValue(0, table.size(), UNUSED_HASH_TABLE_VALUE);
Expand Down Expand Up @@ -72,8 +69,8 @@ public static boolean findRunsHashed(

for (int chunkPosition = 0; chunkPosition < size; ++chunkPosition) {
final int outputPosition = outputPositions.get(chunkPosition);
int hashSlot = outputPosition & context.tableMask;

int hashSlot = outputPosition % context.tableSize;
int probe = 0;
do {
final int baseSlot = hashSlot * 3;
if (context.table.get(baseSlot) == UNUSED_HASH_TABLE_VALUE) {
Expand All @@ -92,8 +89,14 @@ public static boolean findRunsHashed(
overflowPointer += 2;
break;
} else {
// linear probe
hashSlot = (hashSlot + 1) & context.tableMask;
if (probe == 0) {
// double hashing
probe = 1 + (outputPosition % (context.tableSize - 2));
}
hashSlot -= probe;
if (hashSlot < 0) {
hashSlot += context.tableSize;
}
}
} while (true);
}
Expand Down
23 changes: 10 additions & 13 deletions go/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,17 @@ def compare = tasks.register('compareProtobuf', DiffTask) {
exclude 'internal/proto/**'
}
}
// Note that we've disabled updating the Go protobuf wiring until we have a maintainer to use the generated code correctly.
// fail a "check" build if these are out of date
tasks.getByName('quick').dependsOn(compare)

// Normally, we would fail a "check" build if these are out of date, but for now we will rely on integration tests.
//tasks.getByName('quick').dependsOn(compare)

// Also disable the update task so no one accidentally runs it from the root project
//tasks.register('updateProtobuf', Sync) {
// finalizedBy compare
// from configurations.go
// into layout.projectDirectory
// preserve {
// exclude 'internal/proto/**'
// }
//}
tasks.register('updateProtobuf', Sync) {
finalizedBy compare
from configurations.go
into layout.projectDirectory
preserve {
exclude 'internal/proto/**'
}
}


// start a grpc-api server
Expand Down
4 changes: 3 additions & 1 deletion go/internal/proto/application/application.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 11 additions & 9 deletions go/internal/proto/application/application_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions go/internal/proto/config/config.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion go/internal/proto/config/config_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 2 additions & 5 deletions go/internal/proto/console/console.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion go/internal/proto/console/console_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions go/internal/proto/hierarchicaltable/hierarchicaltable.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion go/internal/proto/inputtable/inputtable.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion go/internal/proto/inputtable/inputtable_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit a773b1c

Please sign in to comment.