You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kylin.apache.org by lu...@apache.org on 2015/01/07 15:46:28 UTC

[07/51] [partial] incubator-kylin git commit: migrate repo from github.com to apache git

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/4b631f92/query/src/test/java/com/kylinolap/query/test/CombinationTest.java
----------------------------------------------------------------------
diff --git a/query/src/test/java/com/kylinolap/query/test/CombinationTest.java b/query/src/test/java/com/kylinolap/query/test/CombinationTest.java
new file mode 100644
index 0000000..988ff51
--- /dev/null
+++ b/query/src/test/java/com/kylinolap/query/test/CombinationTest.java
@@ -0,0 +1,55 @@
+package com.kylinolap.query.test;
+
+import java.sql.SQLException;
+import java.util.Arrays;
+import java.util.Collection;
+
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import com.kylinolap.storage.hbase.observer.CoprocessorEnabler;
+
+/**
+ * Created by honma on 7/2/14.
+ */
+@RunWith(Parameterized.class)
+public class CombinationTest extends KylinQueryTest {
+
+    @BeforeClass
+    public static void setUp() throws SQLException {
+    }
+
+    @AfterClass
+    public static void tearDown() {
+        clean();
+    }
+
+    /**
+     * return all config combinations, where first setting specifies join type
+     * (inner or left), and the second setting specifies whether to force using
+     * coprocessors(on, off or unset).
+     */
+    @Parameterized.Parameters
+    public static Collection<Object[]> configs() {
+        return Arrays.asList(new Object[][] { { "inner", "unset" }, { "left", "unset" }, { "inner", "off" }, { "left", "off" }, { "inner", "on" }, { "left", "on" }, });
+    }
+
+    public CombinationTest(String joinType, String coprocessorToggle) throws Exception {
+
+        KylinQueryTest.clean();
+
+        KylinQueryTest.joinType = joinType;
+        KylinQueryTest.setupAll();
+        KylinQueryTest.preferCubeOf(joinType);
+
+        if (coprocessorToggle.equals("on")) {
+            CoprocessorEnabler.forceCoprocessorOn();
+        } else if (coprocessorToggle.equals("off")) {
+            CoprocessorEnabler.forceCoprocessorOff();
+        } else if (coprocessorToggle.equals("unset")) {
+            // unset
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/4b631f92/query/src/test/java/com/kylinolap/query/test/H2Database.java
----------------------------------------------------------------------
diff --git a/query/src/test/java/com/kylinolap/query/test/H2Database.java b/query/src/test/java/com/kylinolap/query/test/H2Database.java
new file mode 100644
index 0000000..77996e0
--- /dev/null
+++ b/query/src/test/java/com/kylinolap/query/test/H2Database.java
@@ -0,0 +1,134 @@
+/*
+ * Copyright 2013-2014 eBay Software Foundation
+ *
+ * Licensed 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.
+ */
+package com.kylinolap.query.test;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.kylinolap.common.KylinConfig;
+import com.kylinolap.metadata.MetadataManager;
+import com.kylinolap.metadata.model.schema.ColumnDesc;
+import com.kylinolap.metadata.model.schema.TableDesc;
+
+public class H2Database {
+    private static final Logger logger = LoggerFactory.getLogger(H2Database.class);
+
+    private static final String[] ALL_TABLES = new String[] { "test_cal_dt", "test_category_groupings", "test_kylin_fact", "test_seller_type_dim", "test_sites" };
+    private static final Map<String, String> javaToH2DataTypeMapping = new HashMap<String, String>();
+
+    static {
+        javaToH2DataTypeMapping.put("short", "smallint");
+        javaToH2DataTypeMapping.put("long", "bigint");
+        javaToH2DataTypeMapping.put("byte", "tinyint");
+        javaToH2DataTypeMapping.put("string", "varchar");
+    }
+
+    private final Connection h2Connection;
+
+    private final KylinConfig config;
+
+    public H2Database(Connection h2Connection, KylinConfig config) {
+        this.h2Connection = h2Connection;
+        this.config = config;
+    }
+
+    public void loadAllTables(String joinType) throws SQLException {
+        for (String tableName : ALL_TABLES) {
+            loadH2Table(tableName, joinType);
+        }
+    }
+
+    private void loadH2Table(String tableName, String joinType) throws SQLException {
+        MetadataManager metaMgr = MetadataManager.getInstance(config);
+        TableDesc tableDesc = metaMgr.getTableDesc(tableName.toUpperCase());
+        File tempFile = null;
+
+        String fileNameSuffix = joinType.equalsIgnoreCase("default") ? "" : "." + joinType;
+
+        try {
+            tempFile = File.createTempFile("tmp_h2", ".csv");
+            FileOutputStream tempFileStream = new FileOutputStream(tempFile);
+            String normalPath = "/data/" + tableDesc.getName() + ".csv";
+
+            // If it's the fact table, there will be a facttable.csv.inner or
+            // facttable.csv.left in hbase
+            // otherwise just use lookup.csv
+            InputStream csvStream = metaMgr.getStore().getResource(normalPath + fileNameSuffix);
+            if (csvStream == null) {
+                csvStream = metaMgr.getStore().getResource(normalPath);
+            } else {
+                logger.info("H2 decides to load " + (normalPath + fileNameSuffix) + " for table " + tableDesc.getName());
+            }
+
+            org.apache.commons.io.IOUtils.copy(csvStream, tempFileStream);
+
+            csvStream.close();
+            tempFileStream.close();
+
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+
+        String cvsFilePath = tempFile.getPath();
+        Statement stmt = h2Connection.createStatement();
+        String sql = generateCreateH2TableSql(tableDesc, cvsFilePath);
+        stmt.executeUpdate(sql);
+
+        if (tempFile != null)
+            tempFile.delete();
+    }
+
+    private String generateCreateH2TableSql(TableDesc tableDesc, String csvFilePath) {
+        StringBuilder ddl = new StringBuilder();
+        StringBuilder csvColumns = new StringBuilder();
+
+        ddl.append("CREATE TABLE " + tableDesc.getName() + "\n");
+        ddl.append("(" + "\n");
+
+        for (int i = 0; i < tableDesc.getColumns().length; i++) {
+            ColumnDesc col = tableDesc.getColumns()[i];
+            if (i > 0) {
+                ddl.append(",");
+                csvColumns.append(",");
+            }
+            ddl.append(col.getName() + " " + getH2DataType((col.getDatatype())) + "\n");
+            csvColumns.append(col.getName());
+        }
+        ddl.append(")" + "\n");
+        ddl.append("AS SELECT * FROM CSVREAD('" + csvFilePath + "', '" + csvColumns + "', 'charset=UTF-8 fieldSeparator=,');");
+
+        return ddl.toString();
+    }
+
+    private static String getH2DataType(String javaDataType) {
+        String hiveDataType = javaToH2DataTypeMapping.get(javaDataType.toLowerCase());
+        if (hiveDataType == null) {
+            hiveDataType = javaDataType;
+        }
+        return hiveDataType.toLowerCase();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/4b631f92/query/src/test/java/com/kylinolap/query/test/KylinQueryTest.java
----------------------------------------------------------------------
diff --git a/query/src/test/java/com/kylinolap/query/test/KylinQueryTest.java b/query/src/test/java/com/kylinolap/query/test/KylinQueryTest.java
new file mode 100644
index 0000000..237e593
--- /dev/null
+++ b/query/src/test/java/com/kylinolap/query/test/KylinQueryTest.java
@@ -0,0 +1,259 @@
+/*
+ * Copyright 2013-2014 eBay Software Foundation
+ *
+ * Licensed 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.
+ */
+package com.kylinolap.query.test;
+
+import static org.junit.Assert.*;
+
+import java.io.File;
+import java.sql.DriverManager;
+import java.sql.SQLException;
+import java.util.List;
+import java.util.Properties;
+
+import org.apache.commons.lang3.StringUtils;
+import org.dbunit.database.DatabaseConnection;
+import org.dbunit.database.IDatabaseConnection;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Ignore;
+import org.junit.Test;
+
+import com.kylinolap.common.KylinConfig;
+import com.kylinolap.common.util.HBaseMetadataTestCase;
+import com.kylinolap.cube.CubeManager;
+import com.kylinolap.cube.project.ProjectInstance;
+import com.kylinolap.query.enumerator.OLAPQuery;
+import com.kylinolap.query.relnode.OLAPContext;
+import com.kylinolap.query.schema.OLAPSchemaFactory;
+import com.kylinolap.storage.hbase.observer.CoprocessorEnabler;
+
+public class KylinQueryTest extends KylinTestBase {
+
+    @BeforeClass
+    public static void setUp() throws Exception {
+        printInfo("setUp in KylinQueryTest");
+
+        joinType = "left";
+        setupAll();
+        preferCubeOf(joinType);
+    }
+
+    protected static void setupAll() throws SQLException {
+        setUpEnv();
+        setUpCubeConn();
+        setUpH2Conn();
+    }
+
+    private static void setUpEnv() {
+        HBaseMetadataTestCase.staticCreateTestMetadata();
+        config = KylinConfig.getInstanceFromEnv();
+    }
+
+    private static void setUpCubeConn() throws SQLException {
+        // Cube Connection
+        File olapTmp = OLAPSchemaFactory.createTempOLAPJson(ProjectInstance.DEFAULT_PROJECT_NAME, config);
+        Properties props = new Properties();
+        props.setProperty(OLAPQuery.PROP_SCAN_THRESHOLD, "10000");
+        cubeConnection = DriverManager.getConnection("jdbc:calcite:model=" + olapTmp.getAbsolutePath(), props);
+    }
+
+    private static void setUpH2Conn() throws SQLException {
+        // H2 Connection
+        h2Connection = DriverManager.getConnection("jdbc:h2:mem:db" + (h2InstanceCount++), "sa", "");
+        // Load H2 Tables (inner join)
+        H2Database h2DB = new H2Database(h2Connection, config);
+        h2DB.loadAllTables(joinType);
+    }
+
+    @AfterClass
+    public static void tearDown() throws Exception {
+        printInfo("tearDown");
+        printInfo("Closing connection...");
+        clean();
+    }
+
+    protected static void clean() {
+        if (cubeConnection != null)
+            closeConnection(cubeConnection);
+        if (h2Connection != null)
+            closeConnection(h2Connection);
+
+        CoprocessorEnabler.forceCoprocessorUnset();
+        HBaseMetadataTestCase.staticCleanupTestMetadata();
+    }
+
+    protected static void preferCubeOf(String joinType) {
+
+        CubeManager cubeManager = CubeManager.getInstance(config);
+
+        boolean cubesBuiltInBatch = cubeManager.getCube("test_kylin_cube_with_slr_empty") != null && cubeManager.getCube("test_kylin_cube_without_slr_empty") != null && cubeManager.getCube("test_kylin_cube_with_slr_left_join_empty") != null && cubeManager.getCube("test_kylin_cube_without_slr_left_join_empty") != null;
+
+        if (!cubesBuiltInBatch) {
+            printInfo("Four empty cubes built in BuildCubeWithEngineTest is not complete, preferCubeOf being ignored");
+            return;
+        }
+
+        if (joinType.equals("inner")) {
+            cubeManager.getCube("test_kylin_cube_with_slr_empty").setCost(20);
+            cubeManager.getCube("test_kylin_cube_without_slr_empty").setCost(10);
+            cubeManager.getCube("test_kylin_cube_with_slr_left_join_empty").setCost(100);
+            cubeManager.getCube("test_kylin_cube_without_slr_left_join_empty").setCost(90);
+        } else if (joinType.equals("left") || joinType.equals("default")) {
+            cubeManager.getCube("test_kylin_cube_with_slr_empty").setCost(100);
+            cubeManager.getCube("test_kylin_cube_without_slr_empty").setCost(90);
+            cubeManager.getCube("test_kylin_cube_with_slr_left_join_empty").setCost(20);
+            cubeManager.getCube("test_kylin_cube_without_slr_left_join_empty").setCost(10);
+        }
+    }
+
+    // for debug purpose
+    @Ignore
+    @Test
+    public void testTempQuery() throws Exception {
+        execAndCompQuery("src/test/resources/query/temp", null, true);
+    }
+
+    @Test
+    public void testSingleRunQuery() throws Exception {
+
+        String queryFileName = "src/test/resources/query/sql/query02.sql";
+
+        File sqlFile = new File(queryFileName);
+        runSQL(sqlFile, true, true);
+        runSQL(sqlFile, true, false);
+    }
+
+    @Test
+    public void testSingleExecuteQuery() throws Exception {
+
+        String queryFileName = "src/test/resources/query/sql/query39.sql";
+
+        File sqlFile = new File(queryFileName);
+        String sql = getTextFromFile(sqlFile);
+        IDatabaseConnection kylinConn = new DatabaseConnection(cubeConnection);
+
+        executeQuery(kylinConn, queryFileName, sql, true);
+    }
+
+    @Ignore
+    @Test
+    public void testTableauProbing() throws Exception {
+        batchExecuteQuery("src/test/resources/query/tableau_probing");
+    }
+
+    @Test
+    public void testCommonQuery() throws Exception {
+        execAndCompQuery("src/test/resources/query/sql", null, true);
+    }
+
+    @Test
+    public void testSimpleQuery() throws Exception {
+        verifyResultRowCount("src/test/resources/query/sql_verifyCount");
+    }
+
+    @Test
+    public void testOrderByQuery() throws Exception {
+        execAndCompQuery("src/test/resources/query/sql_orderby", null, true);
+        // FIXME
+        // as of optiq 0.8, we lost metadata type with "order by" clause, e.g. sql_orderby/query01.sql
+        // thus, temporarily the "order by" clause was cross out, and the needSort is set to true
+        // execAndCompQuery("src/test/resources/query/sql_orderby", null, false);
+    }
+
+    @Test
+    public void testLookupQuery() throws Exception {
+        execAndCompQuery("src/test/resources/query/sql_lookup", null, true);
+    }
+
+    @Test
+    public void testDerivedColumnQuery() throws Exception {
+        execAndCompQuery("src/test/resources/query/sql_derived", null, true);
+    }
+
+    @Test
+    public void testDistinctCountQuery() throws Exception {
+        batchExecuteQuery("src/test/resources/query/sql_distinct");
+    }
+
+    @Test
+    public void testTableauQuery() throws Exception {
+        batchExecuteQuery("src/test/resources/query/sql_tableau");
+    }
+
+    @Test
+    public void testSubQuery() throws Exception {
+        execAndCompQuery("src/test/resources/query/sql_subquery", null, true);
+    }
+
+    @Test
+    public void testCaseWhen() throws Exception {
+        execAndCompQuery("src/test/resources/query/sql_casewhen", null, true);
+    }
+
+    @Ignore
+    @Test
+    public void testHiveQuery() throws Exception {
+        execAndCompQuery("src/test/resources/query/sql_hive", null, true);
+    }
+
+    @Test
+    public void testH2Query() throws Exception {
+        this.execQueryUsingH2("src/test/resources/query/h2", false);
+    }
+
+    @Test
+    public void testInvalidQuery() throws Exception {
+
+        printInfo("-------------------- Test Invalid Query --------------------");
+        String queryFolder = "src/test/resources/query/sql_invalid";
+        List<File> sqlFiles = getFilesFromFolder(new File(queryFolder), ".sql");
+        for (File sqlFile : sqlFiles) {
+            String queryName = StringUtils.split(sqlFile.getName(), '.')[0];
+            printInfo("Testing Query " + queryName);
+            String sql = getTextFromFile(sqlFile);
+            IDatabaseConnection cubeConn = new DatabaseConnection(cubeConnection);
+            try {
+                cubeConn.createQueryTable(queryName, sql);
+            } catch (Throwable t) {
+                continue;
+            } finally {
+                cubeConn.close();
+            }
+            throw new IllegalStateException(queryName + " should be error!");
+        }
+    }
+
+    @Test
+    public void testDynamicQuery() throws Exception {
+        execAndCompDynamicQuery("src/test/resources/query/sql_dynamic", null, true);
+    }
+
+    @Test
+    public void testLimitEnabled() throws Exception {
+        runSqlFile("src/test/resources/query/sql_optimize/enable-limit01.sql");
+        assertLimitWasEnabled();
+    }
+
+    private void assertLimitWasEnabled() {
+        OLAPContext context = getFirstOLAPContext();
+        assertTrue(context.storageContext.isLimitEnabled());
+    }
+
+    private OLAPContext getFirstOLAPContext() {
+        return OLAPContext.getThreadLocalContexts().iterator().next();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/4b631f92/query/src/test/java/com/kylinolap/query/test/KylinTestBase.java
----------------------------------------------------------------------
diff --git a/query/src/test/java/com/kylinolap/query/test/KylinTestBase.java b/query/src/test/java/com/kylinolap/query/test/KylinTestBase.java
new file mode 100644
index 0000000..bd8eb2e
--- /dev/null
+++ b/query/src/test/java/com/kylinolap/query/test/KylinTestBase.java
@@ -0,0 +1,471 @@
+/*
+ * Copyright 2013-2014 eBay Software Foundation
+ *
+ * Licensed 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.
+ */
+package com.kylinolap.query.test;
+
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.charset.Charset;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.ResultSetMetaData;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.sql.Timestamp;
+import java.sql.Types;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+import java.util.logging.LogManager;
+
+import org.apache.commons.lang3.StringUtils;
+import org.dbunit.Assertion;
+import org.dbunit.database.DatabaseConfig;
+import org.dbunit.database.DatabaseConnection;
+import org.dbunit.database.IDatabaseConnection;
+import org.dbunit.dataset.DataSetException;
+import org.dbunit.dataset.ITable;
+import org.dbunit.dataset.SortedTable;
+import org.dbunit.dataset.datatype.DataType;
+import org.dbunit.dataset.datatype.DataTypeException;
+import org.dbunit.ext.h2.H2Connection;
+import org.dbunit.ext.h2.H2DataTypeFactory;
+import org.junit.Assert;
+
+import com.google.common.io.Files;
+import com.kylinolap.common.KylinConfig;
+
+/**
+ * Created by hongbin on 2/18/14.
+ */
+public class KylinTestBase {
+
+    // Hack for the different constant integer type between optiq (INTEGER) and
+    // h2 (BIGINT)
+    public static class TestH2DataTypeFactory extends H2DataTypeFactory {
+        @Override
+        public DataType createDataType(int sqlType, String sqlTypeName, String tableName, String columnName) throws DataTypeException {
+
+            if ((columnName.startsWith("COL") || columnName.startsWith("col")) && sqlType == Types.BIGINT) {
+                return DataType.INTEGER;
+            }
+            return super.createDataType(sqlType, sqlTypeName);
+        }
+    }
+
+    protected static final String resultTableName = "query result of ";
+    protected static KylinConfig config = null;
+    protected static Connection cubeConnection = null;
+    protected static Connection h2Connection = null;
+    protected static String joinType = "default";
+    protected static int h2InstanceCount = 0;
+
+    protected static int compQueryCount = 0;
+    protected static ArrayList<String> zeroResultQueries = new ArrayList<String>();
+
+    protected static void closeConnection(Connection connection) {
+        if (connection != null) {
+            try {
+                connection.close();
+            } catch (SQLException e) {
+                e.printStackTrace();
+            }
+        }
+    }
+
+    /**
+     * @param folder
+     * @param fileType
+     *            specify the interested file type by file extension
+     * @return
+     */
+    protected static List<File> getFilesFromFolder(final File folder, final String fileType) {
+        List<File> files = new ArrayList<File>();
+        for (final File fileEntry : folder.listFiles()) {
+            if (fileEntry.getName().toLowerCase().endsWith(fileType.toLowerCase())) {
+                files.add(fileEntry);
+            }
+        }
+        return files;
+    }
+
+    protected static void getFilesFromFolderR(final String directoryStr, List<File> files, final String fileType) {
+        File folder = new File(directoryStr);
+        for (final File fileEntry : folder.listFiles()) {
+            if (fileEntry.isDirectory()) {
+                getFilesFromFolderR(fileEntry.getAbsolutePath(), files, fileType);
+            } else if (fileEntry.isFile()) {
+                if (fileEntry.getName().toLowerCase().endsWith(fileType.toLowerCase())) {
+                    files.add(fileEntry);
+                }
+            }
+        }
+    }
+
+    protected static void putTextTofile(File file, String sql) throws IOException {
+        BufferedWriter writer = new BufferedWriter(new FileWriter(file));
+        writer.write(sql, 0, sql.length());
+        writer.close();
+    }
+
+    protected static String getTextFromFile(File file) throws IOException {
+        BufferedReader reader = new BufferedReader(new FileReader(file));
+        String line = null;
+        StringBuilder stringBuilder = new StringBuilder();
+        String ls = System.getProperty("line.separator");
+        while ((line = reader.readLine()) != null) {
+            stringBuilder.append(line);
+            stringBuilder.append(ls);
+        }
+        reader.close();
+        return stringBuilder.toString();
+    }
+
+    protected static List<String> getParameterFromFile(File sqlFile) throws IOException {
+        String sqlFileName = sqlFile.getAbsolutePath();
+        int prefixIndex = sqlFileName.lastIndexOf(".sql");
+        String dataFielName = sqlFileName.substring(0, prefixIndex) + ".dat";
+        File dataFile = new File(dataFielName);
+        List<String> parameters = Files.readLines(dataFile, Charset.defaultCharset());
+        return parameters;
+    }
+
+    protected static void printInfo(String info) {
+        System.out.println(new Timestamp(System.currentTimeMillis()) + " - " + info);
+    }
+
+    protected static void printResult(ITable resultTable) throws DataSetException {
+        StringBuilder sb = new StringBuilder();
+
+        int columnCount = resultTable.getTableMetaData().getColumns().length;
+        String[] columns = new String[columnCount];
+
+        for (int i = 0; i < columnCount; i++) {
+            sb.append(resultTable.getTableMetaData().getColumns()[i].getColumnName());
+            sb.append("-");
+            sb.append(resultTable.getTableMetaData().getColumns()[i].getDataType());
+            sb.append("\t");
+            columns[i] = resultTable.getTableMetaData().getColumns()[i].getColumnName();
+        }
+        sb.append("\n");
+
+        for (int i = 0; i < resultTable.getRowCount(); i++) {
+            for (int j = 0; j < columns.length; j++) {
+                sb.append(resultTable.getValue(i, columns[j]));
+                sb.append("\t");
+            }
+            sb.append("\n");
+        }
+        System.out.println(sb.toString());
+    }
+
+    protected Set<String> buildExclusiveSet(String[] exclusiveQuerys) {
+        Set<String> exclusiveSet = new HashSet<String>();
+        if (exclusiveQuerys != null) {
+            for (String query : exclusiveQuerys) {
+                exclusiveSet.add(query);
+            }
+        }
+        return exclusiveSet;
+    }
+
+    // ////////////////////////////////////////////////////////////////////////////////////////
+    // execute
+
+    protected ITable executeQuery(IDatabaseConnection dbConn, String queryName, String sql, boolean needSort) throws Exception {
+
+        // change join type to match current setting
+        sql = changeJoinType(sql, joinType);
+
+        ITable queryTable = dbConn.createQueryTable(resultTableName + queryName, sql);
+        String[] columnNames = new String[queryTable.getTableMetaData().getColumns().length];
+        for (int i = 0; i < columnNames.length; i++) {
+            columnNames[i] = queryTable.getTableMetaData().getColumns()[i].getColumnName();
+        }
+        if (needSort) {
+            queryTable = new SortedTable(queryTable, columnNames);
+        }
+        printResult(queryTable);
+
+        return queryTable;
+    }
+
+    protected int executeQuery(String sql, boolean needDisplay) throws SQLException {
+
+        // change join type to match current setting
+        sql = changeJoinType(sql, joinType);
+
+        Statement statement = null;
+        ResultSet resultSet = null;
+        try {
+            printInfo("start running...");
+            statement = cubeConnection.createStatement();
+            resultSet = statement.executeQuery(sql);
+            printInfo("stop running...");
+
+            return output(resultSet, needDisplay);
+        } finally {
+            if (resultSet != null) {
+                try {
+                    resultSet.close();
+                } catch (SQLException e) {
+                    // ignore
+                }
+            }
+            if (statement != null) {
+                try {
+                    statement.close();
+                } catch (SQLException e) {
+                    // ignore
+                }
+            }
+        }
+
+    }
+
+    protected ITable executeDynamicQuery(IDatabaseConnection dbConn, String queryName, String sql, List<String> parameters, boolean needSort) throws Exception {
+
+        // change join type to match current setting
+        sql = changeJoinType(sql, joinType);
+
+        PreparedStatement prepStat = dbConn.getConnection().prepareStatement(sql);
+        for (int j = 1; j <= parameters.size(); ++j) {
+            prepStat.setString(j, parameters.get(j - 1).trim());
+        }
+
+        ITable queryTable = dbConn.createTable(resultTableName + queryName, prepStat);
+        String[] columnNames = new String[queryTable.getTableMetaData().getColumns().length];
+        for (int i = 0; i < columnNames.length; i++) {
+            columnNames[i] = queryTable.getTableMetaData().getColumns()[i].getColumnName();
+        }
+        if (needSort) {
+            queryTable = new SortedTable(queryTable, columnNames);
+        }
+        printResult(queryTable);
+        return queryTable;
+    }
+
+    // end of execute
+    // ////////////////////////////////////////////////////////////////////////////////////////
+
+    protected static String changeJoinType(String sql, String targetType) {
+
+        if (targetType.equalsIgnoreCase("default"))
+            return sql;
+
+        String specialStr = "changeJoinType_DELIMITERS";
+        sql = sql.replaceAll(System.getProperty("line.separator"), " " + specialStr + " ");
+
+        String[] tokens = StringUtils.split(sql, null);// split white spaces
+        for (int i = 0; i < tokens.length - 1; ++i) {
+            if ((tokens[i].equalsIgnoreCase("inner") || tokens[i].equalsIgnoreCase("left")) && tokens[i + 1].equalsIgnoreCase("join")) {
+                tokens[i] = targetType.toLowerCase();
+            }
+        }
+
+        String ret = StringUtils.join(tokens, " ");
+        ret = ret.replaceAll(specialStr, System.getProperty("line.separator"));
+        System.out.println("The actual sql executed is: " + ret);
+
+        return ret;
+    }
+
+    protected static void batchChangeJoinType(String targetType) throws IOException {
+        List<File> files = new LinkedList<File>();
+        getFilesFromFolderR("src/test/resources/query", files, ".sql");
+        for (File file : files) {
+            String x = changeJoinType(getTextFromFile(file), targetType);
+            putTextTofile(file, x);
+        }
+    }
+
+    protected void execQueryUsingH2(String queryFolder, boolean needSort) throws Exception {
+        printInfo("---------- Running H2 queries: " + queryFolder);
+
+        List<File> sqlFiles = getFilesFromFolder(new File(queryFolder), ".sql");
+        for (File sqlFile : sqlFiles) {
+            String queryName = StringUtils.split(sqlFile.getName(), '.')[0];
+            String sql = getTextFromFile(sqlFile);
+
+            // execute H2
+            printInfo("Query Result from H2 - " + queryName);
+            H2Connection h2Conn = new H2Connection(h2Connection, null);
+            h2Conn.getConfig().setProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY, new TestH2DataTypeFactory());
+            executeQuery(h2Conn, queryName, sql, needSort);
+        }
+    }
+
+    protected void verifyResultRowCount(String queryFolder) throws Exception {
+        printInfo("---------- verify result count in folder: " + queryFolder);
+
+        List<File> sqlFiles = getFilesFromFolder(new File(queryFolder), ".sql");
+        for (File sqlFile : sqlFiles) {
+            String queryName = StringUtils.split(sqlFile.getName(), '.')[0];
+            String sql = getTextFromFile(sqlFile);
+
+            File expectResultFile = new File(sqlFile.getParent(), sqlFile.getName() + ".expected");
+            int expectRowCount = Integer.parseInt(Files.readFirstLine(expectResultFile, Charset.defaultCharset()));
+
+            // execute Kylin
+            printInfo("Query Result from Kylin - " + queryName + "  (" + queryFolder + ")");
+            IDatabaseConnection kylinConn = new DatabaseConnection(cubeConnection);
+            ITable kylinTable = executeQuery(kylinConn, queryName, sql, false);
+
+            // compare the result
+            Assert.assertEquals(expectRowCount, kylinTable.getRowCount());
+            // Assertion.assertEquals(expectRowCount, kylinTable.getRowCount());
+        }
+    }
+
+    protected void execAndCompQuery(String queryFolder, String[] exclusiveQuerys, boolean needSort) throws Exception {
+        printInfo("---------- test folder: " + queryFolder);
+        Set<String> exclusiveSet = buildExclusiveSet(exclusiveQuerys);
+
+        List<File> sqlFiles = getFilesFromFolder(new File(queryFolder), ".sql");
+        for (File sqlFile : sqlFiles) {
+            String queryName = StringUtils.split(sqlFile.getName(), '.')[0];
+            if (exclusiveSet.contains(queryName)) {
+                continue;
+            }
+            String sql = getTextFromFile(sqlFile);
+
+            // execute Kylin
+            printInfo("Query Result from Kylin - " + queryName + "  (" + queryFolder + ")");
+            IDatabaseConnection kylinConn = new DatabaseConnection(cubeConnection);
+            ITable kylinTable = executeQuery(kylinConn, queryName, sql, needSort);
+
+            // execute H2
+            printInfo("Query Result from H2 - " + queryName);
+            H2Connection h2Conn = new H2Connection(h2Connection, null);
+            h2Conn.getConfig().setProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY, new TestH2DataTypeFactory());
+            ITable h2Table = executeQuery(h2Conn, queryName, sql, needSort);
+
+            // compare the result
+            Assertion.assertEquals(h2Table, kylinTable);
+
+            compQueryCount++;
+            if (kylinTable.getRowCount() == 0) {
+                zeroResultQueries.add(sql);
+            }
+        }
+    }
+
+    protected void execAndCompDynamicQuery(String queryFolder, String[] exclusiveQuerys, boolean needSort) throws Exception {
+        printInfo("---------- test folder: " + queryFolder);
+        Set<String> exclusiveSet = buildExclusiveSet(exclusiveQuerys);
+
+        List<File> sqlFiles = getFilesFromFolder(new File(queryFolder), ".sql");
+        for (File sqlFile : sqlFiles) {
+            String queryName = StringUtils.split(sqlFile.getName(), '.')[0];
+            if (exclusiveSet.contains(queryName)) {
+                continue;
+            }
+            String sql = getTextFromFile(sqlFile);
+            List<String> parameters = getParameterFromFile(sqlFile);
+
+            // execute Kylin
+            printInfo("Query Result from Kylin - " + queryName + "  (" + queryFolder + ")");
+            IDatabaseConnection kylinConn = new DatabaseConnection(cubeConnection);
+            ITable kylinTable = executeDynamicQuery(kylinConn, queryName, sql, parameters, needSort);
+
+            // execute H2
+            printInfo("Query Result from H2 - " + queryName);
+            IDatabaseConnection h2Conn = new DatabaseConnection(h2Connection);
+            h2Conn.getConfig().setProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY, new TestH2DataTypeFactory());
+            ITable h2Table = executeDynamicQuery(h2Conn, queryName, sql, parameters, needSort);
+
+            // compare the result
+            Assertion.assertEquals(h2Table, kylinTable);
+        }
+    }
+
+    protected int runSqlFile(String file) throws Exception {
+        return runSQL(new File(file), true, false);
+    }
+    
+    protected int runSQL(File sqlFile, boolean debug, boolean explain) throws Exception {
+        if (debug) {
+            System.setProperty("calcite.debug", "true");
+            InputStream inputStream = new FileInputStream("src/test/resources/logging.properties");
+            LogManager.getLogManager().readConfiguration(inputStream);
+        }
+
+        String queryName = StringUtils.split(sqlFile.getName(), '.')[0];
+        printInfo("Testing Query " + queryName);
+        String sql = getTextFromFile(sqlFile);
+        if (explain) {
+            sql = "explain plan for " + sql;
+        }
+        int count = executeQuery(sql, true);
+
+        if (debug) {
+            System.clearProperty("optiq.debug");
+        }
+        return count;
+    }
+
+    protected void batchExecuteQuery(String queryFolder) throws Exception {
+        List<File> sqlFiles = getFilesFromFolder(new File(queryFolder), ".sql");
+        for (File sqlFile : sqlFiles) {
+            runSQL(sqlFile, false, false);
+        }
+    }
+
+    protected int output(ResultSet resultSet, boolean needDisplay) throws SQLException {
+        int count = 0;
+        ResultSetMetaData metaData = resultSet.getMetaData();
+        int columnCount = metaData.getColumnCount();
+        StringBuilder sb = new StringBuilder("\n");
+        if (needDisplay) {
+            for (int i = 1; i <= columnCount; i++) {
+                sb.append(metaData.getColumnName(i));
+                sb.append("-");
+                sb.append(metaData.getTableName(i));
+                sb.append("-");
+                sb.append(metaData.getColumnTypeName(i));
+                if (i < columnCount) {
+                    sb.append("\t");
+                } else {
+                    sb.append("\n");
+                }
+            }
+        }
+
+        while (resultSet.next()) {
+            if (needDisplay) {
+                for (int i = 1; i <= columnCount; i++) {
+                    sb.append(resultSet.getString(i));
+                    if (i < columnCount) {
+                        sb.append("\t");
+                    } else {
+                        sb.append("\n");
+                    }
+                }
+            }
+            count++;
+        }
+        printInfo(sb.toString());
+        return count;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/4b631f92/query/src/test/resources/logging.properties
----------------------------------------------------------------------
diff --git a/query/src/test/resources/logging.properties b/query/src/test/resources/logging.properties
new file mode 100644
index 0000000..db07b53
--- /dev/null
+++ b/query/src/test/resources/logging.properties
@@ -0,0 +1,5 @@
+handlers=java.util.logging.ConsoleHandler
+.level=INFO
+#org.eigenbase.relopt.RelOptPlanner.level=FINEST
+java.util.logging.ConsoleHandler.level=ALL
+java.util.logging.ConsoleHandler.formatter=com.kylinolap.common.util.MyLogFormatter
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/4b631f92/query/src/test/resources/query/h2/query07.sql
----------------------------------------------------------------------
diff --git a/query/src/test/resources/query/h2/query07.sql b/query/src/test/resources/query/h2/query07.sql
new file mode 100644
index 0000000..5841f5f
--- /dev/null
+++ b/query/src/test/resources/query/h2/query07.sql
@@ -0,0 +1,3 @@
+select count(*) from ( select test_kylin_fact.lstg_format_name from test_kylin_fact 
+ where test_kylin_fact.lstg_format_name='FP-GTC' 
+ group by test_kylin_fact.lstg_format_name ) t 

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/4b631f92/query/src/test/resources/query/h2/query09.sql
----------------------------------------------------------------------
diff --git a/query/src/test/resources/query/h2/query09.sql b/query/src/test/resources/query/h2/query09.sql
new file mode 100644
index 0000000..08a64d8
--- /dev/null
+++ b/query/src/test/resources/query/h2/query09.sql
@@ -0,0 +1,5 @@
+select count(*) from (select test_cal_dt.week_beg_dt 
+ from test_kylin_fact 
+ inner JOIN test_cal_dt 
+ ON test_kylin_fact.cal_dt = test_cal_dt.cal_dt 
+ group by test_cal_dt.week_beg_dt) t 

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/4b631f92/query/src/test/resources/query/h2/query10.sql
----------------------------------------------------------------------
diff --git a/query/src/test/resources/query/h2/query10.sql b/query/src/test/resources/query/h2/query10.sql
new file mode 100644
index 0000000..5036c63
--- /dev/null
+++ b/query/src/test/resources/query/h2/query10.sql
@@ -0,0 +1,7 @@
+select test_cal_dt.week_beg_dt 
+ from test_kylin_fact 
+ inner JOIN test_cal_dt 
+ ON test_kylin_fact.cal_dt = test_cal_dt.cal_dt 
+ where test_kylin_fact.lstg_format_name='FP-GTC' 
+ and test_cal_dt.week_beg_dt between DATE '2013-05-01' and DATE '2013-08-01' 
+ group by test_cal_dt.week_beg_dt 

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/4b631f92/query/src/test/resources/query/sql/.gitignore
----------------------------------------------------------------------
diff --git a/query/src/test/resources/query/sql/.gitignore b/query/src/test/resources/query/sql/.gitignore
new file mode 100644
index 0000000..0daace0
--- /dev/null
+++ b/query/src/test/resources/query/sql/.gitignore
@@ -0,0 +1,2 @@
+/sample.txt
+/0000.sql

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/4b631f92/query/src/test/resources/query/sql/query00.sql
----------------------------------------------------------------------
diff --git a/query/src/test/resources/query/sql/query00.sql b/query/src/test/resources/query/sql/query00.sql
new file mode 100644
index 0000000..40c247d
--- /dev/null
+++ b/query/src/test/resources/query/sql/query00.sql
@@ -0,0 +1,4 @@
+select lstg_format_name, sum(price) as GMV 
+ from test_kylin_fact 
+ where lstg_format_name='FP-GTC' 
+ group by lstg_format_name 

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/4b631f92/query/src/test/resources/query/sql/query01.sql
----------------------------------------------------------------------
diff --git a/query/src/test/resources/query/sql/query01.sql b/query/src/test/resources/query/sql/query01.sql
new file mode 100644
index 0000000..52a2fcf
--- /dev/null
+++ b/query/src/test/resources/query/sql/query01.sql
@@ -0,0 +1,2 @@
+select LSTG_FORMAT_NAME, sum(price) as GMV, count(1) as TRANS_CNT from test_kylin_fact 
+ group by LSTG_FORMAT_NAME 

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/4b631f92/query/src/test/resources/query/sql/query02.sql
----------------------------------------------------------------------
diff --git a/query/src/test/resources/query/sql/query02.sql b/query/src/test/resources/query/sql/query02.sql
new file mode 100644
index 0000000..c2baad0
--- /dev/null
+++ b/query/src/test/resources/query/sql/query02.sql
@@ -0,0 +1 @@
+select sum(price) as GMV, count(1) as TRANS_CNT from test_kylin_fact 

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/4b631f92/query/src/test/resources/query/sql/query03.sql
----------------------------------------------------------------------
diff --git a/query/src/test/resources/query/sql/query03.sql b/query/src/test/resources/query/sql/query03.sql
new file mode 100644
index 0000000..0db8288
--- /dev/null
+++ b/query/src/test/resources/query/sql/query03.sql
@@ -0,0 +1,2 @@
+select test_kylin_fact.lstg_format_name, sum(price) as GMV, count(*) as TRANS_CNT from test_kylin_fact 
+ group by test_kylin_fact.lstg_format_name 

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/4b631f92/query/src/test/resources/query/sql/query04.sql
----------------------------------------------------------------------
diff --git a/query/src/test/resources/query/sql/query04.sql b/query/src/test/resources/query/sql/query04.sql
new file mode 100644
index 0000000..d7accd9
--- /dev/null
+++ b/query/src/test/resources/query/sql/query04.sql
@@ -0,0 +1,3 @@
+select test_kylin_fact.lstg_format_name,sum(test_kylin_fact.price) as GMV 
+ , count(*) as TRANS_CNT from test_kylin_fact 
+ group by test_kylin_fact.lstg_format_name having sum(price)>5000 

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/4b631f92/query/src/test/resources/query/sql/query05.sql
----------------------------------------------------------------------
diff --git a/query/src/test/resources/query/sql/query05.sql b/query/src/test/resources/query/sql/query05.sql
new file mode 100644
index 0000000..711fc5e
--- /dev/null
+++ b/query/src/test/resources/query/sql/query05.sql
@@ -0,0 +1,4 @@
+select test_kylin_fact.lstg_format_name,sum(test_kylin_fact.price) as GMV 
+ , count(*) as TRANS_CNT from test_kylin_fact 
+ where test_kylin_fact.lstg_format_name is null 
+ group by test_kylin_fact.lstg_format_name having sum(price)>5000 and count(*)>72 

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/4b631f92/query/src/test/resources/query/sql/query06.sql
----------------------------------------------------------------------
diff --git a/query/src/test/resources/query/sql/query06.sql b/query/src/test/resources/query/sql/query06.sql
new file mode 100644
index 0000000..486cd23
--- /dev/null
+++ b/query/src/test/resources/query/sql/query06.sql
@@ -0,0 +1,5 @@
+select test_kylin_fact.lstg_format_name,sum(test_kylin_fact.price) as GMV 
+ , count(*) as TRANS_CNT from test_kylin_fact 
+ where test_kylin_fact.lstg_format_name is not null 
+ group by test_kylin_fact.lstg_format_name 
+ having sum(price)>5000 or count(*)>20 

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/4b631f92/query/src/test/resources/query/sql/query07.sql
----------------------------------------------------------------------
diff --git a/query/src/test/resources/query/sql/query07.sql b/query/src/test/resources/query/sql/query07.sql
new file mode 100644
index 0000000..e399a0a
--- /dev/null
+++ b/query/src/test/resources/query/sql/query07.sql
@@ -0,0 +1,4 @@
+select test_kylin_fact.lstg_format_name,sum(test_kylin_fact.price) as GMV 
+ , count(*) as TRANS_CNT from test_kylin_fact 
+ where test_kylin_fact.lstg_format_name='FP-GTC' 
+ group by test_kylin_fact.lstg_format_name having sum(price)>5000 or count(*)>20 

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/4b631f92/query/src/test/resources/query/sql/query08.sql
----------------------------------------------------------------------
diff --git a/query/src/test/resources/query/sql/query08.sql b/query/src/test/resources/query/sql/query08.sql
new file mode 100644
index 0000000..bc4fd53
--- /dev/null
+++ b/query/src/test/resources/query/sql/query08.sql
@@ -0,0 +1,4 @@
+select test_kylin_fact.lstg_format_name,sum(test_kylin_fact.price) as GMV 
+ , count(*) as TRANS_CNT from test_kylin_fact 
+ where test_kylin_fact.lstg_format_name='FP-GTC' 
+ group by test_kylin_fact.lstg_format_name 

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/4b631f92/query/src/test/resources/query/sql/query09.sql
----------------------------------------------------------------------
diff --git a/query/src/test/resources/query/sql/query09.sql b/query/src/test/resources/query/sql/query09.sql
new file mode 100644
index 0000000..d3bfa89
--- /dev/null
+++ b/query/src/test/resources/query/sql/query09.sql
@@ -0,0 +1,5 @@
+select test_cal_dt.week_beg_dt, count(*) as TRANS_CNT 
+ from test_kylin_fact 
+ inner JOIN 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/incubator-kylin/blob/4b631f92/query/src/test/resources/query/sql/query10.sql
----------------------------------------------------------------------
diff --git a/query/src/test/resources/query/sql/query10.sql b/query/src/test/resources/query/sql/query10.sql
new file mode 100644
index 0000000..bd92a71
--- /dev/null
+++ b/query/src/test/resources/query/sql/query10.sql
@@ -0,0 +1,8 @@
+select test_cal_dt.week_beg_dt,sum(test_kylin_fact.price) as GMV 
+ , count(*) as TRANS_CNT 
+ from test_kylin_fact 
+ inner JOIN test_cal_dt 
+ ON test_kylin_fact.cal_dt = test_cal_dt.cal_dt 
+ where test_kylin_fact.lstg_format_name='FP-GTC' 
+ and test_cal_dt.week_beg_dt between DATE '2013-05-01' and DATE '2013-08-01' 
+ group by test_cal_dt.week_beg_dt 

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/4b631f92/query/src/test/resources/query/sql/query11.sql
----------------------------------------------------------------------
diff --git a/query/src/test/resources/query/sql/query11.sql b/query/src/test/resources/query/sql/query11.sql
new file mode 100644
index 0000000..f225aa8
--- /dev/null
+++ b/query/src/test/resources/query/sql/query11.sql
@@ -0,0 +1,8 @@
+select test_kylin_fact.lstg_format_name, test_cal_dt.week_beg_dt,sum(test_kylin_fact.price) as GMV 
+ , count(*) as TRANS_CNT 
+ from test_kylin_fact 
+ inner JOIN test_cal_dt 
+ ON test_kylin_fact.cal_dt = test_cal_dt.cal_dt 
+ where test_cal_dt.week_beg_dt between DATE '2013-05-01' and DATE '2013-08-01' 
+ group by test_kylin_fact.lstg_format_name, test_cal_dt.week_beg_dt 
+ having sum(price)>500 

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/4b631f92/query/src/test/resources/query/sql/query12.sql
----------------------------------------------------------------------
diff --git a/query/src/test/resources/query/sql/query12.sql b/query/src/test/resources/query/sql/query12.sql
new file mode 100644
index 0000000..5289dde
--- /dev/null
+++ b/query/src/test/resources/query/sql/query12.sql
@@ -0,0 +1,7 @@
+select test_kylin_fact.lstg_format_name, test_cal_dt.week_beg_dt,sum(test_kylin_fact.price) as GMV 
+ , count(*) as TRANS_CNT 
+ from test_kylin_fact 
+ inner JOIN test_cal_dt 
+ ON test_kylin_fact.cal_dt = test_cal_dt.cal_dt 
+ where test_cal_dt.week_beg_dt >= DATE '2013-02-10' 
+ group by test_kylin_fact.lstg_format_name, test_cal_dt.week_beg_dt 

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/4b631f92/query/src/test/resources/query/sql/query13.sql
----------------------------------------------------------------------
diff --git a/query/src/test/resources/query/sql/query13.sql b/query/src/test/resources/query/sql/query13.sql
new file mode 100644
index 0000000..4e8dd76
--- /dev/null
+++ b/query/src/test/resources/query/sql/query13.sql
@@ -0,0 +1,6 @@
+select sum(test_kylin_fact.price) as GMV 
+ , count(*) as TRANS_CNT from test_kylin_fact 
+ inner JOIN test_cal_dt 
+ ON test_kylin_fact.cal_dt = test_cal_dt.cal_dt 
+ where test_kylin_fact.lstg_format_name='FP-GTC' 
+ and test_cal_dt.week_beg_dt between DATE '2013-05-01' and DATE '2013-08-01' 

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/4b631f92/query/src/test/resources/query/sql/query14.sql
----------------------------------------------------------------------
diff --git a/query/src/test/resources/query/sql/query14.sql b/query/src/test/resources/query/sql/query14.sql
new file mode 100644
index 0000000..9fc8660
--- /dev/null
+++ b/query/src/test/resources/query/sql/query14.sql
@@ -0,0 +1,17 @@
+SELECT 
+ test_cal_dt.week_beg_dt 
+ ,test_category_groupings.meta_categ_name 
+ ,test_category_groupings.categ_lvl2_name 
+ ,test_category_groupings.categ_lvl3_name 
+ ,sum(test_kylin_fact.price) as GMV 
+ , count(*) as trans_cnt 
+ FROM test_kylin_fact 
+ inner JOIN 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 
+ group by test_cal_dt.week_beg_dt 
+ ,test_category_groupings.meta_categ_name 
+ ,test_category_groupings.categ_lvl2_name 
+ ,test_category_groupings.categ_lvl3_name 

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/4b631f92/query/src/test/resources/query/sql/query15.sql
----------------------------------------------------------------------
diff --git a/query/src/test/resources/query/sql/query15.sql b/query/src/test/resources/query/sql/query15.sql
new file mode 100644
index 0000000..57d292b
--- /dev/null
+++ b/query/src/test/resources/query/sql/query15.sql
@@ -0,0 +1,12 @@
+SELECT 
+ test_cal_dt.week_beg_dt 
+ ,test_category_groupings.meta_categ_name 
+ ,sum(price) as GMV, count(*) as TRANS_CNT 
+ FROM test_kylin_fact 
+ inner JOIN 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 
+ group by test_cal_dt.week_beg_dt 
+ ,test_category_groupings.meta_categ_name 
+ 

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/4b631f92/query/src/test/resources/query/sql/query16.sql
----------------------------------------------------------------------
diff --git a/query/src/test/resources/query/sql/query16.sql b/query/src/test/resources/query/sql/query16.sql
new file mode 100644
index 0000000..9576f38
--- /dev/null
+++ b/query/src/test/resources/query/sql/query16.sql
@@ -0,0 +1,16 @@
+SELECT 
+ test_cal_dt.week_beg_dt 
+ ,test_category_groupings.meta_categ_name 
+ ,test_category_groupings.categ_lvl2_name 
+ ,test_category_groupings.categ_lvl3_name 
+ ,sum(price) as GMV, count(*) as TRANS_CNT 
+ FROM test_kylin_fact 
+ inner JOIN 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 
+ group by test_cal_dt.week_beg_dt 
+ ,test_category_groupings.meta_categ_name 
+ ,test_category_groupings.categ_lvl2_name 
+ ,test_category_groupings.categ_lvl3_name 

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/4b631f92/query/src/test/resources/query/sql/query17.sql
----------------------------------------------------------------------
diff --git a/query/src/test/resources/query/sql/query17.sql b/query/src/test/resources/query/sql/query17.sql
new file mode 100644
index 0000000..a262477
--- /dev/null
+++ b/query/src/test/resources/query/sql/query17.sql
@@ -0,0 +1,18 @@
+SELECT 
+ test_cal_dt.week_beg_dt 
+ ,test_category_groupings.meta_categ_name 
+ ,test_category_groupings.categ_lvl2_name 
+ ,test_category_groupings.categ_lvl3_name 
+ ,sum(price) as GMV, count(*) as TRANS_CNT 
+ FROM test_kylin_fact 
+ inner JOIN 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 
+ where test_cal_dt.week_beg_dt between DATE '2013-09-01' and DATE '2013-10-01' 
+ and test_category_groupings.meta_categ_name='Collectibles' 
+ group by test_cal_dt.week_beg_dt 
+ ,test_category_groupings.meta_categ_name 
+ ,test_category_groupings.categ_lvl2_name 
+ ,test_category_groupings.categ_lvl3_name 
+ 

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/4b631f92/query/src/test/resources/query/sql/query18.sql
----------------------------------------------------------------------
diff --git a/query/src/test/resources/query/sql/query18.sql b/query/src/test/resources/query/sql/query18.sql
new file mode 100644
index 0000000..cab2b3b
--- /dev/null
+++ b/query/src/test/resources/query/sql/query18.sql
@@ -0,0 +1,14 @@
+SELECT 
+ test_cal_dt.week_beg_dt 
+ ,test_category_groupings.meta_categ_name 
+ ,sum(price) as GMV, count(*) as TRANS_CNT 
+ FROM test_kylin_fact 
+ inner JOIN 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 
+ where test_cal_dt.week_beg_dt between DATE '2013-09-01' and DATE '2013-10-01' 
+ and test_category_groupings.categ_lvl2_name='Comics' 
+ group by test_cal_dt.week_beg_dt 
+ ,test_category_groupings.meta_categ_name 
+ 

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/4b631f92/query/src/test/resources/query/sql/query19.sql
----------------------------------------------------------------------
diff --git a/query/src/test/resources/query/sql/query19.sql b/query/src/test/resources/query/sql/query19.sql
new file mode 100644
index 0000000..a262477
--- /dev/null
+++ b/query/src/test/resources/query/sql/query19.sql
@@ -0,0 +1,18 @@
+SELECT 
+ test_cal_dt.week_beg_dt 
+ ,test_category_groupings.meta_categ_name 
+ ,test_category_groupings.categ_lvl2_name 
+ ,test_category_groupings.categ_lvl3_name 
+ ,sum(price) as GMV, count(*) as TRANS_CNT 
+ FROM test_kylin_fact 
+ inner JOIN 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 
+ where test_cal_dt.week_beg_dt between DATE '2013-09-01' and DATE '2013-10-01' 
+ and test_category_groupings.meta_categ_name='Collectibles' 
+ group by test_cal_dt.week_beg_dt 
+ ,test_category_groupings.meta_categ_name 
+ ,test_category_groupings.categ_lvl2_name 
+ ,test_category_groupings.categ_lvl3_name 
+ 

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/4b631f92/query/src/test/resources/query/sql/query20.sql
----------------------------------------------------------------------
diff --git a/query/src/test/resources/query/sql/query20.sql b/query/src/test/resources/query/sql/query20.sql
new file mode 100644
index 0000000..c0489bf
--- /dev/null
+++ b/query/src/test/resources/query/sql/query20.sql
@@ -0,0 +1,14 @@
+SELECT 
+ test_cal_dt.week_beg_dt 
+ ,test_category_groupings.meta_categ_name 
+ ,sum(price) as GMV, count(*) as TRANS_CNT 
+ FROM test_kylin_fact 
+ inner JOIN 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 
+ where test_cal_dt.week_beg_dt between DATE '2013-09-01' and DATE '2013-10-01' 
+ and test_category_groupings.categ_lvl3_name='Other' 
+ group by test_cal_dt.week_beg_dt 
+ ,test_category_groupings.meta_categ_name 
+ 

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/4b631f92/query/src/test/resources/query/sql/query21.sql
----------------------------------------------------------------------
diff --git a/query/src/test/resources/query/sql/query21.sql b/query/src/test/resources/query/sql/query21.sql
new file mode 100644
index 0000000..bd0ca84
--- /dev/null
+++ b/query/src/test/resources/query/sql/query21.sql
@@ -0,0 +1,22 @@
+SELECT 
+ test_cal_dt.week_beg_dt 
+ ,test_category_groupings.meta_categ_name 
+ ,test_category_groupings.categ_lvl2_name 
+ ,test_category_groupings.categ_lvl3_name 
+ ,test_kylin_fact.lstg_format_name 
+ ,test_sites.site_name 
+ ,sum(test_kylin_fact.price) as GMV, count(*) as TRANS_CNT 
+ FROM test_kylin_fact 
+ inner JOIN 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 test_sites 
+ ON test_kylin_fact.lstg_site_id = test_sites.site_id 
+ where test_cal_dt.week_beg_dt between DATE '2013-02-01' and DATE '2013-03-01' 
+ group by test_cal_dt.week_beg_dt 
+ ,test_category_groupings.meta_categ_name 
+ ,test_category_groupings.categ_lvl2_name 
+ ,test_category_groupings.categ_lvl3_name 
+ ,test_kylin_fact.lstg_format_name 
+ ,test_sites.site_name 

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/4b631f92/query/src/test/resources/query/sql/query22.sql
----------------------------------------------------------------------
diff --git a/query/src/test/resources/query/sql/query22.sql b/query/src/test/resources/query/sql/query22.sql
new file mode 100644
index 0000000..03af146
--- /dev/null
+++ b/query/src/test/resources/query/sql/query22.sql
@@ -0,0 +1,24 @@
+SELECT 
+ test_cal_dt.week_beg_dt 
+ ,test_category_groupings.meta_categ_name 
+ ,test_category_groupings.categ_lvl2_name 
+ ,test_category_groupings.categ_lvl3_name 
+ ,test_kylin_fact.lstg_format_name 
+ ,test_sites.site_name 
+ ,sum(test_kylin_fact.price) as GMV 
+ , count(*) as TRANS_CNT 
+ FROM test_kylin_fact 
+ inner JOIN 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 test_sites 
+ ON test_kylin_fact.lstg_site_id = test_sites.site_id 
+ where test_cal_dt.week_beg_dt between DATE '2012-02-01' and DATE '2013-10-01' 
+ and site_name='Canada' 
+ group by test_cal_dt.week_beg_dt 
+ ,test_category_groupings.meta_categ_name 
+ ,test_category_groupings.categ_lvl2_name 
+ ,test_category_groupings.categ_lvl3_name 
+ ,test_kylin_fact.lstg_format_name 
+ ,test_sites.site_name 

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/4b631f92/query/src/test/resources/query/sql/query23.sql
----------------------------------------------------------------------
diff --git a/query/src/test/resources/query/sql/query23.sql b/query/src/test/resources/query/sql/query23.sql
new file mode 100644
index 0000000..63de8ac
--- /dev/null
+++ b/query/src/test/resources/query/sql/query23.sql
@@ -0,0 +1,23 @@
+SELECT 
+ test_cal_dt.week_beg_dt 
+ ,test_category_groupings.meta_categ_name 
+ ,test_kylin_fact.lstg_format_name 
+ ,test_sites.site_name 
+ ,sum(test_kylin_fact.price) as GMV 
+ , count(*) as TRANS_CNT 
+ FROM test_kylin_fact 
+ inner JOIN 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 test_sites 
+ ON test_kylin_fact.lstg_site_id = test_sites.site_id 
+ where test_cal_dt.week_beg_dt between DATE '2013-02-01' and DATE '2013-10-01' 
+ and site_name='Ebay' 
+ and test_category_groupings.categ_lvl3_name='Other' 
+ and test_kylin_fact.lstg_format_name='Auction' 
+ group by test_cal_dt.week_beg_dt 
+ ,test_category_groupings.meta_categ_name 
+ ,test_kylin_fact.lstg_format_name 
+ ,test_sites.site_name 
+ 

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/4b631f92/query/src/test/resources/query/sql/query24.sql
----------------------------------------------------------------------
diff --git a/query/src/test/resources/query/sql/query24.sql b/query/src/test/resources/query/sql/query24.sql
new file mode 100644
index 0000000..0ca7bf6
--- /dev/null
+++ b/query/src/test/resources/query/sql/query24.sql
@@ -0,0 +1,27 @@
+SELECT 
+ test_cal_dt.week_beg_dt 
+ ,test_category_groupings.meta_categ_name 
+ ,test_category_groupings.categ_lvl2_name 
+ ,test_category_groupings.categ_lvl3_name 
+ ,test_kylin_fact.lstg_format_name 
+ ,test_sites.site_name 
+ ,test_seller_type_dim.seller_type_desc 
+ ,sum(test_kylin_fact.price) as GMV 
+ , count(*) as TRANS_CNT 
+ FROM test_kylin_fact 
+ inner JOIN 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 test_sites 
+ ON test_kylin_fact.lstg_site_id = test_sites.site_id 
+ inner JOIN test_seller_type_dim 
+ ON test_kylin_fact.slr_segment_cd = test_seller_type_dim.seller_type_cd 
+ group by test_cal_dt.week_beg_dt 
+ ,test_category_groupings.meta_categ_name 
+ ,test_category_groupings.categ_lvl2_name 
+ ,test_category_groupings.categ_lvl3_name 
+ ,test_kylin_fact.lstg_format_name 
+ ,test_sites.site_name 
+ ,test_seller_type_dim.seller_type_desc 
+ 

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/4b631f92/query/src/test/resources/query/sql/query25.sql
----------------------------------------------------------------------
diff --git a/query/src/test/resources/query/sql/query25.sql b/query/src/test/resources/query/sql/query25.sql
new file mode 100644
index 0000000..7df7680
--- /dev/null
+++ b/query/src/test/resources/query/sql/query25.sql
@@ -0,0 +1,28 @@
+SELECT 
+ test_cal_dt.week_beg_dt 
+ ,test_category_groupings.meta_categ_name 
+ ,test_category_groupings.categ_lvl2_name 
+ ,test_category_groupings.categ_lvl3_name 
+ ,test_kylin_fact.lstg_format_name 
+ ,test_sites.site_name 
+ ,test_seller_type_dim.seller_type_desc 
+ ,sum(test_kylin_fact.price) as GMV 
+ , count(*) as TRANS_CNT 
+ FROM test_kylin_fact 
+ inner JOIN 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 test_sites 
+ ON test_kylin_fact.lstg_site_id = test_sites.site_id 
+ inner JOIN test_seller_type_dim 
+ ON test_kylin_fact.slr_segment_cd = test_seller_type_dim.seller_type_cd 
+ where test_cal_dt.week_beg_dt between DATE '2013-01-01' and DATE '2013-06-01' 
+ group by test_cal_dt.week_beg_dt 
+ ,test_category_groupings.meta_categ_name 
+ ,test_category_groupings.categ_lvl2_name 
+ ,test_category_groupings.categ_lvl3_name 
+ ,test_kylin_fact.lstg_format_name 
+ ,test_sites.site_name 
+ ,test_seller_type_dim.seller_type_desc 
+ 

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/4b631f92/query/src/test/resources/query/sql/query26.sql
----------------------------------------------------------------------
diff --git a/query/src/test/resources/query/sql/query26.sql b/query/src/test/resources/query/sql/query26.sql
new file mode 100644
index 0000000..0aecb06
--- /dev/null
+++ b/query/src/test/resources/query/sql/query26.sql
@@ -0,0 +1,30 @@
+SELECT 
+ test_cal_dt.week_beg_dt 
+ ,test_category_groupings.meta_categ_name 
+ ,test_category_groupings.categ_lvl2_name 
+ ,test_category_groupings.categ_lvl3_name 
+ ,test_kylin_fact.lstg_format_name 
+ ,test_sites.site_name 
+ ,test_seller_type_dim.seller_type_desc 
+ ,sum(test_kylin_fact.price) as GMV 
+ , count(*) as TRANS_CNT 
+ FROM test_kylin_fact 
+ inner JOIN 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 test_sites 
+ ON test_kylin_fact.lstg_site_id = test_sites.site_id 
+ inner JOIN test_seller_type_dim 
+ ON test_kylin_fact.slr_segment_cd = test_seller_type_dim.seller_type_cd 
+ where test_cal_dt.week_beg_dt between DATE '2013-01-01' and DATE '2013-06-04' 
+ and (test_category_groupings.meta_categ_name='Collectibles' or test_category_groupings.meta_categ_name='Clothing, Shoes & Accessories') and 
+ test_category_groupings.categ_lvl3_name <>'Other' and test_sites.site_name='Ebay' 
+ group by test_cal_dt.week_beg_dt 
+ ,test_category_groupings.meta_categ_name 
+ ,test_category_groupings.categ_lvl2_name 
+ ,test_category_groupings.categ_lvl3_name 
+ ,test_kylin_fact.lstg_format_name 
+ ,test_sites.site_name 
+ ,test_seller_type_dim.seller_type_desc 
+ 

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/4b631f92/query/src/test/resources/query/sql/query27.sql
----------------------------------------------------------------------
diff --git a/query/src/test/resources/query/sql/query27.sql b/query/src/test/resources/query/sql/query27.sql
new file mode 100644
index 0000000..515aea1
--- /dev/null
+++ b/query/src/test/resources/query/sql/query27.sql
@@ -0,0 +1,29 @@
+SELECT 
+ test_cal_dt.week_beg_dt 
+ ,test_category_groupings.meta_categ_name 
+ ,test_category_groupings.categ_lvl2_name 
+ ,test_category_groupings.categ_lvl3_name 
+ ,test_kylin_fact.lstg_format_name 
+ ,test_sites.site_name 
+ ,test_seller_type_dim.seller_type_desc 
+ ,sum(test_kylin_fact.price) as GMV 
+ , count(*) as TRANS_CNT 
+ FROM test_kylin_fact 
+ inner JOIN 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 test_sites 
+ ON test_kylin_fact.lstg_site_id = test_sites.site_id 
+ inner JOIN test_seller_type_dim 
+ ON test_kylin_fact.slr_segment_cd = test_seller_type_dim.seller_type_cd 
+ where 
+ (test_category_groupings.meta_categ_name='Collectibles' or test_category_groupings.categ_lvl3_name='Dresses') 
+ and test_sites.site_name='Ebay' 
+ group by test_cal_dt.week_beg_dt 
+ ,test_category_groupings.meta_categ_name 
+ ,test_category_groupings.categ_lvl2_name 
+ ,test_category_groupings.categ_lvl3_name 
+ ,test_kylin_fact.lstg_format_name 
+ ,test_sites.site_name 
+ ,test_seller_type_dim.seller_type_desc 

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/4b631f92/query/src/test/resources/query/sql/query28.sql
----------------------------------------------------------------------
diff --git a/query/src/test/resources/query/sql/query28.sql b/query/src/test/resources/query/sql/query28.sql
new file mode 100644
index 0000000..a3d3220
--- /dev/null
+++ b/query/src/test/resources/query/sql/query28.sql
@@ -0,0 +1,12 @@
+SELECT 
+ sum(test_kylin_fact.price) as GMV 
+ , count(*) as TRANS_CNT 
+ FROM test_kylin_fact 
+ inner JOIN 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 test_sites 
+ ON test_kylin_fact.lstg_site_id = test_sites.site_id 
+ inner JOIN test_seller_type_dim 
+ ON test_kylin_fact.slr_segment_cd = test_seller_type_dim.seller_type_cd 

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/4b631f92/query/src/test/resources/query/sql/query29.sql
----------------------------------------------------------------------
diff --git a/query/src/test/resources/query/sql/query29.sql b/query/src/test/resources/query/sql/query29.sql
new file mode 100644
index 0000000..8d0a2f4
--- /dev/null
+++ b/query/src/test/resources/query/sql/query29.sql
@@ -0,0 +1,14 @@
+SELECT 
+ test_cal_dt.week_beg_dt 
+ ,test_category_groupings.meta_categ_name 
+ ,test_category_groupings.categ_lvl2_name 
+ ,sum(price) as GMV, count(*) as TRANS_CNT 
+ FROM test_kylin_fact 
+ inner JOIN 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 
+ group by test_cal_dt.week_beg_dt 
+ ,test_category_groupings.meta_categ_name 
+ ,test_category_groupings.categ_lvl2_name 

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/4b631f92/query/src/test/resources/query/sql/query30.sql
----------------------------------------------------------------------
diff --git a/query/src/test/resources/query/sql/query30.sql b/query/src/test/resources/query/sql/query30.sql
new file mode 100644
index 0000000..57b7f57
--- /dev/null
+++ b/query/src/test/resources/query/sql/query30.sql
@@ -0,0 +1 @@
+select sum(price) as GMV, count(1) as TRANS_CNT from test_kylin_fact limit 50 

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/4b631f92/query/src/test/resources/query/sql/query31.sql
----------------------------------------------------------------------
diff --git a/query/src/test/resources/query/sql/query31.sql b/query/src/test/resources/query/sql/query31.sql
new file mode 100644
index 0000000..420de7a
--- /dev/null
+++ b/query/src/test/resources/query/sql/query31.sql
@@ -0,0 +1,22 @@
+SELECT 
+ test_cal_dt.week_beg_dt 
+ ,test_category_groupings.meta_categ_name 
+ ,test_category_groupings.categ_lvl2_name 
+ ,test_category_groupings.categ_lvl3_name 
+ ,test_kylin_fact.lstg_format_name 
+ ,test_sites.site_name 
+ ,sum(test_kylin_fact.price) as GMV, count(*) as TRANS_CNT 
+ FROM test_kylin_fact 
+ inner JOIN 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 test_sites 
+ ON test_kylin_fact.lstg_site_id = test_sites.site_id 
+ where test_sites.site_name = '英国' 
+ group by test_cal_dt.week_beg_dt 
+ ,test_category_groupings.meta_categ_name 
+ ,test_category_groupings.categ_lvl2_name 
+ ,test_category_groupings.categ_lvl3_name 
+ ,test_kylin_fact.lstg_format_name 
+ ,test_sites.site_name 

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/4b631f92/query/src/test/resources/query/sql/query32.sql
----------------------------------------------------------------------
diff --git a/query/src/test/resources/query/sql/query32.sql b/query/src/test/resources/query/sql/query32.sql
new file mode 100644
index 0000000..33210d1
--- /dev/null
+++ b/query/src/test/resources/query/sql/query32.sql
@@ -0,0 +1,21 @@
+SELECT 
+ test_cal_dt.week_beg_dt 
+ ,test_category_groupings.meta_categ_name 
+ ,test_category_groupings.categ_lvl2_name 
+ ,test_category_groupings.categ_lvl3_name 
+ ,test_kylin_fact.lstg_format_name 
+ ,test_sites.site_name 
+ ,sum(test_kylin_fact.price) as GMV, count(*) as TRANS_CNT 
+ FROM test_kylin_fact 
+ inner JOIN 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 test_sites 
+ ON test_kylin_fact.lstg_site_id = test_sites.site_id 
+ group by test_cal_dt.week_beg_dt 
+ ,test_category_groupings.meta_categ_name 
+ ,test_category_groupings.categ_lvl2_name 
+ ,test_category_groupings.categ_lvl3_name 
+ ,test_kylin_fact.lstg_format_name 
+ ,test_sites.site_name 

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/4b631f92/query/src/test/resources/query/sql/query33.sql
----------------------------------------------------------------------
diff --git a/query/src/test/resources/query/sql/query33.sql b/query/src/test/resources/query/sql/query33.sql
new file mode 100644
index 0000000..c9116dc
--- /dev/null
+++ b/query/src/test/resources/query/sql/query33.sql
@@ -0,0 +1,25 @@
+SELECT 
+ test_kylin_fact.seller_id 
+ ,test_cal_dt.week_beg_dt 
+ ,test_category_groupings.meta_categ_name 
+ ,test_category_groupings.categ_lvl2_name 
+ ,test_category_groupings.categ_lvl3_name 
+ ,test_kylin_fact.lstg_format_name 
+ ,test_sites.site_name 
+ ,sum(test_kylin_fact.price) as GMV, count(*) as TRANS_CNT 
+ FROM test_kylin_fact 
+ inner JOIN 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 test_sites 
+ ON test_kylin_fact.lstg_site_id = test_sites.site_id 
+ where test_kylin_fact.seller_id = 10000002 
+ group by 
+ test_kylin_fact.seller_id 
+ ,test_cal_dt.week_beg_dt 
+ ,test_category_groupings.meta_categ_name 
+ ,test_category_groupings.categ_lvl2_name 
+ ,test_category_groupings.categ_lvl3_name 
+ ,test_kylin_fact.lstg_format_name 
+ ,test_sites.site_name 

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/4b631f92/query/src/test/resources/query/sql/query34.sql
----------------------------------------------------------------------
diff --git a/query/src/test/resources/query/sql/query34.sql b/query/src/test/resources/query/sql/query34.sql
new file mode 100644
index 0000000..e9b983a
--- /dev/null
+++ b/query/src/test/resources/query/sql/query34.sql
@@ -0,0 +1,23 @@
+SELECT 
+ test_cal_dt.week_beg_dt 
+ ,test_category_groupings.meta_categ_name 
+ ,test_category_groupings.categ_lvl2_name 
+ ,test_category_groupings.categ_lvl3_name 
+ ,test_kylin_fact.lstg_format_name 
+ ,test_sites.site_name 
+ ,sum(test_kylin_fact.price) as GMV, count(*) as TRANS_CNT 
+ FROM test_kylin_fact 
+ inner JOIN 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 test_sites 
+ ON test_kylin_fact.lstg_site_id = test_sites.site_id 
+ where test_kylin_fact.seller_id = 10000002 
+ group by 
+ test_cal_dt.week_beg_dt 
+ ,test_category_groupings.meta_categ_name 
+ ,test_category_groupings.categ_lvl2_name 
+ ,test_category_groupings.categ_lvl3_name 
+ ,test_kylin_fact.lstg_format_name 
+ ,test_sites.site_name 

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/4b631f92/query/src/test/resources/query/sql/query35.sql
----------------------------------------------------------------------
diff --git a/query/src/test/resources/query/sql/query35.sql b/query/src/test/resources/query/sql/query35.sql
new file mode 100644
index 0000000..8989c4c
--- /dev/null
+++ b/query/src/test/resources/query/sql/query35.sql
@@ -0,0 +1,23 @@
+SELECT 
+ test_cal_dt.week_beg_dt 
+ ,test_category_groupings.meta_categ_name 
+ ,test_category_groupings.categ_lvl2_name 
+ ,test_category_groupings.categ_lvl3_name 
+ ,test_kylin_fact.lstg_format_name 
+ ,test_sites.site_name 
+ ,sum(test_kylin_fact.price) as GMV, count(*) as TRANS_CNT 
+ FROM test_kylin_fact 
+ inner JOIN 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 test_sites 
+ ON test_kylin_fact.lstg_site_id = test_sites.site_id 
+ where test_kylin_fact.seller_id = 10000002 or test_kylin_fact.lstg_format_name = 'FP-non GTC' 
+ group by 
+ test_cal_dt.week_beg_dt 
+ ,test_category_groupings.meta_categ_name 
+ ,test_category_groupings.categ_lvl2_name 
+ ,test_category_groupings.categ_lvl3_name 
+ ,test_kylin_fact.lstg_format_name 
+ ,test_sites.site_name 

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/4b631f92/query/src/test/resources/query/sql/query36.sql
----------------------------------------------------------------------
diff --git a/query/src/test/resources/query/sql/query36.sql b/query/src/test/resources/query/sql/query36.sql
new file mode 100644
index 0000000..5bf8976
--- /dev/null
+++ b/query/src/test/resources/query/sql/query36.sql
@@ -0,0 +1,16 @@
+SELECT 
+ test_category_groupings.meta_categ_name 
+ ,sum(test_kylin_fact.price) as GMV_SUM 
+ ,max(test_kylin_fact.price) as GMV_MAX 
+ ,min(test_kylin_fact.price) as GMV_MIN 
+ ,count(*) as TRANS_CNT 
+ FROM test_kylin_fact 
+ inner JOIN 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 test_sites 
+ ON test_kylin_fact.lstg_site_id = test_sites.site_id 
+ where test_kylin_fact.seller_id = 10000002 or test_kylin_fact.lstg_format_name = 'FP-non GTC' 
+ group by 
+ test_category_groupings.meta_categ_name 

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/4b631f92/query/src/test/resources/query/sql/query37.sql
----------------------------------------------------------------------
diff --git a/query/src/test/resources/query/sql/query37.sql b/query/src/test/resources/query/sql/query37.sql
new file mode 100644
index 0000000..69ca6bf
--- /dev/null
+++ b/query/src/test/resources/query/sql/query37.sql
@@ -0,0 +1,18 @@
+select test_cal_dt.week_beg_dt, sum(test_kylin_fact.price) as GMV 
+ , count(*) as TRANS_CNT 
+ from test_kylin_fact 
+ inner JOIN test_cal_dt 
+ ON test_kylin_fact.cal_dt = test_cal_dt.cal_dt 
+ where 
+ (test_kylin_fact.lstg_format_name > '') 
+ and ( 
+ (test_kylin_fact.lstg_format_name='FP-GTC') 
+ OR 
+ (test_cal_dt.week_beg_dt between DATE '2013-05-20' and DATE '2013-05-21') 
+ ) 
+ and ( 
+ (test_kylin_fact.lstg_format_name='ABIN') 
+ OR 
+ (test_cal_dt.week_beg_dt between DATE '2013-05-20' and DATE '2013-05-21') 
+ ) 
+ group by test_cal_dt.week_beg_dt 

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/4b631f92/query/src/test/resources/query/sql/query38.sql
----------------------------------------------------------------------
diff --git a/query/src/test/resources/query/sql/query38.sql b/query/src/test/resources/query/sql/query38.sql
new file mode 100644
index 0000000..191e12e
--- /dev/null
+++ b/query/src/test/resources/query/sql/query38.sql
@@ -0,0 +1,4 @@
+select lstg_format_name, sum(price) as GMV 
+ from test_kylin_fact 
+ where lstg_format_name not in ('FP-GTC', 'ABIN') 
+ group by lstg_format_name 

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/4b631f92/query/src/test/resources/query/sql/query39.sql
----------------------------------------------------------------------
diff --git a/query/src/test/resources/query/sql/query39.sql b/query/src/test/resources/query/sql/query39.sql
new file mode 100644
index 0000000..aa37afa
--- /dev/null
+++ b/query/src/test/resources/query/sql/query39.sql
@@ -0,0 +1,2 @@
+select sum(price) as GMV 
+ from test_kylin_fact 

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/4b631f92/query/src/test/resources/query/sql/query40.sql
----------------------------------------------------------------------
diff --git a/query/src/test/resources/query/sql/query40.sql b/query/src/test/resources/query/sql/query40.sql
new file mode 100644
index 0000000..277e297
--- /dev/null
+++ b/query/src/test/resources/query/sql/query40.sql
@@ -0,0 +1,4 @@
+select cal_dt, lstg_format_name, sum(price) as GMV 
+ from test_kylin_fact 
+ where cal_dt between date '2013-05-06' and date '2013-07-31' 
+ group by cal_dt, lstg_format_name 

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/4b631f92/query/src/test/resources/query/sql/query41.sql
----------------------------------------------------------------------
diff --git a/query/src/test/resources/query/sql/query41.sql b/query/src/test/resources/query/sql/query41.sql
new file mode 100644
index 0000000..1a13939
--- /dev/null
+++ b/query/src/test/resources/query/sql/query41.sql
@@ -0,0 +1,12 @@
+SELECT 
+ test_category_groupings.meta_categ_name 
+ ,test_category_groupings.categ_lvl2_name 
+ ,sum(test_kylin_fact.price) as GMV 
+ ,count(*) as trans_cnt 
+ FROM test_kylin_fact 
+ 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 
+ group by 
+ test_category_groupings.meta_categ_name 
+ ,test_category_groupings.categ_lvl2_name 

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/4b631f92/query/src/test/resources/query/sql/query42.sql
----------------------------------------------------------------------
diff --git a/query/src/test/resources/query/sql/query42.sql b/query/src/test/resources/query/sql/query42.sql
new file mode 100644
index 0000000..2777785
--- /dev/null
+++ b/query/src/test/resources/query/sql/query42.sql
@@ -0,0 +1,5 @@
+select test_cal_dt.cal_dt, count(*) as TRANS_CNT 
+ from test_kylin_fact 
+ inner JOIN test_cal_dt 
+ ON test_kylin_fact.cal_dt = test_cal_dt.cal_dt 
+ group by test_cal_dt.cal_dt 

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/4b631f92/query/src/test/resources/query/sql/query43.sql
----------------------------------------------------------------------
diff --git a/query/src/test/resources/query/sql/query43.sql b/query/src/test/resources/query/sql/query43.sql
new file mode 100644
index 0000000..1cdc9d8
--- /dev/null
+++ b/query/src/test/resources/query/sql/query43.sql
@@ -0,0 +1,7 @@
+select test_cal_dt.cal_dt, count(*) as CNT 
+ from test_kylin_fact 
+ inner JOIN test_cal_dt 
+ ON test_kylin_fact.cal_dt = test_cal_dt.cal_dt 
+ where test_kylin_fact.lstg_format_name='FP-GTC' 
+ and test_cal_dt.week_beg_dt between DATE '2013-05-01' and DATE '2013-08-01' 
+ group by test_cal_dt.cal_dt 

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/4b631f92/query/src/test/resources/query/sql/query44.sql
----------------------------------------------------------------------
diff --git a/query/src/test/resources/query/sql/query44.sql b/query/src/test/resources/query/sql/query44.sql
new file mode 100644
index 0000000..b369ec3
--- /dev/null
+++ b/query/src/test/resources/query/sql/query44.sql
@@ -0,0 +1,10 @@
+SELECT 
+ test_category_groupings.meta_categ_name 
+ ,sum(test_kylin_fact.price) as GMV 
+ ,count(*) as trans_cnt 
+ FROM test_kylin_fact 
+ 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 
+ group by 
+ test_category_groupings.meta_categ_name 

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/4b631f92/query/src/test/resources/query/sql/query45.sql
----------------------------------------------------------------------
diff --git a/query/src/test/resources/query/sql/query45.sql b/query/src/test/resources/query/sql/query45.sql
new file mode 100644
index 0000000..fa752d2
--- /dev/null
+++ b/query/src/test/resources/query/sql/query45.sql
@@ -0,0 +1,6 @@
+select count(*) as CNT from test_cal_dt
+
+
+
+
+

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/4b631f92/query/src/test/resources/query/sql/query46.sql
----------------------------------------------------------------------
diff --git a/query/src/test/resources/query/sql/query46.sql b/query/src/test/resources/query/sql/query46.sql
new file mode 100644
index 0000000..6dba282
--- /dev/null
+++ b/query/src/test/resources/query/sql/query46.sql
@@ -0,0 +1 @@
+select count(*) as CNT  from test_category_groupings
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/4b631f92/query/src/test/resources/query/sql/query47.sql
----------------------------------------------------------------------
diff --git a/query/src/test/resources/query/sql/query47.sql b/query/src/test/resources/query/sql/query47.sql
new file mode 100644
index 0000000..aa124a3
--- /dev/null
+++ b/query/src/test/resources/query/sql/query47.sql
@@ -0,0 +1 @@
+select count(*) as CNT  from test_seller_type_dim
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/4b631f92/query/src/test/resources/query/sql/query48.sql
----------------------------------------------------------------------
diff --git a/query/src/test/resources/query/sql/query48.sql b/query/src/test/resources/query/sql/query48.sql
new file mode 100644
index 0000000..64e078b
--- /dev/null
+++ b/query/src/test/resources/query/sql/query48.sql
@@ -0,0 +1 @@
+select count(*) as CNT from test_sites
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/4b631f92/query/src/test/resources/query/sql/query49.sql
----------------------------------------------------------------------
diff --git a/query/src/test/resources/query/sql/query49.sql b/query/src/test/resources/query/sql/query49.sql
new file mode 100644
index 0000000..04302b3
--- /dev/null
+++ b/query/src/test/resources/query/sql/query49.sql
@@ -0,0 +1,18 @@
+SELECT 
+ test_cal_dt.week_beg_dt 
+ ,test_category_groupings.meta_categ_name 
+ ,test_category_groupings.categ_lvl2_name 
+ ,test_category_groupings.categ_lvl3_name 
+ ,sum(price) as GMV, count(*) as TRANS_CNT 
+ FROM test_kylin_fact 
+ inner JOIN test_cal_dt 
+ ON test_kylin_fact.cal_dt = test_cal_dt.cal_dt 
+ inner JOIN test_category_groupings 
+ ON test_kylin_fact.lstg_site_id = test_category_groupings.site_id  AND test_kylin_fact.leaf_categ_id = test_category_groupings.leaf_categ_id
+ where test_cal_dt.week_beg_dt between DATE '2013-09-01' and DATE '2013-10-01' 
+ and test_category_groupings.meta_categ_name='Collectibles' 
+ group by test_cal_dt.week_beg_dt 
+ ,test_category_groupings.meta_categ_name 
+ ,test_category_groupings.categ_lvl2_name 
+ ,test_category_groupings.categ_lvl3_name 
+ 

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/4b631f92/query/src/test/resources/query/sql/query50.sql
----------------------------------------------------------------------
diff --git a/query/src/test/resources/query/sql/query50.sql b/query/src/test/resources/query/sql/query50.sql
new file mode 100644
index 0000000..d678855
--- /dev/null
+++ b/query/src/test/resources/query/sql/query50.sql
@@ -0,0 +1,7 @@
+select test_kylin_fact.lstg_format_name, test_cal_dt.week_beg_dt,sum(test_kylin_fact.price) as GMV 
+ , count(*) as TRANS_CNT 
+ from test_kylin_fact 
+ inner JOIN test_cal_dt 
+ ON test_kylin_fact.cal_dt = test_cal_dt.cal_dt 
+ where  1 < 3
+ group by test_kylin_fact.lstg_format_name, test_cal_dt.week_beg_dt

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/4b631f92/query/src/test/resources/query/sql/query51.sql
----------------------------------------------------------------------
diff --git a/query/src/test/resources/query/sql/query51.sql b/query/src/test/resources/query/sql/query51.sql
new file mode 100644
index 0000000..b7bc5c4
--- /dev/null
+++ b/query/src/test/resources/query/sql/query51.sql
@@ -0,0 +1,7 @@
+select test_kylin_fact.lstg_format_name, test_cal_dt.week_beg_dt,sum(test_kylin_fact.price) as GMV 
+ , count(*) as TRANS_CNT 
+ from test_kylin_fact 
+ inner JOIN test_cal_dt 
+ ON test_kylin_fact.cal_dt = test_cal_dt.cal_dt 
+ where  DATE '2013-03-24'  <= test_cal_dt.week_beg_dt
+ group by test_kylin_fact.lstg_format_name, test_cal_dt.week_beg_dt 

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/4b631f92/query/src/test/resources/query/sql/query52.sql
----------------------------------------------------------------------
diff --git a/query/src/test/resources/query/sql/query52.sql b/query/src/test/resources/query/sql/query52.sql
new file mode 100644
index 0000000..1a49ce1
--- /dev/null
+++ b/query/src/test/resources/query/sql/query52.sql
@@ -0,0 +1,4 @@
+select lstg_format_name, sum(price) as GMV 
+ from test_kylin_fact 
+ where test_kylin_fact.seller_id in ( 10000002, 10000003, 10000004,10000005,10000006,10000008,10000009,10000001,10000010,10000011)
+ group by lstg_format_name 

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/4b631f92/query/src/test/resources/query/sql/query53.sql
----------------------------------------------------------------------
diff --git a/query/src/test/resources/query/sql/query53.sql b/query/src/test/resources/query/sql/query53.sql
new file mode 100644
index 0000000..193297d
--- /dev/null
+++ b/query/src/test/resources/query/sql/query53.sql
@@ -0,0 +1,6 @@
+select test_kylin_fact.cal_dt,test_kylin_fact.seller_id, sum(test_kylin_fact.price) as GMV
+ , count(*) as TRANS_CNT 
+from test_kylin_fact
+where DATE '2012-09-01' <= test_kylin_fact.cal_dt   and  test_kylin_fact.seller_id = 10000002
+ group by test_kylin_fact.cal_dt,
+test_kylin_fact.seller_id
\ No newline at end of file