vigna / Sux4J

Sux4J is an effort to bring succinct data structures to Java.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ArrayIndexOutOfBoundsException when using large set of keys with CHDMinimalPerfectHashFunction

binarybit10 opened this issue · comments

Hi,

I'm using CHDMinimalPerfectHashFunction<byte[]> for about 1_00_000 keys. I see ArrayIndexOutOfBoundsException , while the same works if I use 5_00_00 keys.

version: sux4j:5.1.0
jdk 8

Stacktrace
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: Index 0 out of bounds for length 0
at it.unimi.dsi.bits.LongArrayBitVector.getLong(LongArrayBitVector.java:488)
at it.unimi.dsi.sux4j.util.EliasFanoLongBigList.getLong(EliasFanoLongBigList.java:242)
at it.unimi.dsi.sux4j.mph.CHDMinimalPerfectHashFunction.getLong(CHDMinimalPerfectHashFunction.java:589)

I tried running GOVMinimalPerfectHashFunction, it takes several minutes to complete for the 5_00_00 keys, so I switched to CHDMinimalPerfectHashFunction which completed in under 5 seconds, but this fails for large keys.

Please provide a replicable unit test.

Apologies, I think the issue was due to something else. I tested with 10 million keys and works brilliantly!