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 2016/06/22 06:03:25 UTC
[2/3] kylin git commit: refactor: remove FuzzyKeyGTRecord
refactor: remove FuzzyKeyGTRecord
Project: http://git-wip-us.apache.org/repos/asf/kylin/repo
Commit: http://git-wip-us.apache.org/repos/asf/kylin/commit/ea244504
Tree: http://git-wip-us.apache.org/repos/asf/kylin/tree/ea244504
Diff: http://git-wip-us.apache.org/repos/asf/kylin/diff/ea244504
Branch: refs/heads/master
Commit: ea244504e5fa66ef14923f6665bbdbafcd8c28e2
Parents: 64b5f86
Author: Hongbin Ma <ma...@apache.org>
Authored: Tue Jun 21 14:56:50 2016 +0800
Committer: Hongbin Ma <ma...@apache.org>
Committed: Wed Jun 22 14:00:15 2016 +0800
----------------------------------------------------------------------
.../kylin/gridtable/FuzzyKeyGTRecord.java | 37 --------------------
.../org/apache/kylin/gridtable/GTScanRange.java | 12 +++----
.../kylin/gridtable/GTScanRangePlanner.java | 18 +++++-----
.../apache/kylin/gridtable/GTScanRequest.java | 18 +++-------
.../storage/hbase/cube/v2/CubeHBaseRPC.java | 7 ++--
5 files changed, 22 insertions(+), 70 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/kylin/blob/ea244504/core-cube/src/main/java/org/apache/kylin/gridtable/FuzzyKeyGTRecord.java
----------------------------------------------------------------------
diff --git a/core-cube/src/main/java/org/apache/kylin/gridtable/FuzzyKeyGTRecord.java b/core-cube/src/main/java/org/apache/kylin/gridtable/FuzzyKeyGTRecord.java
deleted file mode 100644
index acffb4d..0000000
--- a/core-cube/src/main/java/org/apache/kylin/gridtable/FuzzyKeyGTRecord.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.kylin.gridtable;
-
-import org.apache.kylin.common.util.ByteArray;
-import org.apache.kylin.common.util.ImmutableBitSet;
-
-public class FuzzyKeyGTRecord extends GTRecord {
- final ImmutableBitSet maskForEqualHashComp;
-
- public FuzzyKeyGTRecord(GTInfo info, ByteArray[] cols, ImmutableBitSet maskForEqualHashComp) {
- super(info, cols);
- this.maskForEqualHashComp = maskForEqualHashComp;
- }
-
- public FuzzyKeyGTRecord(GTInfo info,ImmutableBitSet maskForEqualHashComp)
- {
- super(info);
- this.maskForEqualHashComp = maskForEqualHashComp;
- }
-}
http://git-wip-us.apache.org/repos/asf/kylin/blob/ea244504/core-cube/src/main/java/org/apache/kylin/gridtable/GTScanRange.java
----------------------------------------------------------------------
diff --git a/core-cube/src/main/java/org/apache/kylin/gridtable/GTScanRange.java b/core-cube/src/main/java/org/apache/kylin/gridtable/GTScanRange.java
index 433626e..0cffcd9 100644
--- a/core-cube/src/main/java/org/apache/kylin/gridtable/GTScanRange.java
+++ b/core-cube/src/main/java/org/apache/kylin/gridtable/GTScanRange.java
@@ -27,25 +27,25 @@ public class GTScanRange {
final public GTRecord pkStart; // inclusive, record must not be null, col[pk].array() can be null to mean unbounded
final public GTRecord pkEnd; // inclusive, record must not be null, col[pk].array() can be null to mean unbounded
- final public List<FuzzyKeyGTRecord> fuzzyKeys; // partial matching primary keys
+ final public List<GTRecord> fuzzyKeys; // partial matching primary keys
public GTScanRange(GTRecord pkStart, GTRecord pkEnd) {
this(pkStart, pkEnd, null);
}
- public GTScanRange(GTRecord pkStart, GTRecord pkEnd, List<FuzzyKeyGTRecord> fuzzyKeys) {
+ public GTScanRange(GTRecord pkStart, GTRecord pkEnd, List<GTRecord> fuzzyKeys) {
GTInfo info = pkStart.info;
assert info == pkEnd.info;
this.pkStart = pkStart;
this.pkEnd = pkEnd;
- this.fuzzyKeys = fuzzyKeys == null ? Collections.<FuzzyKeyGTRecord> emptyList() : fuzzyKeys;
+ this.fuzzyKeys = fuzzyKeys == null ? Collections.<GTRecord> emptyList() : fuzzyKeys;
}
public GTScanRange replaceGTInfo(final GTInfo gtInfo) {
- List<FuzzyKeyGTRecord> newFuzzyKeys = Lists.newArrayList();
- for (FuzzyKeyGTRecord input : fuzzyKeys) {
- newFuzzyKeys.add(new FuzzyKeyGTRecord(gtInfo, input.cols, input.maskForEqualHashComp));
+ List<GTRecord> newFuzzyKeys = Lists.newArrayList();
+ for (GTRecord input : fuzzyKeys) {
+ newFuzzyKeys.add(new GTRecord(gtInfo, input.cols));
}
return new GTScanRange(new GTRecord(gtInfo, pkStart.cols), //
new GTRecord(gtInfo, pkEnd.cols), //
http://git-wip-us.apache.org/repos/asf/kylin/blob/ea244504/core-cube/src/main/java/org/apache/kylin/gridtable/GTScanRangePlanner.java
----------------------------------------------------------------------
diff --git a/core-cube/src/main/java/org/apache/kylin/gridtable/GTScanRangePlanner.java b/core-cube/src/main/java/org/apache/kylin/gridtable/GTScanRangePlanner.java
index 2d4c2a2..4f641e9 100644
--- a/core-cube/src/main/java/org/apache/kylin/gridtable/GTScanRangePlanner.java
+++ b/core-cube/src/main/java/org/apache/kylin/gridtable/GTScanRangePlanner.java
@@ -305,7 +305,7 @@ public class GTScanRangePlanner {
GTRecord pkEnd = new GTRecord(gtInfo);
Map<Integer, Set<ByteArray>> fuzzyValues = Maps.newHashMap();
- List<FuzzyKeyGTRecord> fuzzyKeys;
+ List<GTRecord> fuzzyKeys;
for (ColumnRange range : andDimRanges) {
if (gtPartitionCol != null && range.column.equals(gtPartitionCol)) {
@@ -337,8 +337,8 @@ public class GTScanRangePlanner {
return new GTScanRange(pkStart, pkEnd, fuzzyKeys);
}
- private List<FuzzyKeyGTRecord> buildFuzzyKeys(Map<Integer, Set<ByteArray>> fuzzyValueSet) {
- ArrayList<FuzzyKeyGTRecord> result = Lists.newArrayList();
+ private List<GTRecord> buildFuzzyKeys(Map<Integer, Set<ByteArray>> fuzzyValueSet) {
+ ArrayList<GTRecord> result = Lists.newArrayList();
if (fuzzyValueSet.isEmpty())
return result;
@@ -353,11 +353,11 @@ public class GTScanRangePlanner {
for (Map<Integer, ByteArray> fuzzyValue : fuzzyValueCombinations) {
- BitSet bitSet = new BitSet(gtInfo.getColumnCount());
- for (Map.Entry<Integer, ByteArray> entry : fuzzyValue.entrySet()) {
- bitSet.set(entry.getKey());
- }
- FuzzyKeyGTRecord fuzzy = new FuzzyKeyGTRecord(gtInfo, new ImmutableBitSet(bitSet));
+// BitSet bitSet = new BitSet(gtInfo.getColumnCount());
+// for (Map.Entry<Integer, ByteArray> entry : fuzzyValue.entrySet()) {
+// bitSet.set(entry.getKey());
+// }
+ GTRecord fuzzy = new GTRecord(gtInfo);
for (Map.Entry<Integer, ByteArray> entry : fuzzyValue.entrySet()) {
fuzzy.set(entry.getKey(), entry.getValue());
}
@@ -514,7 +514,7 @@ public class GTScanRangePlanner {
GTRecord start = first.pkStart;
GTRecord end = first.pkEnd;
- List<FuzzyKeyGTRecord> newFuzzyKeys = new ArrayList<FuzzyKeyGTRecord>();
+ List<GTRecord> newFuzzyKeys = new ArrayList<GTRecord>();
boolean hasNonFuzzyRange = false;
for (GTScanRange range : ranges) {
http://git-wip-us.apache.org/repos/asf/kylin/blob/ea244504/core-cube/src/main/java/org/apache/kylin/gridtable/GTScanRequest.java
----------------------------------------------------------------------
diff --git a/core-cube/src/main/java/org/apache/kylin/gridtable/GTScanRequest.java b/core-cube/src/main/java/org/apache/kylin/gridtable/GTScanRequest.java
index 66c0e87..55d84e6 100644
--- a/core-cube/src/main/java/org/apache/kylin/gridtable/GTScanRequest.java
+++ b/core-cube/src/main/java/org/apache/kylin/gridtable/GTScanRequest.java
@@ -261,8 +261,8 @@ public class GTScanRequest {
serializeGTRecord(range.pkStart, out);
serializeGTRecord(range.pkEnd, out);
BytesUtil.writeVInt(range.fuzzyKeys.size(), out);
- for (FuzzyKeyGTRecord f : range.fuzzyKeys) {
- serializeFuzzyKeyGTRecord(f, out);
+ for (GTRecord f : range.fuzzyKeys) {
+ serializeGTRecord(f, out);
}
}
@@ -285,10 +285,10 @@ public class GTScanRequest {
for (int rangeIdx = 0; rangeIdx < sRangesCount; rangeIdx++) {
GTRecord sPkStart = deserializeGTRecord(in, sInfo);
GTRecord sPkEnd = deserializeGTRecord(in, sInfo);
- List<FuzzyKeyGTRecord> sFuzzyKeys = Lists.newArrayList();
+ List<GTRecord> sFuzzyKeys = Lists.newArrayList();
int sFuzzyKeySize = BytesUtil.readVInt(in);
for (int i = 0; i < sFuzzyKeySize; i++) {
- sFuzzyKeys.add(deserializeFuzzyKeyGTRecord(in, sInfo));
+ sFuzzyKeys.add(deserializeGTRecord(in, sInfo));
}
GTScanRange sRange = new GTScanRange(sPkStart, sPkEnd, sFuzzyKeys);
sRanges.add(sRange);
@@ -322,16 +322,6 @@ public class GTScanRequest {
return new GTRecord(sInfo, sCols);
}
- private void serializeFuzzyKeyGTRecord(FuzzyKeyGTRecord gtRecord, ByteBuffer out) {
- serializeGTRecord(gtRecord,out);
- ImmutableBitSet.serializer.serialize(gtRecord.maskForEqualHashComp, out);
- }
-
- private FuzzyKeyGTRecord deserializeFuzzyKeyGTRecord(ByteBuffer in, GTInfo sInfo) {
- GTRecord temp = deserializeGTRecord(in,sInfo);
- ImmutableBitSet sMaskForEqualHashComp = ImmutableBitSet.serializer.deserialize(in);
- return new FuzzyKeyGTRecord(temp.info,temp.cols, sMaskForEqualHashComp);
- }
};
http://git-wip-us.apache.org/repos/asf/kylin/blob/ea244504/storage-hbase/src/main/java/org/apache/kylin/storage/hbase/cube/v2/CubeHBaseRPC.java
----------------------------------------------------------------------
diff --git a/storage-hbase/src/main/java/org/apache/kylin/storage/hbase/cube/v2/CubeHBaseRPC.java b/storage-hbase/src/main/java/org/apache/kylin/storage/hbase/cube/v2/CubeHBaseRPC.java
index 015edc6..af5d4b7 100644
--- a/storage-hbase/src/main/java/org/apache/kylin/storage/hbase/cube/v2/CubeHBaseRPC.java
+++ b/storage-hbase/src/main/java/org/apache/kylin/storage/hbase/cube/v2/CubeHBaseRPC.java
@@ -40,7 +40,6 @@ import org.apache.kylin.cube.kv.RowKeyEncoder;
import org.apache.kylin.cube.model.HBaseColumnDesc;
import org.apache.kylin.cube.model.HBaseColumnFamilyDesc;
import org.apache.kylin.cube.model.HBaseMappingDesc;
-import org.apache.kylin.gridtable.FuzzyKeyGTRecord;
import org.apache.kylin.gridtable.GTInfo;
import org.apache.kylin.gridtable.GTRecord;
import org.apache.kylin.gridtable.GTScanRange;
@@ -93,7 +92,7 @@ public abstract class CubeHBaseRPC implements IGTStorage {
return scan;
}
- private RawScan preparedHBaseScan(GTRecord pkStart, GTRecord pkEnd, List<FuzzyKeyGTRecord> fuzzyKeys, ImmutableBitSet selectedColBlocks) {
+ private RawScan preparedHBaseScan(GTRecord pkStart, GTRecord pkEnd, List<GTRecord> fuzzyKeys, ImmutableBitSet selectedColBlocks) {
final List<Pair<byte[], byte[]>> selectedColumns = makeHBaseColumns(selectedColBlocks);
LazyRowKeyEncoder encoder = new LazyRowKeyEncoder(cubeSeg, cuboid);
@@ -137,13 +136,13 @@ public abstract class CubeHBaseRPC implements IGTStorage {
* translate GTRecord format fuzzy keys to hbase expected format
* @return
*/
- private List<Pair<byte[], byte[]>> translateFuzzyKeys(List<FuzzyKeyGTRecord> fuzzyKeys) {
+ private List<Pair<byte[], byte[]>> translateFuzzyKeys(List<GTRecord> fuzzyKeys) {
if (fuzzyKeys == null || fuzzyKeys.isEmpty()) {
return Collections.emptyList();
}
List<Pair<byte[], byte[]>> ret = Lists.newArrayList();
- for (FuzzyKeyGTRecord gtRecordFuzzyKey : fuzzyKeys) {
+ for (GTRecord gtRecordFuzzyKey : fuzzyKeys) {
byte[] hbaseFuzzyKey = fuzzyKeyEncoder.createBuf();
byte[] hbaseFuzzyMask = fuzzyMaskEncoder.createBuf();