Skip to content
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

Merged
merged 26 commits into from
May 9, 2022
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
0464dae
remove unused import
mayelena Apr 15, 2022
e3132c4
Merge branch 'master' into bugfix-branch
mayelena Apr 19, 2022
89af87d
fix hugegraph-example/Example checkstyle issue
mayelena Apr 20, 2022
7b6cc42
fix hugegraph-example/Example checkstyle issue
mayelena Apr 20, 2022
1d92f44
fix hugegraph-example/Example checkstyle issue
mayelena Apr 20, 2022
38fbfdc
fix hugegraph-example/Example checkstyle issue
mayelena Apr 20, 2022
e908a2d
Empty
imbajin Apr 20, 2022
947c4da
fix hugegraph-example/Example checkstyle issue
mayelena Apr 21, 2022
6b6a6d1
fix hugegraph-example/Example checkstyle issue
mayelena Apr 22, 2022
60312f1
Merge branch 'bugfix-branch' of https://github.com/mayelena/hugegraph…
mayelena Apr 22, 2022
d9fefb4
fix hugegraph-example/Example checkstyle issue
mayelena Apr 22, 2022
1ee50e3
Merge branch 'master' into bugfix-branch
mayelena Apr 25, 2022
7dc7fb5
Merge branch 'master' into bugfix-branch
mayelena May 7, 2022
9283d39
fix hugegraph-hbase checkstyle issue
mayelena May 7, 2022
9fdad02
fix hugegraph-hbase checkstyle issue
mayelena May 7, 2022
656f94b
fix hugegraph-hbase and hugegraph-example checkstyle issue
mayelena May 7, 2022
614f864
fix hugegraph-hbase and hugegraph-example checkstyle issue
mayelena May 7, 2022
c75dede
fix hugegraph-hbase and hugegraph-example checkstyle issue
mayelena May 7, 2022
d998fa3
fix hugegraph-hbase and hugegraph-example checkstyle issue
mayelena May 7, 2022
d05f20b
fix hugegraph-hbase and hugegraph-example checkstyle issue
mayelena May 7, 2022
2bb799b
fix hugegraph-hbase and hugegraph-example checkstyle issue
mayelena May 7, 2022
15c00f0
fix hugegraph-hbase and hugegraph-example checkstyle issue
mayelena May 7, 2022
c03bcb8
fix hugegraph-hbase and hugegraph-example checkstyle issue
mayelena May 8, 2022
2cae00a
fix hugegraph-hbase and hugegraph-example checkstyle issue
mayelena May 8, 2022
adee7e2
fix hugegraph-hbase and hugegraph-example checkstyle issue
mayelena May 9, 2022
3b171c3
fix hugegraph-hbase and hugegraph-example checkstyle issue
mayelena May 9, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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);
Copy link
Contributor

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


private static final String COPROCESSOR_AGGR =
"org.apache.hadoop.hbase.coprocessor.AggregateImplementation";
Expand Down Expand Up @@ -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());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

align or not to divide?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No rules will be hit.
The below line is indented more than 4 blankspace.
And we setted forceStrictCondition = false, so more than 4 space is ok.

https://checkstyle.sourceforge.io/config_misc.html#Indentation.

there isn't any rules about align in all checkstyle rules

https://checkstyle.sourceforge.io/checks.html

}
byte[][] splits = new byte[numOfPartitions - 1][org.apache.hadoop.hbase.util.Bytes.SIZEOF_SHORT];
byte[][] splits = new byte[numOfPartitions - 1][org.apache.hadoop
Copy link
Contributor

Choose a reason for hiding this comment

The 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);
}
Expand Down Expand Up @@ -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",
Copy link
Contributor

Choose a reason for hiding this comment

The 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",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

StringEncoding.format(key),
StringEncoding.format(val)));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also update references


private final String store;
private final String namespace;
Expand Down Expand Up @@ -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());
}
Expand Down Expand Up @@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The 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();

Expand Down Expand Up @@ -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)
Copy link
Contributor

Choose a reason for hiding this comment

The 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));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

align with "Result"

throws IOException {
CellScanner cellScanner = row.cellScanner();
while (cellScanner.advance()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,8 @@

import java.io.IOException;
import java.util.Arrays;
import java.util.Iterator;

import com.baidu.hugegraph.backend.id.EdgeId;
import com.baidu.hugegraph.backend.serializer.BytesBuffer;
import com.baidu.hugegraph.config.HugeConfig;
import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.CellScanner;
import org.apache.hadoop.hbase.CellUtil;
Expand All @@ -35,7 +32,6 @@
import com.baidu.hugegraph.backend.query.Query;
import com.baidu.hugegraph.backend.serializer.BinaryBackendEntry;
import com.baidu.hugegraph.backend.serializer.BinaryEntryIterator;
import com.baidu.hugegraph.backend.serializer.BytesBuffer;
import com.baidu.hugegraph.backend.store.BackendEntry;
import com.baidu.hugegraph.backend.store.BackendEntry.BackendColumn;
import com.baidu.hugegraph.backend.store.BackendEntryIterator;
Expand Down