vigna / Sux4J

Sux4J is an effort to bring succinct data structures to Java.
GNU Lesser General Public License v2.1
154 stars 22 forks source link

You provided no keys, but the bucketed hash store was not checked #9

Closed binarybit10 closed 4 years ago

binarybit10 commented 4 years ago

I'm providing a bucketed hash store as shown below. The bucketed hash store size is 4480113. It works for a different set of keys.

Also, the program hangs after the exception, it's not being terminated correctly due to running threads?

 store = new BucketedHashStore<>(TransformationStrategies.rawByteArray(), outputPath.getParent().toFile());
 // adding 4480113 keys to store in a loop
 store.add(hash);

     mph = new GOVMinimalPerfectHashFunction.Builder<byte[]>()
                    .store(store)
                    .build();
Caused by: java.lang.IllegalStateException: You provided no keys, but the bucketed hash store was not checked
    at it.unimi.dsi.sux4j.mph.GOVMinimalPerfectHashFunction.<init>(GOVMinimalPerfectHashFunction.java:466)
    at it.unimi.dsi.sux4j.mph.GOVMinimalPerfectHashFunction$Builder.build(GOVMinimalPerfectHashFunction.java:271)
binarybit10 commented 4 years ago

I replaced java HashSet that has the keys with ObjectOpenCustomHashSet<byte[]> with hash strategy and it worked.