Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -457,15 +457,6 @@ public String asCql() {
}
}

if (limit != null) {
builder.append(" LIMIT ");
if (limit instanceof BindMarker) {
((BindMarker) limit).appendTo(builder);
} else {
builder.append(limit);
}
}

if (perPartitionLimit != null) {
builder.append(" PER PARTITION LIMIT ");
if (perPartitionLimit instanceof BindMarker) {
Expand All @@ -475,6 +466,15 @@ public String asCql() {
}
}

if (limit != null) {
builder.append(" LIMIT ");
if (limit instanceof BindMarker) {
((BindMarker) limit).appendTo(builder);
} else {
builder.append(limit);
}
}

if (allowsFiltering) {
builder.append(" ALLOW FILTERING");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,10 @@ public void should_use_last_per_partition_limit_if_called_multiple_times() {
assertThat(selectFrom("foo").all().perPartitionLimit(1).perPartitionLimit(2))
.hasCql("SELECT * FROM foo PER PARTITION LIMIT 2");
}

@Test
public void should_put_limit_after_partition_limit() {
assertThat(selectFrom("foo").all().perPartitionLimit(1).limit(1))
.hasCql("SELECT * FROM foo PER PARTITION LIMIT 1 LIMIT 1");
}
}