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

Weird paging when using IN clause #265

Open
DanielLavinV opened this issue Mar 12, 2024 · 0 comments
Open

Weird paging when using IN clause #265

DanielLavinV opened this issue Mar 12, 2024 · 0 comments

Comments

@DanielLavinV
Copy link

Cassandra version: 3.11.0
gocqlx version: v2.8.0

I have a table with composite partitioning using (ColumnA <string>, ColumnB <string>).

I have 4 rows, which match to a single value of ColumnA and ColumnB, let's say "day3" and "device" respectively.

I create the following query:

qb.In("ColumnA"),
qb.Eq("ColumnB")

and I bind the parameters as such: .Bind(days, device) where days is a list of strings and device is a single string.

I paginate by calling .PageState(pageState).PageSize(pageSize), where pageState is a base64 decoded string and pageSize is an int.

Let's suppose the values bound for days are ["day1", "day2", "day3", "day4"] and the value for device is simply "device".
pageState is nil and pageSize is 100.

My expectation is that a single page is returned with the 4 rows. The returned pageState is nil since there are no more pages.

What actually happens is that 4 different pages are created. Pages 1, 2 and 4 are empty, while page 3 contains the 4 rows. If I change the number of elements in the array bound to the In clause, the number of pages changes proportionally, one per element in the array. The only populated page (following this example) is that corresponding to the element in the array for which values are matched.

Is this the expected behavior?

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