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:36 UTC

[15/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/job/src/test/java/com/kylinolap/job/hadoop/hbase/CreateHTableTest.java
----------------------------------------------------------------------
diff --git a/job/src/test/java/com/kylinolap/job/hadoop/hbase/CreateHTableTest.java b/job/src/test/java/com/kylinolap/job/hadoop/hbase/CreateHTableTest.java
new file mode 100644
index 0000000..9c0745e
--- /dev/null
+++ b/job/src/test/java/com/kylinolap/job/hadoop/hbase/CreateHTableTest.java
@@ -0,0 +1,63 @@
+/*
+ * 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.job.hadoop.hbase;
+
+import static org.junit.Assert.*;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.Path;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import com.kylinolap.common.util.LocalFileMetadataTestCase;
+
+/**
+ * @author George Song (ysong1)
+ * 
+ */
+public class CreateHTableTest extends LocalFileMetadataTestCase {
+
+    private Configuration conf;
+
+    @Before
+    public void setup() throws Exception {
+        conf = new Configuration();
+        conf.set("fs.default.name", "file:///");
+        conf.set("mapred.job.tracker", "local");
+        this.createTestMetadata();
+
+    }
+
+    @After
+    public void after() throws Exception {
+        this.cleanupTestMetadata();
+    }
+
+    @Test
+    public void testGetSplits() throws IllegalArgumentException, Exception {
+        CreateHTableJob c = new CreateHTableJob();
+
+        String input = "src/test/resources/partition_list/part-r-00000";
+
+        byte[][] splits = c.getSplits(conf, new Path(input));
+
+        assertEquals(497, splits.length);
+        assertArrayEquals(new byte[] { 0, 0, 0, 0, 0, 0, 15, -1, 11, 51, -45, 2 }, splits[0]);
+        assertArrayEquals(new byte[] { 0, 0, 0, 0, 0, 3, -1, -1, -54, -61, 109, -44, 1 }, splits[496]);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/4b631f92/job/src/test/java/com/kylinolap/job/hadoop/hbase/TestHbaseClient.java
----------------------------------------------------------------------
diff --git a/job/src/test/java/com/kylinolap/job/hadoop/hbase/TestHbaseClient.java b/job/src/test/java/com/kylinolap/job/hadoop/hbase/TestHbaseClient.java
new file mode 100644
index 0000000..416d44f
--- /dev/null
+++ b/job/src/test/java/com/kylinolap/job/hadoop/hbase/TestHbaseClient.java
@@ -0,0 +1,84 @@
+package com.kylinolap.job.hadoop.hbase;
+
+import java.io.IOException;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hbase.HBaseConfiguration;
+import org.apache.hadoop.hbase.client.HTable;
+import org.apache.hadoop.hbase.client.Put;
+import org.apache.hadoop.hbase.util.Bytes;
+
+/**
+ * Created by hongbin on 5/15/14.
+ */
+public class TestHbaseClient {
+
+    private static boolean reverse = false;
+
+    public static void foo(int n, int k) {
+        int t = k;
+        if (n - k < k) {
+            t = n - k;
+            reverse = true;
+        }
+        boolean[] flags = new boolean[n];
+        inner(flags, 0, t);
+    }
+
+    private static void print(boolean[] flags) {
+        for (int i = 0; i < flags.length; i++) {
+            if (!reverse) {
+                if (flags[i])
+                    System.out.print("0");
+                else
+                    System.out.print("1");
+            } else {
+                if (flags[i])
+                    System.out.print("1");
+                else
+                    System.out.print("0");
+
+            }
+        }
+        System.out.println();
+
+    }
+
+    private static void inner(boolean[] flags, int start, int remaining) {
+        if (remaining <= 0) {
+            print(flags);
+            return;
+        }
+
+        if (flags.length - start < remaining) {
+            return;
+        }
+
+        // write at flags[start]
+        flags[start] = true;
+        inner(flags, start + 1, remaining - 1);
+
+        // not write at flags[start]
+        flags[start] = false;
+        inner(flags, start + 1, remaining);
+    }
+
+    public static void main(String[] args) throws IOException {
+        foo(6, 5);
+        foo(5, 2);
+        foo(3, 0);
+
+        Configuration conf = HBaseConfiguration.create();
+        conf.set("hbase.zookeeper.quorum", "yadesk00.corp.ebay.com");
+        conf.set("zookeeper.znode.parent", "/hbase-unsecure");
+
+        HTable table = new HTable(conf, "test1");
+        Put put = new Put(Bytes.toBytes("row1"));
+
+        put.add(Bytes.toBytes("colfam1"), Bytes.toBytes("qual1"), Bytes.toBytes("val1"));
+        put.add(Bytes.toBytes("colfam1"), Bytes.toBytes("qual2"), Bytes.toBytes("val2"));
+
+        table.put(put);
+        table.close();
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/4b631f92/job/src/test/java/com/kylinolap/job/hadoop/hdfs/HdfsOpsTest.java
----------------------------------------------------------------------
diff --git a/job/src/test/java/com/kylinolap/job/hadoop/hdfs/HdfsOpsTest.java b/job/src/test/java/com/kylinolap/job/hadoop/hdfs/HdfsOpsTest.java
new file mode 100644
index 0000000..030a91e
--- /dev/null
+++ b/job/src/test/java/com/kylinolap/job/hadoop/hdfs/HdfsOpsTest.java
@@ -0,0 +1,50 @@
+package com.kylinolap.job.hadoop.hdfs;
+
+import java.io.IOException;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.FSDataOutputStream;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.Path;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import com.kylinolap.common.KylinConfig;
+import com.kylinolap.common.util.LocalFileMetadataTestCase;
+
+/**
+ * Created by honma on 8/20/14.
+ */
+public class HdfsOpsTest extends LocalFileMetadataTestCase {
+
+    FileSystem fileSystem;
+
+    @Before
+    public void setup() throws Exception {
+
+        this.createTestMetadata();
+
+        Configuration hconf = new Configuration();
+
+        fileSystem = FileSystem.get(hconf);
+    }
+
+    @Test
+    public void TestPath() throws IOException {
+        String hdfsWorkingDirectory = KylinConfig.getInstanceFromEnv().getHdfsWorkingDirectory();
+        Path coprocessorDir = new Path(hdfsWorkingDirectory, "test");
+        fileSystem.mkdirs(coprocessorDir);
+
+        Path newFile = new Path(coprocessorDir, "test_file");
+        newFile = newFile.makeQualified(fileSystem.getUri(), null);
+        FSDataOutputStream stream = fileSystem.create(newFile);
+        stream.write(new byte[] { 0, 1, 2 });
+        stream.close();
+    }
+
+    @After
+    public void after() throws Exception {
+        this.cleanupTestMetadata();
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/4b631f92/job/src/test/java/com/kylinolap/job/hadoop/hive/JoinedFlatTableTest.java
----------------------------------------------------------------------
diff --git a/job/src/test/java/com/kylinolap/job/hadoop/hive/JoinedFlatTableTest.java b/job/src/test/java/com/kylinolap/job/hadoop/hive/JoinedFlatTableTest.java
new file mode 100644
index 0000000..2b44aed
--- /dev/null
+++ b/job/src/test/java/com/kylinolap/job/hadoop/hive/JoinedFlatTableTest.java
@@ -0,0 +1,81 @@
+/*
+ * 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.job.hadoop.hive;
+
+import static org.junit.Assert.*;
+
+import java.io.IOException;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import com.kylinolap.common.KylinConfig;
+import com.kylinolap.common.util.LocalFileMetadataTestCase;
+import com.kylinolap.cube.CubeInstance;
+import com.kylinolap.cube.CubeManager;
+import com.kylinolap.cube.CubeSegment;
+import com.kylinolap.job.JoinedFlatTable;
+import com.kylinolap.job.engine.JobEngineConfig;
+
+/**
+ * @author George Song (ysong1)
+ * 
+ */
+public class JoinedFlatTableTest extends LocalFileMetadataTestCase {
+
+    CubeInstance cube = null;
+    JoinedFlatTableDesc intermediateTableDesc = null;
+    String fakeJobUUID = "abc-def";
+    CubeSegment cubeSegment = null;
+
+    @Before
+    public void setUp() throws Exception {
+        this.createTestMetadata();
+        cube = CubeManager.getInstance(this.getTestConfig()).getCube("test_kylin_cube_with_slr_ready");
+        cubeSegment = cube.getSegments().get(0);
+        intermediateTableDesc = new JoinedFlatTableDesc(cube.getDescriptor(), cubeSegment);
+    }
+
+    @After
+    public void after() throws Exception {
+        this.cleanupTestMetadata();
+    }
+
+    @Test
+    public void testGenCreateTableDDL() {
+        String ddl = JoinedFlatTable.generateCreateTableStatement(intermediateTableDesc, "/tmp", fakeJobUUID);
+        System.out.println(ddl);
+        assertEquals(513, ddl.length());
+    }
+
+    @Test
+    public void testGenDropTableDDL() {
+        String ddl = JoinedFlatTable.generateDropTableStatement(intermediateTableDesc, fakeJobUUID);
+        System.out.println(ddl);
+        assertEquals(108, ddl.length());
+    }
+
+    @Test
+    public void testGenerateInsertSql() throws IOException {
+        String sql = JoinedFlatTable.generateInsertDataStatement(intermediateTableDesc, fakeJobUUID, new JobEngineConfig(KylinConfig.getInstanceFromEnv()));
+        System.out.println(sql);
+
+        assertEquals(1239, sql.length());
+    }
+
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/4b631f92/job/src/test/java/com/kylinolap/job/tools/ColumnCardinalityJobTest.java
----------------------------------------------------------------------
diff --git a/job/src/test/java/com/kylinolap/job/tools/ColumnCardinalityJobTest.java b/job/src/test/java/com/kylinolap/job/tools/ColumnCardinalityJobTest.java
new file mode 100644
index 0000000..258870b
--- /dev/null
+++ b/job/src/test/java/com/kylinolap/job/tools/ColumnCardinalityJobTest.java
@@ -0,0 +1,60 @@
+/*
+ * 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.job.tools;
+
+import static org.junit.Assert.*;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.FileUtil;
+import org.apache.hadoop.util.ToolRunner;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+
+import com.kylinolap.job.hadoop.cardinality.HiveColumnCardinalityJob;
+
+/**
+ * @author ysong1
+ * 
+ */
+public class ColumnCardinalityJobTest {
+
+    private Configuration conf;
+
+    @Before
+    public void setup() throws IOException {
+        conf = new Configuration();
+        conf.set("fs.default.name", "file:///");
+        conf.set("mapred.job.tracker", "local");
+    }
+
+    @Test
+    @Ignore
+    public void testJob() throws Exception {
+        final String input = "src/test/resources/data/test_cal_dt/";
+        final String output = "target/test-output/column-cardinality/";
+
+        FileUtil.fullyDelete(new File(output));
+
+        String[] args = { "-input", input, "-output", output, "-cols", "1,2,3,4,5,6,9,0" };
+        assertEquals("Job failed", 0, ToolRunner.run(new HiveColumnCardinalityJob(), args));
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/4b631f92/job/src/test/java/com/kylinolap/job/tools/ColumnCardinalityMapperTest.java
----------------------------------------------------------------------
diff --git a/job/src/test/java/com/kylinolap/job/tools/ColumnCardinalityMapperTest.java b/job/src/test/java/com/kylinolap/job/tools/ColumnCardinalityMapperTest.java
new file mode 100644
index 0000000..728c3e4
--- /dev/null
+++ b/job/src/test/java/com/kylinolap/job/tools/ColumnCardinalityMapperTest.java
@@ -0,0 +1,125 @@
+/*
+ * 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.job.tools;
+
+import static org.junit.Assert.*;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.util.List;
+
+import org.apache.hadoop.io.BytesWritable;
+import org.apache.hadoop.io.IntWritable;
+import org.apache.hadoop.io.LongWritable;
+import org.apache.hadoop.io.Text;
+import org.apache.hadoop.mrunit.mapreduce.MapDriver;
+import org.apache.hadoop.mrunit.types.Pair;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+
+import com.kylinolap.common.hll.HyperLogLogPlusCounter;
+import com.kylinolap.job.hadoop.cardinality.ColumnCardinalityMapper;
+import com.kylinolap.job.hadoop.cardinality.HiveColumnCardinalityJob;
+
+/**
+ * @author ysong1
+ * 
+ */
+public class ColumnCardinalityMapperTest {
+
+    @SuppressWarnings("rawtypes")
+    MapDriver mapDriver;
+    String localTempDir = System.getProperty("java.io.tmpdir") + File.separator;
+
+    @SuppressWarnings({ "rawtypes", "unchecked" })
+    @Before
+    public void setUp() {
+        ColumnCardinalityMapper mapper = new ColumnCardinalityMapper();
+        mapDriver = MapDriver.newMapDriver(mapper);
+    }
+
+    public final static String strArr = "abc,tests,test,test,as,sts,test,tss,sets";
+
+    @SuppressWarnings({ "unchecked" })
+    @Test
+    @Ignore
+    public void testMapperOn177() throws IOException {
+        mapDriver.clearInput();
+        File file = new File("src/test/resources/data/test_cal_dt/part-r-00000");
+        FileReader reader = new FileReader(file);
+        BufferedReader breader = new BufferedReader(reader);
+        String s = breader.readLine();
+        int i = 0;
+        while (s != null) {
+            LongWritable inputKey = new LongWritable(i++);
+            mapDriver.addInput(inputKey, new Text(s));
+            s = breader.readLine();
+        }
+        // breader.close();
+        mapDriver.getConfiguration().set(HiveColumnCardinalityJob.KEY_INPUT_DELIM, "\20");
+        List<Pair<IntWritable, BytesWritable>> result = mapDriver.run();
+        breader.close();
+        assertEquals(9, result.size());
+
+        int key1 = result.get(0).getFirst().get();
+        BytesWritable value1 = result.get(0).getSecond();
+        byte[] bytes = value1.getBytes();
+        HyperLogLogPlusCounter hllc = new HyperLogLogPlusCounter();
+        hllc.readRegisters(ByteBuffer.wrap(bytes));
+        assertTrue(key1 > 0);
+        assertEquals(8, hllc.getCountEstimate());
+    }
+
+    @SuppressWarnings("unchecked")
+    @Test
+    public void testMapperOnComma() throws IOException {
+        mapDriver.clearInput();
+        LongWritable inputKey1 = new LongWritable(1);
+        LongWritable inputKey2 = new LongWritable(2);
+        LongWritable inputKey3 = new LongWritable(3);
+        LongWritable inputKey4 = new LongWritable(4);
+        LongWritable inputKey5 = new LongWritable(5);
+        LongWritable inputKey6 = new LongWritable(6);
+        LongWritable inputKey7 = new LongWritable(7);
+
+        mapDriver.addInput(inputKey1, new Text());
+        mapDriver.addInput(inputKey2, new Text(strArr));
+        mapDriver.addInput(inputKey3, new Text(strArr));
+        mapDriver.addInput(inputKey4, new Text(strArr));
+        mapDriver.addInput(inputKey5, new Text(strArr));
+        mapDriver.addInput(inputKey6, new Text(strArr));
+        mapDriver.addInput(inputKey7, new Text(strArr));
+
+        List<Pair<IntWritable, BytesWritable>> result = mapDriver.run();
+
+        assertEquals(9, result.size());
+
+        int key1 = result.get(0).getFirst().get();
+        BytesWritable value1 = result.get(0).getSecond();
+        byte[] bytes = value1.getBytes();
+        HyperLogLogPlusCounter hllc = new HyperLogLogPlusCounter();
+        hllc.readRegisters(ByteBuffer.wrap(bytes));
+        System.out.println("ab\177ab".length());
+        assertTrue(key1 > 0);
+        assertEquals(1, hllc.getCountEstimate());
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/4b631f92/job/src/test/java/com/kylinolap/job/tools/ColumnCardinalityReducerTest.java
----------------------------------------------------------------------
diff --git a/job/src/test/java/com/kylinolap/job/tools/ColumnCardinalityReducerTest.java b/job/src/test/java/com/kylinolap/job/tools/ColumnCardinalityReducerTest.java
new file mode 100644
index 0000000..e6efa0c
--- /dev/null
+++ b/job/src/test/java/com/kylinolap/job/tools/ColumnCardinalityReducerTest.java
@@ -0,0 +1,111 @@
+/*
+ * 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.job.tools;
+
+import static org.junit.Assert.*;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.StringTokenizer;
+
+import org.apache.hadoop.hbase.util.Bytes;
+import org.apache.hadoop.io.BytesWritable;
+import org.apache.hadoop.io.IntWritable;
+import org.apache.hadoop.io.LongWritable;
+import org.apache.hadoop.mrunit.mapreduce.ReduceDriver;
+import org.apache.hadoop.mrunit.types.Pair;
+import org.junit.Before;
+import org.junit.Test;
+
+import com.kylinolap.common.hll.HyperLogLogPlusCounter;
+import com.kylinolap.cube.kv.RowConstants;
+import com.kylinolap.job.hadoop.cardinality.ColumnCardinalityMapper;
+import com.kylinolap.job.hadoop.cardinality.ColumnCardinalityReducer;
+
+/**
+ * @author ysong1
+ * 
+ */
+public class ColumnCardinalityReducerTest {
+
+    ReduceDriver<IntWritable, BytesWritable, IntWritable, LongWritable> reduceDriver;
+    String localTempDir = System.getProperty("java.io.tmpdir") + File.separator;
+
+    @Before
+    public void setUp() {
+        ColumnCardinalityReducer reducer = new ColumnCardinalityReducer();
+        reduceDriver = ReduceDriver.newReduceDriver(reducer);
+    }
+
+    private byte[] getBytes(String str) throws IOException {
+        HyperLogLogPlusCounter hllc = new HyperLogLogPlusCounter();
+        StringTokenizer tokenizer = new StringTokenizer(str, ColumnCardinalityMapper.DEFAULT_DELIM);
+        int i = 0;
+        while (tokenizer.hasMoreTokens()) {
+            String temp = i + "_" + tokenizer.nextToken();
+            i++;
+            hllc.add(Bytes.toBytes(temp));
+        }
+        ByteBuffer buf = ByteBuffer.allocate(RowConstants.ROWVALUE_BUFFER_SIZE);
+        buf.clear();
+        hllc.writeRegisters(buf);
+        buf.flip();
+        return buf.array();
+    }
+
+    @Test
+    public void testReducer() throws IOException {
+        IntWritable key1 = new IntWritable(1);
+        List<BytesWritable> values1 = new ArrayList<BytesWritable>();
+        values1.add(new BytesWritable(getBytes(ColumnCardinalityMapperTest.strArr)));
+
+        IntWritable key2 = new IntWritable(2);
+        List<BytesWritable> values2 = new ArrayList<BytesWritable>();
+        values2.add(new BytesWritable(getBytes(ColumnCardinalityMapperTest.strArr + " x")));
+
+        IntWritable key3 = new IntWritable(3);
+        List<BytesWritable> values3 = new ArrayList<BytesWritable>();
+        values3.add(new BytesWritable(getBytes(ColumnCardinalityMapperTest.strArr + " xx")));
+
+        IntWritable key4 = new IntWritable(4);
+        List<BytesWritable> values4 = new ArrayList<BytesWritable>();
+        values4.add(new BytesWritable(getBytes(ColumnCardinalityMapperTest.strArr + " xxx")));
+
+        IntWritable key5 = new IntWritable(5);
+        List<BytesWritable> values5 = new ArrayList<BytesWritable>();
+        values5.add(new BytesWritable(getBytes(ColumnCardinalityMapperTest.strArr + " xxxx")));
+
+        reduceDriver.withInput(key1, values1);
+        reduceDriver.withInput(key2, values2);
+        reduceDriver.withInput(key3, values3);
+        reduceDriver.withInput(key4, values4);
+        reduceDriver.withInput(key5, values5);
+
+        List<Pair<IntWritable, LongWritable>> result = reduceDriver.run();
+
+        assertEquals(5, result.size());
+
+        int outputKey1 = result.get(0).getFirst().get();
+        LongWritable value1 = result.get(0).getSecond();
+        assertTrue(outputKey1 == 1);
+        assertTrue((10 == value1.get()) || (9 == value1.get()));
+
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/4b631f92/job/src/test/java/com/kylinolap/job/tools/CubeMigrationTests.java
----------------------------------------------------------------------
diff --git a/job/src/test/java/com/kylinolap/job/tools/CubeMigrationTests.java b/job/src/test/java/com/kylinolap/job/tools/CubeMigrationTests.java
new file mode 100644
index 0000000..d3c804e
--- /dev/null
+++ b/job/src/test/java/com/kylinolap/job/tools/CubeMigrationTests.java
@@ -0,0 +1,40 @@
+package com.kylinolap.job.tools;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.codehaus.jettison.json.JSONException;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+
+import com.kylinolap.common.util.AbstractKylinTestCase;
+import com.kylinolap.common.util.ClasspathUtil;
+import com.kylinolap.common.util.LocalFileMetadataTestCase;
+
+/**
+ * Created by honma on 9/17/14.
+ */
+@Ignore
+public class CubeMigrationTests extends LocalFileMetadataTestCase {
+    @Before
+    public void setup() throws Exception {
+        super.createTestMetadata();
+        ClasspathUtil.addClasspath(new File(AbstractKylinTestCase.SANDBOX_TEST_DATA).getAbsolutePath());
+    }
+
+    @After
+    public void clean() {
+        this.cleanupTestMetadata();
+    }
+
+    @Test
+    public void testMigrate() throws IOException, JSONException, InterruptedException {
+
+        // CubeMigrationCLI.moveCube(KylinConfig.getInstanceFromEnv(),
+        // KylinConfig.getInstanceFromEnv(),
+        // "test_kylin_cube_with_slr_empty", "migration", "true", "false");
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/4b631f92/job/src/test/resources/data/6d_cuboid/part-r-00000
----------------------------------------------------------------------
diff --git a/job/src/test/resources/data/6d_cuboid/part-r-00000 b/job/src/test/resources/data/6d_cuboid/part-r-00000
new file mode 100644
index 0000000..b41ba18
Binary files /dev/null and b/job/src/test/resources/data/6d_cuboid/part-r-00000 differ

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/4b631f92/job/src/test/resources/data/base_cuboid/part-r-00000
----------------------------------------------------------------------
diff --git a/job/src/test/resources/data/base_cuboid/part-r-00000 b/job/src/test/resources/data/base_cuboid/part-r-00000
new file mode 100644
index 0000000..1a011a4
Binary files /dev/null and b/job/src/test/resources/data/base_cuboid/part-r-00000 differ

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/4b631f92/job/src/test/resources/data/flat_table/000000_0
----------------------------------------------------------------------
diff --git a/job/src/test/resources/data/flat_table/000000_0 b/job/src/test/resources/data/flat_table/000000_0
new file mode 100644
index 0000000..058c92a
Binary files /dev/null and b/job/src/test/resources/data/flat_table/000000_0 differ