You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kylin.apache.org by ma...@apache.org on 2015/08/12 04:17:27 UTC
[3/3] incubator-kylin git commit: move export hbase to
BuildCubeWithStreamTest(the last step)
move export hbase to BuildCubeWithStreamTest(the last step)
Project: http://git-wip-us.apache.org/repos/asf/incubator-kylin/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-kylin/commit/65817fa6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-kylin/tree/65817fa6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-kylin/diff/65817fa6
Branch: refs/heads/0.8
Commit: 65817fa60dcca3c3d4a7ec98b16f07c9e2a52732
Parents: 05947f3
Author: honma <ho...@ebay.com>
Authored: Tue Aug 11 15:26:34 2015 +0800
Committer: honma <ho...@ebay.com>
Committed: Wed Aug 12 10:18:18 2015 +0800
----------------------------------------------------------------------
.../kylin/job/BuildCubeWithStreamTest.java | 27 +++++++++++++++
.../apache/kylin/job/BuildIIWithStreamTest.java | 35 ++------------------
2 files changed, 30 insertions(+), 32 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/65817fa6/job/src/test/java/org/apache/kylin/job/BuildCubeWithStreamTest.java
----------------------------------------------------------------------
diff --git a/job/src/test/java/org/apache/kylin/job/BuildCubeWithStreamTest.java b/job/src/test/java/org/apache/kylin/job/BuildCubeWithStreamTest.java
index 6a29bb8..8330528 100644
--- a/job/src/test/java/org/apache/kylin/job/BuildCubeWithStreamTest.java
+++ b/job/src/test/java/org/apache/kylin/job/BuildCubeWithStreamTest.java
@@ -34,16 +34,19 @@
package org.apache.kylin.job;
+import org.apache.hadoop.util.ToolRunner;
import org.apache.kylin.common.KylinConfig;
import org.apache.kylin.common.util.AbstractKylinTestCase;
import org.apache.kylin.common.util.ClassUtil;
import org.apache.kylin.common.util.DateFormat;
+import org.apache.kylin.job.hadoop.cube.StorageCleanupJob;
import org.apache.kylin.job.streaming.BootstrapConfig;
import org.apache.kylin.job.streaming.StreamingBootstrap;
import org.apache.kylin.storage.hbase.HBaseMetadataTestCase;
import org.apache.kylin.streaming.StreamingConfig;
import org.apache.kylin.streaming.StreamingManager;
import org.junit.After;
+import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -51,6 +54,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
+import java.io.IOException;
import java.util.UUID;
/**
@@ -94,6 +98,29 @@ public class BuildCubeWithStreamTest {
HBaseMetadataTestCase.staticCleanupTestMetadata();
}
+ @AfterClass
+ public static void afterClass() throws Exception {
+ backup();
+ }
+
+ private static int cleanupOldStorage() throws Exception {
+ String[] args = { "--delete", "true" };
+ int exitCode = ToolRunner.run(new StorageCleanupJob(), args);
+ return exitCode;
+ }
+
+ private static void backup() throws Exception {
+ int exitCode = cleanupOldStorage();
+ if (exitCode == 0) {
+ exportHBaseData();
+ }
+ }
+
+ private static void exportHBaseData() throws IOException {
+ ExportHBaseData export = new ExportHBaseData();
+ export.exportTables();
+ }
+
@Test
public void test() throws Exception {
for (long start = startTime; start < endTime; start += batchInterval) {
http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/65817fa6/job/src/test/java/org/apache/kylin/job/BuildIIWithStreamTest.java
----------------------------------------------------------------------
diff --git a/job/src/test/java/org/apache/kylin/job/BuildIIWithStreamTest.java b/job/src/test/java/org/apache/kylin/job/BuildIIWithStreamTest.java
index 071ae3a..8357e1b 100644
--- a/job/src/test/java/org/apache/kylin/job/BuildIIWithStreamTest.java
+++ b/job/src/test/java/org/apache/kylin/job/BuildIIWithStreamTest.java
@@ -34,7 +34,7 @@
package org.apache.kylin.job;
-import static org.junit.Assert.*;
+import static org.junit.Assert.fail;
import java.io.File;
import java.io.IOException;
@@ -63,7 +63,6 @@ import org.apache.kylin.invertedindex.model.IIJoinedFlatTableDesc;
import org.apache.kylin.job.common.ShellExecutable;
import org.apache.kylin.job.constant.ExecutableConstants;
import org.apache.kylin.job.engine.JobEngineConfig;
-import org.apache.kylin.job.hadoop.cube.StorageCleanupJob;
import org.apache.kylin.job.hadoop.invertedindex.IICreateHTableJob;
import org.apache.kylin.metadata.model.TblColRef;
import org.apache.kylin.metadata.realization.RealizationStatusEnum;
@@ -72,7 +71,6 @@ import org.apache.kylin.storage.hbase.HBaseMetadataTestCase;
import org.apache.kylin.streaming.StreamBuilder;
import org.apache.kylin.streaming.StreamMessage;
import org.apache.kylin.streaming.invertedindex.IIStreamConsumer;
-import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -116,29 +114,6 @@ public class BuildIIWithStreamTest {
}
}
- @AfterClass
- public static void afterClass() throws Exception {
- backup();
- }
-
- private static int cleanupOldStorage() throws Exception {
- String[] args = { "--delete", "true" };
- int exitCode = ToolRunner.run(new StorageCleanupJob(), args);
- return exitCode;
- }
-
- private static void backup() throws Exception {
- int exitCode = cleanupOldStorage();
- if (exitCode == 0) {
- exportHBaseData();
- }
- }
-
- private static void exportHBaseData() throws IOException {
- ExportHBaseData export = new ExportHBaseData();
- export.exportTables();
- }
-
private String createIntermediateTable(IIDesc desc, KylinConfig kylinConfig) throws IOException {
IIJoinedFlatTableDesc intermediateTableDesc = new IIJoinedFlatTableDesc(desc);
JobEngineConfig jobEngineConfig = new JobEngineConfig(kylinConfig);
@@ -196,7 +171,7 @@ public class BuildIIWithStreamTest {
final IIDesc desc = iiManager.getII(iiName).getDescriptor();
final String tableName = createIntermediateTable(desc, kylinConfig);
logger.info("intermediate table name:" + tableName);
-
+
HiveTableReader reader = new HiveTableReader("default", tableName);
final List<TblColRef> tblColRefs = desc.listAllColumns();
for (TblColRef tblColRef : tblColRefs) {
@@ -212,11 +187,7 @@ public class BuildIIWithStreamTest {
ToolRunner.run(new IICreateHTableJob(), args);
ExecutorService executorService = Executors.newSingleThreadExecutor();
- final StreamBuilder streamBuilder = StreamBuilder.newLimitedSizeStreamBuilder(iiName,
- queue,
- new IIStreamConsumer(iiName, segment.getStorageLocationIdentifier(), segment.getIIDesc(), 0),
- 0,
- segment.getIIDesc().getSliceSize());
+ final StreamBuilder streamBuilder = StreamBuilder.newLimitedSizeStreamBuilder(iiName, queue, new IIStreamConsumer(iiName, segment.getStorageLocationIdentifier(), segment.getIIDesc(), 0), 0, segment.getIIDesc().getSliceSize());
List<String[]> sorted = getSortedRows(reader, desc.getTimestampColumn());
int count = sorted.size();