You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kylin.apache.org by li...@apache.org on 2017/12/31 13:19:54 UTC

[37/50] [abbrv] kylin git commit: #3505 fix timestampadd gap betweeen spark and calcite

#3505 fix timestampadd gap betweeen spark and calcite


Project: http://git-wip-us.apache.org/repos/asf/kylin/repo
Commit: http://git-wip-us.apache.org/repos/asf/kylin/commit/d86c2a08
Tree: http://git-wip-us.apache.org/repos/asf/kylin/tree/d86c2a08
Diff: http://git-wip-us.apache.org/repos/asf/kylin/diff/d86c2a08

Branch: refs/heads/master
Commit: d86c2a087514fd9fc3c192ba0f9668855d9c7aa1
Parents: 6c31ca9
Author: Hongbin Ma <ma...@apache.org>
Authored: Tue Dec 5 21:27:24 2017 +0800
Committer: Hongbin Ma <ma...@kyligence.io>
Committed: Wed Dec 27 20:05:54 2017 +0800

----------------------------------------------------------------------
 .../apache/kylin/query/ITKylinQueryTest.java    | 20 ++++++++++----
 .../org/apache/kylin/query/KylinTestBase.java   |  4 +--
 .../query/sql_h2_uncapable/query01.sql          | 22 ---------------
 .../query/sql_h2_uncapable/query02.sql          | 22 ---------------
 .../query/sql_h2_uncapable/query06.sql          | 22 ---------------
 .../query/sql_h2_uncapable/query07.sql          | 22 ---------------
 .../query/sql_h2_uncapable/query08.sql          | 22 ---------------
 .../query/sql_h2_uncapable/query09.sql          | 22 ---------------
 .../resources/query/sql_timestamp/query01.sql   | 29 ++++++++++++++++++++
 .../resources/query/sql_timestamp/query02.sql   | 28 +++++++++++++++++++
 .../resources/query/sql_timestamp/query06.sql   | 28 +++++++++++++++++++
 .../resources/query/sql_timestamp/query07.sql   | 28 +++++++++++++++++++
 .../resources/query/sql_timestamp/query08.sql   | 28 +++++++++++++++++++
 .../resources/query/sql_timestamp/query09.sql   | 28 +++++++++++++++++++
 .../resources/query/sql_timestamp/query11.sql   | 21 ++++++++++++++
 .../resources/query/sql_timestamp/query12.sql   | 21 ++++++++++++++
 .../resources/query/sql_timestamp/query13.sql   | 21 ++++++++++++++
 .../resources/query/sql_timestamp/query14.sql   | 21 ++++++++++++++
 pom.xml                                         |  4 +--
 19 files changed, 271 insertions(+), 142 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kylin/blob/d86c2a08/kylin-it/src/test/java/org/apache/kylin/query/ITKylinQueryTest.java
----------------------------------------------------------------------
diff --git a/kylin-it/src/test/java/org/apache/kylin/query/ITKylinQueryTest.java b/kylin-it/src/test/java/org/apache/kylin/query/ITKylinQueryTest.java
index c468a9f..6dfdeb5 100644
--- a/kylin-it/src/test/java/org/apache/kylin/query/ITKylinQueryTest.java
+++ b/kylin-it/src/test/java/org/apache/kylin/query/ITKylinQueryTest.java
@@ -83,7 +83,8 @@ public class ITKylinQueryTest extends KylinTestBase {
         try {
 
             Map<String, String> toggles = Maps.newHashMap();
-            toggles.put(BackdoorToggles.DEBUG_TOGGLE_COPROCESSOR_BEHAVIOR, StorageSideBehavior.SCAN_FILTER_AGGR_CHECKMEM_WITHDELAY.toString());//delay 10ms for every scan
+            toggles.put(BackdoorToggles.DEBUG_TOGGLE_COPROCESSOR_BEHAVIOR,
+                    StorageSideBehavior.SCAN_FILTER_AGGR_CHECKMEM_WITHDELAY.toString());//delay 10ms for every scan
             BackdoorToggles.setToggles(toggles);
 
             KylinConfig.getInstanceFromEnv().setProperty("kylin.storage.hbase.coprocessor-timeout-seconds", "3");
@@ -105,7 +106,8 @@ public class ITKylinQueryTest extends KylinTestBase {
     }
 
     protected void runTimeoutQueries() throws Exception {
-        List<File> sqlFiles = getFilesFromFolder(new File(getQueryFolderPrefix() + "src/test/resources/query/sql_timeout"), ".sql");
+        List<File> sqlFiles = getFilesFromFolder(
+                new File(getQueryFolderPrefix() + "src/test/resources/query/sql_timeout"), ".sql");
         for (File sqlFile : sqlFiles) {
             try {
                 runSQL(sqlFile, false, false);
@@ -205,14 +207,14 @@ public class ITKylinQueryTest extends KylinTestBase {
             Map<String, String> toggles = Maps.newHashMap();
             toggles.put(BackdoorToggles.DEBUG_TOGGLE_PREPARE_ONLY, "true");
             BackdoorToggles.setToggles(toggles);
-            
+
             verifyResultRowColCount(getQueryFolderPrefix() + "src/test/resources/query/sql_verifyCount");
-            
+
         } finally {
             BackdoorToggles.cleanToggles();
         }
     }
-    
+
     @Test
     public void testVerifyContentQuery() throws Exception {
         verifyResultContent(getQueryFolderPrefix() + "src/test/resources/query/sql_verifyContent");
@@ -243,6 +245,11 @@ public class ITKylinQueryTest extends KylinTestBase {
     }
 
     @Test
+    public void testTimeStampAdd() throws Exception {
+        execAndCompQuery(getQueryFolderPrefix() + "src/test/resources/query/sql_timestamp", null, true);
+    }
+
+    @Test
     public void testCachedQuery() throws Exception {
         execAndCompQuery(getQueryFolderPrefix() + "src/test/resources/query/sql_cache", null, true);
     }
@@ -355,7 +362,8 @@ public class ITKylinQueryTest extends KylinTestBase {
 
     @Test
     public void testLimitEnabled() throws Exception {
-        List<File> sqlFiles = getFilesFromFolder(new File(getQueryFolderPrefix() + "src/test/resources/query/sql_limit"), ".sql");
+        List<File> sqlFiles = getFilesFromFolder(
+                new File(getQueryFolderPrefix() + "src/test/resources/query/sql_limit"), ".sql");
         for (File sqlFile : sqlFiles) {
             runSQL(sqlFile, false, false);
             assertTrue(checkFinalPushDownLimit());

http://git-wip-us.apache.org/repos/asf/kylin/blob/d86c2a08/kylin-it/src/test/java/org/apache/kylin/query/KylinTestBase.java
----------------------------------------------------------------------
diff --git a/kylin-it/src/test/java/org/apache/kylin/query/KylinTestBase.java b/kylin-it/src/test/java/org/apache/kylin/query/KylinTestBase.java
index 13e4a53..c735b55 100644
--- a/kylin-it/src/test/java/org/apache/kylin/query/KylinTestBase.java
+++ b/kylin-it/src/test/java/org/apache/kylin/query/KylinTestBase.java
@@ -293,8 +293,8 @@ public class KylinTestBase {
                 BackdoorToggles.getPrepareOnly());
     }
 
-    protected Pair<List<List<String>>, List<SelectedColumnMeta>> tryPushDownNonSelectQuery(String sql, boolean isPrepare)
-            throws Exception {
+    protected Pair<List<List<String>>, List<SelectedColumnMeta>> tryPushDownNonSelectQuery(String sql,
+            boolean isPrepare) throws Exception {
         return PushDownUtil.tryPushDownNonSelectQuery(ProjectInstance.DEFAULT_PROJECT_NAME, sql, "DEFAULT", isPrepare);
     }
 

http://git-wip-us.apache.org/repos/asf/kylin/blob/d86c2a08/kylin-it/src/test/resources/query/sql_h2_uncapable/query01.sql
----------------------------------------------------------------------
diff --git a/kylin-it/src/test/resources/query/sql_h2_uncapable/query01.sql b/kylin-it/src/test/resources/query/sql_h2_uncapable/query01.sql
deleted file mode 100644
index 795c6f3..0000000
--- a/kylin-it/src/test/resources/query/sql_h2_uncapable/query01.sql
+++ /dev/null
@@ -1,22 +0,0 @@
---
--- 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 timestampadd(DAY,1,WEEK_BEG_DT) as x ,WEEK_BEG_DT
- FROM TEST_KYLIN_FACT 
- inner JOIN EDW.TEST_CAL_DT AS TEST_CAL_DT ON (TEST_KYLIN_FACT.CAL_DT = TEST_CAL_DT.CAL_DT) 
- GROUP BY TEST_CAL_DT.WEEK_BEG_DT

http://git-wip-us.apache.org/repos/asf/kylin/blob/d86c2a08/kylin-it/src/test/resources/query/sql_h2_uncapable/query02.sql
----------------------------------------------------------------------
diff --git a/kylin-it/src/test/resources/query/sql_h2_uncapable/query02.sql b/kylin-it/src/test/resources/query/sql_h2_uncapable/query02.sql
deleted file mode 100644
index f3ad957..0000000
--- a/kylin-it/src/test/resources/query/sql_h2_uncapable/query02.sql
+++ /dev/null
@@ -1,22 +0,0 @@
---
--- 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 timestampadd(DAY,1,WEEK_BEG_DT) as x,sum(price)
- FROM TEST_KYLIN_FACT 
- inner JOIN EDW.TEST_CAL_DT AS TEST_CAL_DT ON (TEST_KYLIN_FACT.CAL_DT = TEST_CAL_DT.CAL_DT) 
- GROUP BY timestampadd(DAY,1,WEEK_BEG_DT)

http://git-wip-us.apache.org/repos/asf/kylin/blob/d86c2a08/kylin-it/src/test/resources/query/sql_h2_uncapable/query06.sql
----------------------------------------------------------------------
diff --git a/kylin-it/src/test/resources/query/sql_h2_uncapable/query06.sql b/kylin-it/src/test/resources/query/sql_h2_uncapable/query06.sql
deleted file mode 100644
index 5fd117a..0000000
--- a/kylin-it/src/test/resources/query/sql_h2_uncapable/query06.sql
+++ /dev/null
@@ -1,22 +0,0 @@
---
--- 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 timestampadd(DAY,-1,WEEK_BEG_DT) as x ,WEEK_BEG_DT
- FROM TEST_KYLIN_FACT 
- inner JOIN EDW.TEST_CAL_DT AS TEST_CAL_DT ON (TEST_KYLIN_FACT.CAL_DT = TEST_CAL_DT.CAL_DT) 
- GROUP BY TEST_CAL_DT.WEEK_BEG_DT

http://git-wip-us.apache.org/repos/asf/kylin/blob/d86c2a08/kylin-it/src/test/resources/query/sql_h2_uncapable/query07.sql
----------------------------------------------------------------------
diff --git a/kylin-it/src/test/resources/query/sql_h2_uncapable/query07.sql b/kylin-it/src/test/resources/query/sql_h2_uncapable/query07.sql
deleted file mode 100644
index 1c05b8e..0000000
--- a/kylin-it/src/test/resources/query/sql_h2_uncapable/query07.sql
+++ /dev/null
@@ -1,22 +0,0 @@
---
--- 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 timestampadd(MONTH,1,WEEK_BEG_DT) as x ,WEEK_BEG_DT
- FROM TEST_KYLIN_FACT 
- inner JOIN EDW.TEST_CAL_DT AS TEST_CAL_DT ON (TEST_KYLIN_FACT.CAL_DT = TEST_CAL_DT.CAL_DT) 
- GROUP BY TEST_CAL_DT.WEEK_BEG_DT

http://git-wip-us.apache.org/repos/asf/kylin/blob/d86c2a08/kylin-it/src/test/resources/query/sql_h2_uncapable/query08.sql
----------------------------------------------------------------------
diff --git a/kylin-it/src/test/resources/query/sql_h2_uncapable/query08.sql b/kylin-it/src/test/resources/query/sql_h2_uncapable/query08.sql
deleted file mode 100644
index 261bdc9..0000000
--- a/kylin-it/src/test/resources/query/sql_h2_uncapable/query08.sql
+++ /dev/null
@@ -1,22 +0,0 @@
---
--- 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 timestampadd(YEAR,-1,WEEK_BEG_DT) as x ,WEEK_BEG_DT
- FROM TEST_KYLIN_FACT 
- inner JOIN EDW.TEST_CAL_DT AS TEST_CAL_DT ON (TEST_KYLIN_FACT.CAL_DT = TEST_CAL_DT.CAL_DT) 
- GROUP BY TEST_CAL_DT.WEEK_BEG_DT

http://git-wip-us.apache.org/repos/asf/kylin/blob/d86c2a08/kylin-it/src/test/resources/query/sql_h2_uncapable/query09.sql
----------------------------------------------------------------------
diff --git a/kylin-it/src/test/resources/query/sql_h2_uncapable/query09.sql b/kylin-it/src/test/resources/query/sql_h2_uncapable/query09.sql
deleted file mode 100644
index 111df66..0000000
--- a/kylin-it/src/test/resources/query/sql_h2_uncapable/query09.sql
+++ /dev/null
@@ -1,22 +0,0 @@
---
--- 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 timestampdiff(DAY,date'2013-01-01',WEEK_BEG_DT) as x ,WEEK_BEG_DT
- FROM TEST_KYLIN_FACT 
- inner JOIN EDW.TEST_CAL_DT AS TEST_CAL_DT ON (TEST_KYLIN_FACT.CAL_DT = TEST_CAL_DT.CAL_DT) 
- GROUP BY TEST_CAL_DT.WEEK_BEG_DT

http://git-wip-us.apache.org/repos/asf/kylin/blob/d86c2a08/kylin-it/src/test/resources/query/sql_timestamp/query01.sql
----------------------------------------------------------------------
diff --git a/kylin-it/src/test/resources/query/sql_timestamp/query01.sql b/kylin-it/src/test/resources/query/sql_timestamp/query01.sql
new file mode 100644
index 0000000..8befbe3
--- /dev/null
+++ b/kylin-it/src/test/resources/query/sql_timestamp/query01.sql
@@ -0,0 +1,29 @@
+--
+-- 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 cast(timestampadd(DAY,1,WEEK_BEG_DT) as date) as x ,WEEK_BEG_DT
+ FROM TEST_KYLIN_FACT 
+ 
+inner JOIN edw.test_cal_dt as test_cal_dt
+ ON test_kylin_fact.cal_dt = test_cal_dt.cal_dt
+ inner JOIN test_category_groupings
+ ON test_kylin_fact.leaf_categ_id = test_category_groupings.leaf_categ_id AND test_kylin_fact.lstg_site_id = test_category_groupings.site_id
+ inner JOIN edw.test_sites as test_sites
+ ON test_kylin_fact.lstg_site_id = test_sites.site_id
+ 
+ GROUP BY TEST_CAL_DT.WEEK_BEG_DT

http://git-wip-us.apache.org/repos/asf/kylin/blob/d86c2a08/kylin-it/src/test/resources/query/sql_timestamp/query02.sql
----------------------------------------------------------------------
diff --git a/kylin-it/src/test/resources/query/sql_timestamp/query02.sql b/kylin-it/src/test/resources/query/sql_timestamp/query02.sql
new file mode 100644
index 0000000..12bdb1d
--- /dev/null
+++ b/kylin-it/src/test/resources/query/sql_timestamp/query02.sql
@@ -0,0 +1,28 @@
+--
+-- 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 cast(timestampadd(DAY,1,WEEK_BEG_DT) as date) as x,sum(price) as y 
+ FROM TEST_KYLIN_FACT 
+ 
+inner JOIN edw.test_cal_dt as test_cal_dt
+ ON test_kylin_fact.cal_dt = test_cal_dt.cal_dt
+ inner JOIN test_category_groupings
+ ON test_kylin_fact.leaf_categ_id = test_category_groupings.leaf_categ_id AND test_kylin_fact.lstg_site_id = test_category_groupings.site_id
+ inner JOIN edw.test_sites as test_sites
+ ON test_kylin_fact.lstg_site_id = test_sites.site_id
+ GROUP BY cast (timestampadd(DAY,1,WEEK_BEG_DT) as date)

http://git-wip-us.apache.org/repos/asf/kylin/blob/d86c2a08/kylin-it/src/test/resources/query/sql_timestamp/query06.sql
----------------------------------------------------------------------
diff --git a/kylin-it/src/test/resources/query/sql_timestamp/query06.sql b/kylin-it/src/test/resources/query/sql_timestamp/query06.sql
new file mode 100644
index 0000000..9ca1155
--- /dev/null
+++ b/kylin-it/src/test/resources/query/sql_timestamp/query06.sql
@@ -0,0 +1,28 @@
+--
+-- 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 cast(timestampadd(DAY,-1,WEEK_BEG_DT) as date) as x ,WEEK_BEG_DT
+ FROM TEST_KYLIN_FACT 
+ 
+inner JOIN edw.test_cal_dt as test_cal_dt
+ ON test_kylin_fact.cal_dt = test_cal_dt.cal_dt
+ inner JOIN test_category_groupings
+ ON test_kylin_fact.leaf_categ_id = test_category_groupings.leaf_categ_id AND test_kylin_fact.lstg_site_id = test_category_groupings.site_id
+ inner JOIN edw.test_sites as test_sites
+ ON test_kylin_fact.lstg_site_id = test_sites.site_id
+ GROUP BY TEST_CAL_DT.WEEK_BEG_DT

http://git-wip-us.apache.org/repos/asf/kylin/blob/d86c2a08/kylin-it/src/test/resources/query/sql_timestamp/query07.sql
----------------------------------------------------------------------
diff --git a/kylin-it/src/test/resources/query/sql_timestamp/query07.sql b/kylin-it/src/test/resources/query/sql_timestamp/query07.sql
new file mode 100644
index 0000000..8efe220
--- /dev/null
+++ b/kylin-it/src/test/resources/query/sql_timestamp/query07.sql
@@ -0,0 +1,28 @@
+--
+-- 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 cast(timestampadd(MONTH,1,WEEK_BEG_DT) as date) as x ,WEEK_BEG_DT
+ FROM TEST_KYLIN_FACT 
+ 
+inner JOIN edw.test_cal_dt as test_cal_dt
+ ON test_kylin_fact.cal_dt = test_cal_dt.cal_dt
+ inner JOIN test_category_groupings
+ ON test_kylin_fact.leaf_categ_id = test_category_groupings.leaf_categ_id AND test_kylin_fact.lstg_site_id = test_category_groupings.site_id
+ inner JOIN edw.test_sites as test_sites
+ ON test_kylin_fact.lstg_site_id = test_sites.site_id
+ GROUP BY TEST_CAL_DT.WEEK_BEG_DT

http://git-wip-us.apache.org/repos/asf/kylin/blob/d86c2a08/kylin-it/src/test/resources/query/sql_timestamp/query08.sql
----------------------------------------------------------------------
diff --git a/kylin-it/src/test/resources/query/sql_timestamp/query08.sql b/kylin-it/src/test/resources/query/sql_timestamp/query08.sql
new file mode 100644
index 0000000..9e6a5e2
--- /dev/null
+++ b/kylin-it/src/test/resources/query/sql_timestamp/query08.sql
@@ -0,0 +1,28 @@
+--
+-- 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 cast (timestampadd(YEAR,-1,WEEK_BEG_DT) as date) as x ,WEEK_BEG_DT
+ FROM TEST_KYLIN_FACT 
+ 
+inner JOIN edw.test_cal_dt as test_cal_dt
+ ON test_kylin_fact.cal_dt = test_cal_dt.cal_dt
+ inner JOIN test_category_groupings
+ ON test_kylin_fact.leaf_categ_id = test_category_groupings.leaf_categ_id AND test_kylin_fact.lstg_site_id = test_category_groupings.site_id
+ inner JOIN edw.test_sites as test_sites
+ ON test_kylin_fact.lstg_site_id = test_sites.site_id
+ GROUP BY TEST_CAL_DT.WEEK_BEG_DT

http://git-wip-us.apache.org/repos/asf/kylin/blob/d86c2a08/kylin-it/src/test/resources/query/sql_timestamp/query09.sql
----------------------------------------------------------------------
diff --git a/kylin-it/src/test/resources/query/sql_timestamp/query09.sql b/kylin-it/src/test/resources/query/sql_timestamp/query09.sql
new file mode 100644
index 0000000..9b0512d
--- /dev/null
+++ b/kylin-it/src/test/resources/query/sql_timestamp/query09.sql
@@ -0,0 +1,28 @@
+--
+-- 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 cast(timestampdiff(DAY,date'2013-01-01',WEEK_BEG_DT) as integer) as x ,WEEK_BEG_DT
+ FROM TEST_KYLIN_FACT 
+ 
+inner JOIN edw.test_cal_dt as test_cal_dt
+ ON test_kylin_fact.cal_dt = test_cal_dt.cal_dt
+ inner JOIN test_category_groupings
+ ON test_kylin_fact.leaf_categ_id = test_category_groupings.leaf_categ_id AND test_kylin_fact.lstg_site_id = test_category_groupings.site_id
+ inner JOIN edw.test_sites as test_sites
+ ON test_kylin_fact.lstg_site_id = test_sites.site_id
+ GROUP BY TEST_CAL_DT.WEEK_BEG_DT

http://git-wip-us.apache.org/repos/asf/kylin/blob/d86c2a08/kylin-it/src/test/resources/query/sql_timestamp/query11.sql
----------------------------------------------------------------------
diff --git a/kylin-it/src/test/resources/query/sql_timestamp/query11.sql b/kylin-it/src/test/resources/query/sql_timestamp/query11.sql
new file mode 100644
index 0000000..edb3d54
--- /dev/null
+++ b/kylin-it/src/test/resources/query/sql_timestamp/query11.sql
@@ -0,0 +1,21 @@
+--
+-- 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 sum(price)  as sum_price
+ FROM TEST_KYLIN_FACT 
+ WHERE CAL_DT > cast(TIMESTAMPADD(Day, -15000, CURRENT_DATE) as DATE)
+GROUP BY CAL_DT

http://git-wip-us.apache.org/repos/asf/kylin/blob/d86c2a08/kylin-it/src/test/resources/query/sql_timestamp/query12.sql
----------------------------------------------------------------------
diff --git a/kylin-it/src/test/resources/query/sql_timestamp/query12.sql b/kylin-it/src/test/resources/query/sql_timestamp/query12.sql
new file mode 100644
index 0000000..73b432f
--- /dev/null
+++ b/kylin-it/src/test/resources/query/sql_timestamp/query12.sql
@@ -0,0 +1,21 @@
+--
+-- 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 sum(price)  as sum_price
+ FROM TEST_KYLIN_FACT 
+ WHERE CAL_DT > cast(TIMESTAMPADD(Day, -2000, CURRENT_DATE) as DATE)
+GROUP BY CAL_DT

http://git-wip-us.apache.org/repos/asf/kylin/blob/d86c2a08/kylin-it/src/test/resources/query/sql_timestamp/query13.sql
----------------------------------------------------------------------
diff --git a/kylin-it/src/test/resources/query/sql_timestamp/query13.sql b/kylin-it/src/test/resources/query/sql_timestamp/query13.sql
new file mode 100644
index 0000000..fed0b73
--- /dev/null
+++ b/kylin-it/src/test/resources/query/sql_timestamp/query13.sql
@@ -0,0 +1,21 @@
+--
+-- 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 sum(price)  as sum_price
+ FROM TEST_KYLIN_FACT 
+ WHERE CAL_DT > cast(TIMESTAMPADD(Day, -0, CURRENT_TIMESTAMP) as DATE)
+GROUP BY CAL_DT

http://git-wip-us.apache.org/repos/asf/kylin/blob/d86c2a08/kylin-it/src/test/resources/query/sql_timestamp/query14.sql
----------------------------------------------------------------------
diff --git a/kylin-it/src/test/resources/query/sql_timestamp/query14.sql b/kylin-it/src/test/resources/query/sql_timestamp/query14.sql
new file mode 100644
index 0000000..40378b9
--- /dev/null
+++ b/kylin-it/src/test/resources/query/sql_timestamp/query14.sql
@@ -0,0 +1,21 @@
+--
+-- 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 sum(price)  as sum_price
+ FROM TEST_KYLIN_FACT 
+ WHERE CAL_DT > cast(TIMESTAMPADD(Day, -15000, CURRENT_TIMESTAMP ) as DATE)
+GROUP BY CAL_DT

http://git-wip-us.apache.org/repos/asf/kylin/blob/d86c2a08/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 7e663ee..f7835b6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -90,8 +90,8 @@
         <antlr.version>3.4</antlr.version>
         <junit.version>4.12</junit.version>
         <mrunit.version>1.1.0</mrunit.version>
-        <dbunit.version>2.5.2</dbunit.version>
-        <h2.version>1.4.192</h2.version>
+        <dbunit.version>2.5.4</dbunit.version>
+        <h2.version>1.4.196</h2.version>
         <jetty.version>9.2.20.v20161216</jetty.version>
         <jamm.version>0.3.1</jamm.version>
         <mockito.version>2.7.14</mockito.version>