Index: storage/src/main/java/org/apache/kylin/storage/hbase/SerializedHBaseTupleIterator.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- storage/src/main/java/org/apache/kylin/storage/hbase/SerializedHBaseTupleIterator.java (revision 5057f867eae6ed4daaa2590b21460df662fadd39) +++ storage/src/main/java/org/apache/kylin/storage/hbase/SerializedHBaseTupleIterator.java (revision ) @@ -89,7 +89,7 @@ @Override public boolean hasNext() { // 1. check limit - if (context.isLimitEnabled() && scanCount >= context.getLimit()) { + if (context.isLimitEnabled() && scanCount >= context.getLimit() + context.getOffset()) { return false; } // 2. check partial result Index: query/src/test/resources/query/sql_verifyCount/query06.sql =================================================================== --- query/src/test/resources/query/sql_verifyCount/query06.sql (revision 5057f867eae6ed4daaa2590b21460df662fadd39) +++ query/src/test/resources/query/sql_verifyCount/query06.sql.disable (revision ) @@ -1,0 +1,0 @@ Index: storage/src/main/java/org/apache/kylin/storage/StorageContext.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- storage/src/main/java/org/apache/kylin/storage/StorageContext.java (revision 5057f867eae6ed4daaa2590b21460df662fadd39) +++ storage/src/main/java/org/apache/kylin/storage/StorageContext.java (revision ) @@ -44,6 +44,7 @@ private String connUrl; private int threshold; private int limit; + private int offset; private boolean hasSort; private List sortMeasures; private List sortOrders; @@ -110,6 +111,14 @@ public void setLimit(int l) { this.limit = l; + } + + public int getOffset() { + return offset; + } + + public void setOffset(int offset) { + this.offset = offset; } public void enableLimit() { Index: query/src/test/java/org/apache/kylin/query/test/KylinQueryTest.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- query/src/test/java/org/apache/kylin/query/test/KylinQueryTest.java (revision 5057f867eae6ed4daaa2590b21460df662fadd39) +++ query/src/test/java/org/apache/kylin/query/test/KylinQueryTest.java (revision ) @@ -170,9 +170,8 @@ execAndCompQuery("src/test/resources/query/sql", null, true); } - @Ignore @Test - public void testSimpleQuery() throws Exception { + public void testVerifyQuery() throws Exception { verifyResultRowCount("src/test/resources/query/sql_verifyCount"); } Index: query/src/test/resources/query/sql_verifyCount/query08.sql.expected IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- query/src/test/resources/query/sql_verifyCount/query08.sql.expected (revision ) +++ query/src/test/resources/query/sql_verifyCount/query08.sql.expected (revision ) @@ -0,0 +1,1 @@ +1 Index: query/src/test/resources/query/sql_verifyCount/query05.sql =================================================================== --- query/src/test/resources/query/sql_verifyCount/query05.sql (revision 5057f867eae6ed4daaa2590b21460df662fadd39) +++ query/src/test/resources/query/sql_verifyCount/query05.sql.disable (revision ) @@ -1,0 +1,0 @@ Index: query/src/test/resources/query/sql_verifyCount/query08.sql IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- query/src/test/resources/query/sql_verifyCount/query08.sql (revision ) +++ query/src/test/resources/query/sql_verifyCount/query08.sql (revision ) @@ -0,0 +1,19 @@ +-- +-- Licensed to the Apache Software Foundation (ASF) under one +-- or more contributor license agreements. See the NOTICE file +-- distributed with this work for additional information +-- regarding copyright ownership. The ASF licenses this file +-- to you under the Apache License, Version 2.0 (the +-- "License"); you may not use this file except in compliance +-- with the License. You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- + +select lstg_format_name,sum(price) as sp from test_kylin_fact group by lstg_format_name limit 1 offset 2 Index: query/src/test/resources/query/sql_verifyCount/query04.sql =================================================================== --- query/src/test/resources/query/sql_verifyCount/query04.sql (revision 5057f867eae6ed4daaa2590b21460df662fadd39) +++ query/src/test/resources/query/sql_verifyCount/query04.sql.disable (revision ) @@ -1,0 +1,0 @@ Index: query/src/test/resources/query/sql_verifyCount/query07.sql =================================================================== --- query/src/test/resources/query/sql_verifyCount/query07.sql (revision 5057f867eae6ed4daaa2590b21460df662fadd39) +++ query/src/test/resources/query/sql_verifyCount/query07.sql.disable (revision ) @@ -1,0 +1,0 @@ Index: query/src/main/java/org/apache/kylin/query/relnode/OLAPLimitRel.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- query/src/main/java/org/apache/kylin/query/relnode/OLAPLimitRel.java (revision 5057f867eae6ed4daaa2590b21460df662fadd39) +++ query/src/main/java/org/apache/kylin/query/relnode/OLAPLimitRel.java (revision ) @@ -78,6 +78,11 @@ Number limitValue = (Number) (((RexLiteral) localFetch).getValue()); int limit = limitValue.intValue(); this.context.storageContext.setLimit(limit); + if(localOffset != null) { + Number offsetValue = (Number) (((RexLiteral) localOffset).getValue()); + int offset = offsetValue.intValue(); + this.context.storageContext.setOffset(offset); + } } private ColumnRowType buildColumnRowType() {