The following code fails with server error "Invalid amount of bind variables":
The QueryBuilder produces a batch with no values at all. Given how QueryBuilder works, I'm not sure we can support that, but we should detect the error before sending it to Cassandra, and return a better error message.
The workaround is to not use QueryBuilder:
Actually, I think we can handle it and in fact the code was suppose to, except that it was broken. The idea is simply that if we do have Statement that are not BuiltStatement in the batch, we don't do the "pass query builder values as binary value" business but instead always serialize query builder stuff as string. That way, we can just use the values of the SimpleStatement for the batch values. It's not all that important since we should be slowly pushing people to use BatchStatement rather than the querybuilder batches since it's overall better, but since we can handle it reasonably simply I've just fixed the code so it works as it should have. I've included a simple unit test too.