You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kylin.apache.org by nj...@apache.org on 2016/08/29 01:37:28 UTC
[2/2] kylin git commit: KYLIN-1702: change the layout path of table
snapshot with tablename
KYLIN-1702: change the layout path of table snapshot with tablename
Project: http://git-wip-us.apache.org/repos/asf/kylin/repo
Commit: http://git-wip-us.apache.org/repos/asf/kylin/commit/7815224d
Tree: http://git-wip-us.apache.org/repos/asf/kylin/tree/7815224d
Diff: http://git-wip-us.apache.org/repos/asf/kylin/diff/7815224d
Branch: refs/heads/master
Commit: 7815224da90f81a752ceb3591370ebe39d2a45d1
Parents: ae9d747
Author: Zhong <ya...@lm-shc-16501214.corp.ebay.com>
Authored: Tue Aug 16 16:11:18 2016 +0800
Committer: Zhong <nj...@apache.org>
Committed: Mon Aug 29 09:35:50 2016 +0800
----------------------------------------------------------------------
.../apache/kylin/dict/lookup/SnapshotManager.java | 4 ++--
.../org/apache/kylin/dict/lookup/SnapshotTable.java | 16 ++++++++++++++--
2 files changed, 16 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/kylin/blob/7815224d/core-dictionary/src/main/java/org/apache/kylin/dict/lookup/SnapshotManager.java
----------------------------------------------------------------------
diff --git a/core-dictionary/src/main/java/org/apache/kylin/dict/lookup/SnapshotManager.java b/core-dictionary/src/main/java/org/apache/kylin/dict/lookup/SnapshotManager.java
index c7b0d26..b15847b 100644
--- a/core-dictionary/src/main/java/org/apache/kylin/dict/lookup/SnapshotManager.java
+++ b/core-dictionary/src/main/java/org/apache/kylin/dict/lookup/SnapshotManager.java
@@ -115,7 +115,7 @@ public class SnapshotManager {
}
public SnapshotTable buildSnapshot(ReadableTable table, TableDesc tableDesc) throws IOException {
- SnapshotTable snapshot = new SnapshotTable(table);
+ SnapshotTable snapshot = new SnapshotTable(table, tableDesc.getName());
snapshot.updateRandomUuid();
String dup = checkDupByInfo(snapshot);
@@ -135,7 +135,7 @@ public class SnapshotManager {
}
public SnapshotTable rebuildSnapshot(ReadableTable table, TableDesc tableDesc, String overwriteUUID) throws IOException {
- SnapshotTable snapshot = new SnapshotTable(table);
+ SnapshotTable snapshot = new SnapshotTable(table, tableDesc.getName());
snapshot.setUuid(overwriteUUID);
snapshot.takeSnapshot(table, tableDesc);
http://git-wip-us.apache.org/repos/asf/kylin/blob/7815224d/core-dictionary/src/main/java/org/apache/kylin/dict/lookup/SnapshotTable.java
----------------------------------------------------------------------
diff --git a/core-dictionary/src/main/java/org/apache/kylin/dict/lookup/SnapshotTable.java b/core-dictionary/src/main/java/org/apache/kylin/dict/lookup/SnapshotTable.java
index b2306b2..1aea124 100644
--- a/core-dictionary/src/main/java/org/apache/kylin/dict/lookup/SnapshotTable.java
+++ b/core-dictionary/src/main/java/org/apache/kylin/dict/lookup/SnapshotTable.java
@@ -27,6 +27,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
+import com.google.common.base.Strings;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.ArrayUtils;
import org.apache.kylin.common.persistence.ResourceStore;
@@ -49,6 +50,8 @@ import com.fasterxml.jackson.annotation.JsonProperty;
@JsonAutoDetect(fieldVisibility = Visibility.NONE, getterVisibility = Visibility.NONE, isGetterVisibility = Visibility.NONE, setterVisibility = Visibility.NONE)
public class SnapshotTable extends RootPersistentEntity implements ReadableTable {
+ @JsonProperty("tableName")
+ private String tableName;
@JsonProperty("signature")
private TableSignature signature;
@JsonProperty("useDictionary")
@@ -61,7 +64,8 @@ public class SnapshotTable extends RootPersistentEntity implements ReadableTable
public SnapshotTable() {
}
- SnapshotTable(ReadableTable table) throws IOException {
+ SnapshotTable(ReadableTable table, String tableName) throws IOException {
+ this.tableName = tableName;
this.signature = table.getSignature();
this.useDictionary = true;
}
@@ -111,10 +115,18 @@ public class SnapshotTable extends RootPersistentEntity implements ReadableTable
}
public String getResourcePath() {
- return ResourceStore.SNAPSHOT_RESOURCE_ROOT + "/" + new File(signature.getPath()).getName() + "/" + uuid + ".snapshot";
+ return getResourceDir() + "/" + uuid + ".snapshot";
}
public String getResourceDir() {
+ if (Strings.isNullOrEmpty(tableName)) {
+ return getOldResourceDir();
+ } else {
+ return ResourceStore.SNAPSHOT_RESOURCE_ROOT + "/" + tableName;
+ }
+ }
+
+ private String getOldResourceDir() {
return ResourceStore.SNAPSHOT_RESOURCE_ROOT + "/" + new File(signature.getPath()).getName();
}