Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XorBinaryFuse8 failed to construct on some data #31

Open
konghuarukhr opened this issue Dec 16, 2021 · 5 comments
Open

XorBinaryFuse8 failed to construct on some data #31

konghuarukhr opened this issue Dec 16, 2021 · 5 comments

Comments

@konghuarukhr
Copy link

konghuarukhr commented Dec 16, 2021

public static void main(String[] args) {
        int n = 500000;
        long[] keys = new long[n];
        for (int i = 0; i < n; i++) {
            keys[i] = i;
        }
        XorBinaryFuse8.construct(keys);
    }

Execute this code will report:

java.lang.ArrayIndexOutOfBoundsException: 500001

Is there any paper/draft can help understand xor binary fuse algorithm?

@thomasmueller
Copy link
Contributor

paper/draft can help understand xor binary fuse algorithm?

Yes, here the paper that contains all the theory about the fuse approach: https://arxiv.org/abs/1907.04749 - it doesn't describe the construction algorithm we use here I'm afraid, but it explains the theory.

@thomasmueller
Copy link
Contributor

The code that fails is a copy of the code from https://github.com/FastFilter/fastfilter_cpp/blob/master/src/xorfilter/3wise_xor_binary_fuse_filter_lowmem.h#L142 - I will try to find out what's going on here.

@thomasmueller
Copy link
Contributor

Hm, I found the problem: if mapping fails, then we forget to do reverseOrder[size] = 1 (this is done correctly in the C / C++ code). But now there's another problem: the array size is too small. I'll try to fix that as well.

@thomasmueller
Copy link
Contributor

Could you verify it is fixed now please?

@konghuarukhr
Copy link
Author

I find it is not fixed, this is another construction failure:

    public static void main(String[] args) {
        int n = 11511;
        long[] keys = new long[n];
        for (int i = 0; i < n; i++) {
            keys[i] = i;
        }
        XorBinaryFuse8.construct(keys);
    }

will report:

...

11511 keys; arrayLength 14336 reverseOrderPos 6371
Exception in thread "main" java.lang.IllegalStateException
	at org.fastfilter.xor.XorBinaryFuse8.addAll(XorBinaryFuse8.java:219)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants