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

Binary index is broken. #1534

Open
JokerXiL opened this issue Apr 1, 2024 · 0 comments
Open

Binary index is broken. #1534

JokerXiL opened this issue Apr 1, 2024 · 0 comments

Comments

@JokerXiL
Copy link

JokerXiL commented Apr 1, 2024

ArcadeDB Version:

ArcadeDB Server v24.2.1 (build ce2658d/1710272693676/main)

OS and JDK Version:

Same results on three JDK Versions

Mac OS X 14.0 - OpenJDK 64-Bit Server VM 21.0.2 (Homebrew)
Mac OS X 14.0 - OpenJDK 64-Bit Server VM 17.0.9 (GraalVM CE 17.0.9+9.1)
Mac OS X 14.0 - OpenJDK 64-Bit Server VM 11.0.22 (Corretto-11.0.22.7.1)

Problems

Adding a Binary index breaks other code.

I suspect that it is because the cast to Binary in BinaryComparator is not working properly.

Steps to reproduce

Simple demo code

import com.arcadedb.ContextConfiguration;
import com.arcadedb.schema.Schema;
import com.arcadedb.schema.Type;
import com.arcadedb.server.ArcadeDBServer;

public class Main {
    public static void main(String[] args) {
        var s = new ArcadeDBServer(new ContextConfiguration());

        s.start();

        var db = s.getOrCreateDatabase("db");

        if(db.getSchema().existsType("vt"))
            db.getSchema().dropType("vt");

        db.getSchema()
                .getOrCreateVertexType("vt")
                .getOrCreateProperty("prop", Type.BINARY)
                .setMandatory(true)
                .setNotNull(true)
                .getOrCreateIndex(Schema.INDEX_TYPE.LSM_TREE, false);

        // SUCCESS
        db.newVertex("vt").set("prop", new byte[]{1,2,3}).save();

        // FAIL
        try{
            db.lookupByKey("vt", "prop", new byte[]{1,2,3});
        }
        catch (Exception e) {
            e.printStackTrace();
        }

        // SUCCESS
        db.newVertex("vt").set("prop", new byte[]{1,2,3}).save();
        // SUCCESS
        db.newVertex("vt").set("prop", new byte[]{1,2,3}).save();

        // reopening database
        s.stop();
        s.start();
        db = s.getOrCreateDatabase("db");

        // FAIL
        try{
            db.newVertex("vt").set("prop", new byte[]{1, 2, 3}).save();
        }catch (Exception e) {
            e.printStackTrace();
        }
    }
}
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

1 participant