This is an automated email from the ASF dual-hosted git repository.
zhangliang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new 0bc1105 fix GeneralDQLIT integration test exception. (#11942)
0bc1105 is described below
commit 0bc11050f33ba7ca9a524b3bcb8c63c6b79cae91
Author: totalo <[email protected]>
AuthorDate: Sun Aug 22 20:12:01 2021 +0800
fix GeneralDQLIT integration test exception. (#11942)
---
.../infra/binder/segment/select/pagination/PaginationContext.java | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git
a/shardingsphere-infra/shardingsphere-infra-binder/src/main/java/org/apache/shardingsphere/infra/binder/segment/select/pagination/PaginationContext.java
b/shardingsphere-infra/shardingsphere-infra-binder/src/main/java/org/apache/shardingsphere/infra/binder/segment/select/pagination/PaginationContext.java
index 28e351b..711e1a6 100644
---
a/shardingsphere-infra/shardingsphere-infra-binder/src/main/java/org/apache/shardingsphere/infra/binder/segment/select/pagination/PaginationContext.java
+++
b/shardingsphere-infra/shardingsphere-infra-binder/src/main/java/org/apache/shardingsphere/infra/binder/segment/select/pagination/PaginationContext.java
@@ -18,6 +18,7 @@
package org.apache.shardingsphere.infra.binder.segment.select.pagination;
import lombok.Getter;
+import org.apache.commons.collections4.CollectionUtils;
import
org.apache.shardingsphere.infra.binder.statement.dml.SelectStatementContext;
import
org.apache.shardingsphere.sql.parser.sql.common.segment.dml.pagination.NumberLiteralPaginationValueSegment;
import
org.apache.shardingsphere.sql.parser.sql.common.segment.dml.pagination.PaginationValueSegment;
@@ -47,13 +48,13 @@ public final class PaginationContext {
hasPagination = null != offsetSegment || null != rowCountSegment;
this.offsetSegment = offsetSegment;
this.rowCountSegment = rowCountSegment;
- actualOffset = null == offsetSegment ? 0 : getValue(offsetSegment,
parameters);
+ actualOffset = null == offsetSegment ? 0L : getValue(offsetSegment,
parameters);
actualRowCount = null == rowCountSegment ? null :
getValue(rowCountSegment, parameters);
}
private long getValue(final PaginationValueSegment paginationValueSegment,
final List<Object> parameters) {
if (paginationValueSegment instanceof
ParameterMarkerPaginationValueSegment) {
- Object obj =
parameters.get(((ParameterMarkerPaginationValueSegment)
paginationValueSegment).getParameterIndex());
+ Object obj = CollectionUtils.isEmpty(parameters) ? 0L :
parameters.get(((ParameterMarkerPaginationValueSegment)
paginationValueSegment).getParameterIndex());
return obj instanceof Long ? (long) obj : (int) obj;
} else {
return ((NumberLiteralPaginationValueSegment)
paginationValueSegment).getValue();