-
Notifications
You must be signed in to change notification settings - Fork 521
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix hugegraph-hbase and hugegraph-example checkstyle issue #1864
Changes from 14 commits
0464dae
e3132c4
89af87d
7b6cc42
1d92f44
38fbfdc
e908a2d
947c4da
6b6a6d1
60312f1
d9fefb4
1ee50e3
7dc7fb5
9283d39
9fdad02
656f94b
614f864
c75dede
d998fa3
d05f20b
2bb799b
15c00f0
c03bcb8
2cae00a
adee7e2
3b171c3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,6 +31,7 @@ | |
import java.util.Map.Entry; | ||
import java.util.Set; | ||
import java.util.concurrent.Future; | ||
import com.baidu.hugegraph.util.Log; | ||
|
||
import org.apache.hadoop.conf.Configuration; | ||
import org.apache.hadoop.fs.Path; | ||
|
@@ -69,6 +70,7 @@ | |
import org.apache.hadoop.hbase.filter.PrefixFilter; | ||
import org.apache.hadoop.hbase.util.VersionInfo; | ||
import org.apache.hadoop.security.UserGroupInformation; | ||
import org.slf4j.Logger; | ||
|
||
import com.baidu.hugegraph.backend.BackendException; | ||
import com.baidu.hugegraph.backend.store.BackendEntry.BackendColumn; | ||
|
@@ -84,6 +86,7 @@ | |
import com.google.common.util.concurrent.Futures; | ||
|
||
public class HbaseSessions extends BackendSessionPool { | ||
private static final Logger LOG = Log.logger(HbaseSessions.class); | ||
|
||
private static final String COPROCESSOR_AGGR = | ||
"org.apache.hadoop.hbase.coprocessor.AggregateImplementation"; | ||
|
@@ -222,19 +225,21 @@ public void createTable(String table, List<byte[]> cfs) throws IOException { | |
.build()); | ||
} | ||
tdb.setCoprocessor(COPROCESSOR_AGGR); | ||
try(Admin admin = this.hbase.getAdmin()) { | ||
try (Admin admin = this.hbase.getAdmin()) { | ||
admin.createTable(tdb.build()); | ||
} | ||
} | ||
|
||
public void createPreSplitTable(String table, List<byte[]> cfs, short numOfPartitions) throws IOException { | ||
public void createPreSplitTable(String table, List<byte[]> cfs, | ||
short numOfPartitions) throws IOException { | ||
TableDescriptorBuilder builder = TableDescriptorBuilder.newBuilder( | ||
TableName.valueOf(this.namespace, table)); | ||
for (byte[] cf : cfs) { | ||
builder.setColumnFamily(ColumnFamilyDescriptorBuilder.newBuilder(cf) | ||
.build()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. align or not to divide? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No rules will be hit. https://checkstyle.sourceforge.io/config_misc.html#Indentation. there isn't any rules about align in all checkstyle rules |
||
} | ||
byte[][] splits = new byte[numOfPartitions - 1][org.apache.hadoop.hbase.util.Bytes.SIZEOF_SHORT]; | ||
byte[][] splits = new byte[numOfPartitions - 1][org.apache.hadoop | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. prefer to wrap line before "[org" |
||
.hbase.util.Bytes.SIZEOF_SHORT]; | ||
for (short split = 1; split < numOfPartitions; split++) { | ||
splits[split - 1] = org.apache.hadoop.hbase.util.Bytes.toBytes(split); | ||
} | ||
|
@@ -793,18 +798,18 @@ public long storeSize(String table) throws IOException { | |
*/ | ||
@SuppressWarnings("unused") | ||
private void dump(String table, Scan scan) throws IOException { | ||
System.out.println(String.format(">>>> scan table %s with %s", | ||
LOG.info(String.format(">>>> scan table %s with %s", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. LOG.info(">>>> scan table {} with {}", |
||
table, scan)); | ||
RowIterator iterator = this.scan(table, scan); | ||
while (iterator.hasNext()) { | ||
Result row = iterator.next(); | ||
System.out.println(StringEncoding.format(row.getRow())); | ||
LOG.info(StringEncoding.format(row.getRow())); | ||
CellScanner cellScanner = row.cellScanner(); | ||
while (cellScanner.advance()) { | ||
Cell cell = cellScanner.current(); | ||
byte[] key = CellUtil.cloneQualifier(cell); | ||
byte[] val = CellUtil.cloneValue(cell); | ||
System.out.println(String.format(" %s=%s", | ||
LOG.info(String.format(" %s=%s", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ditto |
||
StringEncoding.format(key), | ||
StringEncoding.format(val))); | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,7 +54,7 @@ public abstract class HbaseStore extends AbstractBackendStore<Session> { | |
|
||
private static final Logger LOG = Log.logger(HbaseStore.class); | ||
|
||
private final BackendFeatures FEATURES; | ||
private final BackendFeatures features; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. also update references |
||
|
||
private final String store; | ||
private final String namespace; | ||
|
@@ -258,9 +258,11 @@ public void init() { | |
for (String table : this.tableNames()) { | ||
try { | ||
if (table.equals("g_oe") || table.equals("g_ie")) { | ||
this.sessions.createPreSplitTable(table, HbaseTable.cfs(), this.edgeLogicPartitions); | ||
this.sessions.createPreSplitTable(table, HbaseTable.cfs(), | ||
this.edgeLogicPartitions); | ||
} else if (table.equals("g_v")) { | ||
this.sessions.createPreSplitTable(table, HbaseTable.cfs(), this.vertexLogicPartitions); | ||
this.sessions.createPreSplitTable(table, HbaseTable.cfs(), | ||
this.vertexLogicPartitions); | ||
} else { | ||
this.sessions.createTable(table, HbaseTable.cfs()); | ||
} | ||
|
@@ -445,7 +447,8 @@ public static class HbaseSchemaStore extends HbaseStore { | |
|
||
public HbaseSchemaStore(HugeConfig config, BackendStoreProvider provider, | ||
String namespace, String store) { | ||
super(provider, namespace, store, config.get(HbaseOptions.HBASE_ENABLE_PARTITION).booleanValue()); | ||
super(provider, namespace, store, config.get(HbaseOptions | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. wrap line before config |
||
.HBASE_ENABLE_PARTITION).booleanValue()); | ||
|
||
this.counters = new HbaseTables.Counters(); | ||
|
||
|
@@ -492,7 +495,8 @@ public static class HbaseGraphStore extends HbaseStore { | |
private boolean enablePartition; | ||
public HbaseGraphStore(HugeConfig config, BackendStoreProvider provider, | ||
String namespace, String store) { | ||
super(provider, namespace, store, config.get(HbaseOptions.HBASE_ENABLE_PARTITION).booleanValue()); | ||
super(provider, namespace, store, config.get(HbaseOptions.HBASE_ENABLE_PARTITION) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. wrap line before config |
||
.booleanValue()); | ||
this.enablePartition = config.get(HbaseOptions.HBASE_ENABLE_PARTITION).booleanValue(); | ||
registerTableManager(HugeType.VERTEX, | ||
new HbaseTables.Vertex(store, enablePartition)); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -283,7 +283,8 @@ protected BackendEntryIterator newEntryIterator(Query query, | |
}); | ||
} | ||
|
||
protected void parseRowColumns(Result row, BackendEntry entry, Query query, boolean enablePartition) | ||
protected void parseRowColumns(Result row, BackendEntry entry, Query query, | ||
boolean enablePartition) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. align with "Result" |
||
throws IOException { | ||
CellScanner cellScanner = row.cellScanner(); | ||
while (cellScanner.advance()) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add a blank line after class define