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

AutoIncrement not working as expected #159

Open
lucaro opened this issue Apr 23, 2024 · 0 comments
Open

AutoIncrement not working as expected #159

lucaro opened this issue Apr 23, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@lucaro
Copy link
Member

lucaro commented Apr 23, 2024

When trying to insert into an entity with an auto-increment column that has a unique index, the insert fails due to duplicate keys.
Here is a minimal example to reproduce the issue on the most recent release 0.16.5:

@JvmStatic
    fun main(args: Array<String>) {


        val channel = ManagedChannelBuilder.forAddress("localhost", 1865).usePlaintext().build()

        val client = SimpleClient(channel)


        client.create(CreateSchema("test").ifNotExists())

        client.create(
            CreateEntity("test.test_entity")
                .column(Name.ColumnName.create("id"), Types.Long, autoIncrement = true)
                .column(Name.ColumnName.create("value"), Types.String)
                .ifNotExists()
        )


        client.create(
            CreateIndex(
                Name.EntityName.create("test", "test_entity"),
                CottontailGrpc.IndexType.BTREE_UQ
            ).column("id")
        )

        val batchInsert = BatchInsert("test.test_entity").columns("value")

        batchInsert.any("first entry")
        batchInsert.any("second entry")
        batchInsert.any("third entry")

        client.insert(batchInsert)

        client.close()


    }
Exception in thread "main" io.grpc.StatusRuntimeException: INVALID_ARGUMENT: [112, 6cd2516c-f613-4fac-96fe-d772fcb843e5] Execution of Insert query failed: Mapping of LongValue(value=1) to tuple 1 could be added to UniqueHashIndex, because value must be unique.
	at io.grpc.stub.ClientCalls.toStatusRuntimeException(ClientCalls.java:268)
	at io.grpc.stub.ClientCalls.getUnchecked(ClientCalls.java:249)
	at io.grpc.stub.ClientCalls.blockingUnaryCall(ClientCalls.java:167)
	at org.vitrivr.cottontail.grpc.DMLGrpc$DMLBlockingStub.insertBatch(DMLGrpc.java:355)
	at org.vitrivr.cottontail.client.SimpleClient.insert$lambda$14$lambda$13(SimpleClient.kt:180)
	at io.grpc.Context.call(Context.java:551)
	at org.vitrivr.cottontail.client.SimpleClient.insert$lambda$14(SimpleClient.kt:178)
	at io.grpc.Context.call(Context.java:551)
	at org.vitrivr.cottontail.client.SimpleClient.insert(SimpleClient.kt:176)
	at org.vitrivr.cottontail.client.SimpleClient.insert(SimpleClient.kt:190)


@lucaro lucaro added the bug Something isn't working label Apr 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants