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 @@ -327,7 +327,7 @@ public Builder setPlainSelect(final PlainSelect plainSelect)
from = generateFromHolder(new FromHolder(this.defaultFieldType,
this.fieldNameToFieldTypeMapping), plainSelect.getFromItem(), plainSelect.getJoins());
limit = SqlUtils.getLimitAsLong(plainSelect.getLimit());
offset = SqlUtils.getOffsetAsLong(plainSelect.getOffset());
offset = SqlUtils.getOffsetAsLong(plainSelect.getLimit(), plainSelect.getOffset());
orderByElements = plainSelect.getOrderByElements();
selectItems = plainSelect.getSelectItems();
joins = plainSelect.getJoins();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,12 +241,17 @@ public static long getLimitAsLong(final Limit limit) throws ParseException {

/**
* get offset as long.
* @param limit the limit
* @param offset the offset
* @return the offset
*/
public static long getOffsetAsLong(final Offset offset) {
public static long getOffsetAsLong(final Limit limit, final Offset offset) throws ParseException {
if (offset != null && LongValue.class.isInstance(offset.getOffset())) {
return ((LongValue) offset.getOffset()).getValue();
} else {
if (limit != null) {
return getLongFromStringIfInteger(SqlUtils.getStringValue(limit.getOffset()));
}
}
return -1;
}
Expand Down