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

GraphQL CQL-first: bulk insert does not handle conditional batch #1068

Closed
olim7t opened this issue Jun 26, 2021 · 1 comment · Fixed by #1078
Closed

GraphQL CQL-first: bulk insert does not handle conditional batch #1068

olim7t opened this issue Jun 26, 2021 · 1 comment · Fixed by #1078
Labels
GraphQL CQL-first issues related to the GraphQL API

Comments

@olim7t
Copy link
Collaborator

olim7t commented Jun 26, 2021

Disclaimer: the query is convoluted, I'm not sure if there's any realistic use case.

CQL:

create table foo(k int primary key, v int);
insert into foo(k,v) values(1,1);

GraphQL:

mutation @atomic {
  bulkInsertfoo(values: [{ k: 1, v: 2 }, { k: 1, v: 3 }], ifNotExists: true) {
    applied
    value {
      k
    }
  }
  insertfoo(value: { k: 1, v: 4 }, ifNotExists: true) {
    applied
    value {
      v
    }
  }
}

This causes:

java.lang.IndexOutOfBoundsException: Index: 1, Size: 1
        at io.stargate.graphql.schema.cqlfirst.dml.fetchers.DmlFetcher.toListOfMutationResults(DmlFetcher.java:122)

The methods assumes that if there are rows then it's one per input value, but if the batch is conditional, only one row is returned.

@olim7t olim7t added the GraphQL CQL-first issues related to the GraphQL API label Jun 26, 2021
@olim7t
Copy link
Collaborator Author

olim7t commented Jun 26, 2021

Possibly a more likely use case once we fix #1069.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GraphQL CQL-first issues related to the GraphQL API
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant