- Notifications
You must be signed in to change notification settings - Fork 44
Improve class for Id, Value, GraphOutput and GraphInput #6
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
Conversation
computer-core/src/main/java/com/baidu/hugegraph/computer/core/graph/value/ValueType.java Outdated Show resolved Hide resolved
computer-core/src/main/java/com/baidu/hugegraph/computer/core/io/GraphWriteBackOutput.java Outdated Show resolved Hide resolved
computer-core/src/main/java/com/baidu/hugegraph/computer/core/util/ByteArrayUtil.java Outdated Show resolved Hide resolved
computer-core/src/main/java/com/baidu/hugegraph/computer/core/graph/value/ValueType.java Outdated Show resolved Hide resolved
computer-test/src/main/java/com/baidu/hugegraph/computer/core/graph/id/Utf8IdTest.java Outdated Show resolved Hide resolved
computer-test/src/main/java/com/baidu/hugegraph/computer/core/graph/value/DoubleValueTest.java Outdated Show resolved Hide resolved
computer-test/src/main/java/com/baidu/hugegraph/computer/core/graph/value/DoubleValueTest.java Outdated Show resolved Hide resolved
computer-test/src/main/java/com/baidu/hugegraph/computer/core/graph/value/DoubleValueTest.java Outdated Show resolved Hide resolved
...uter-test/src/main/java/com/baidu/hugegraph/computer/core/io/StreamGraphOutputInputTest.java Outdated Show resolved Hide resolved
Codecov Report
@@ Coverage Diff @@ ## master #6 +/- ## ============================================ - Coverage 70.58% 0.00% -70.59% ============================================ Files 14 35 +21 Lines 204 753 +549 Branches 12 64 +52 ============================================ - Hits 144 0 -144 - Misses 51 753 +702 + Partials 9 0 -9
Continue to review full report at Codecov.
|
computer-core/src/main/java/com/baidu/hugegraph/computer/core/common/Constants.java Show resolved Hide resolved
computer-core/src/main/java/com/baidu/hugegraph/computer/core/graph/id/IdType.java Outdated Show resolved Hide resolved
computer-core/src/main/java/com/baidu/hugegraph/computer/core/graph/id/IdType.java Outdated Show resolved Hide resolved
computer-core/src/main/java/com/baidu/hugegraph/computer/core/graph/id/IdType.java Outdated Show resolved Hide resolved
ValueType valueType = values.get(code); | ||
if (valueType == null) { | ||
String message = "Can not find ValueType for code %s."; | ||
String message = "Can't find ValueType for code %s."; |
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.
ValueType -> valueType
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.
It represent a class name
return new IdValue(); | ||
default: | ||
String message = "Can not create Value for %s."; | ||
String message = "Can't create Value for %s."; |
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.
Value -> value
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.
It represent a class name
computer-core/src/main/java/com/baidu/hugegraph/computer/core/graph/id/Id.java Show resolved Hide resolved
| ||
int readVInt() throws IOException; | ||
| ||
long readVLong() throws IOException; |
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 more methods(from BytesBuffer class)
computer-test/src/main/java/com/baidu/hugegraph/computer/core/BaseCoreTest.java Outdated Show resolved Hide resolved
computer-test/src/main/java/com/baidu/hugegraph/computer/core/BaseCoreTest.java Outdated Show resolved Hide resolved
computer-test/src/main/java/com/baidu/hugegraph/computer/core/CoreTestSuite.java Show resolved Hide resolved
computer-core/src/main/java/com/baidu/hugegraph/computer/core/graph/value/ValueType.java Outdated Show resolved Hide resolved
computer-core/src/main/java/com/baidu/hugegraph/computer/core/graph/value/ValueType.java Outdated Show resolved Hide resolved
computer-core/src/main/java/com/baidu/hugegraph/computer/core/graph/id/LongId.java Show resolved Hide resolved
| ||
@Override | ||
public void writeId(Id id) throws IOException { | ||
this.writeByte(id.type().code()); |
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.
copy writeId() from hugegraph-core and reserve the first byte
computer-core/src/main/java/com/baidu/hugegraph/computer/core/graph/id/LongId.java Outdated Show resolved Hide resolved
public IdValue idValue() { | ||
int len = Byte.BYTES + Long.BYTES + Long.BYTES; | ||
try (ByteArrayOutputStream baos = new ByteArrayOutputStream(len)) { | ||
// len = Byte.BYTES + Long.BYTES + Long.BYTES; |
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.
ditto
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.
uuid use writeLong, fixed 8 bytes
computer-core/src/main/java/com/baidu/hugegraph/computer/core/graph/value/IdValue.java Outdated Show resolved Hide resolved
| ||
@Override | ||
public ValueType type() { | ||
return this.valueType; |
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.
how to declare List of List<Long>
computer-core/src/main/java/com/baidu/hugegraph/computer/core/graph/value/ListValue.java Outdated Show resolved Hide resolved
computer-core/src/main/java/com/baidu/hugegraph/computer/core/io/GraphComputerOutput.java Outdated Show resolved Hide resolved
computer-test/src/main/java/com/baidu/hugegraph/computer/core/graph/id/IdTypeTest.java Outdated Show resolved Hide resolved
computer-test/src/main/java/com/baidu/hugegraph/computer/core/graph/id/IdFactoryTest.java Show resolved Hide resolved
computer-test/src/main/java/com/baidu/hugegraph/computer/core/graph/id/IdTypeTest.java Show resolved Hide resolved
computer-core/src/main/java/com/baidu/hugegraph/computer/core/graph/value/ValueFactory.java Show resolved Hide resolved
computer-core/src/main/java/com/baidu/hugegraph/computer/core/graph/value/ListValue.java Show resolved Hide resolved
} | ||
| ||
public ListValue(ValueType elemType) { | ||
this.elemType = elemType; |
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 update element value
| ||
private ValueType elemType; | ||
private List<T> values; | ||
|
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.
how to get element from list?
private List<T> values; | ||
| ||
public ListValue() { | ||
this(ValueType.UNKNOWN); |
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 method size()
computer-core/src/main/java/com/baidu/hugegraph/computer/core/io/StructGraphOutput.java Outdated Show resolved Hide resolved
computer-core/src/main/java/com/baidu/hugegraph/computer/core/io/StructGraphOutput.java Show resolved Hide resolved
computer-core/src/main/java/com/baidu/hugegraph/computer/core/io/StructGraphOutput.java Show resolved Hide resolved
...uter-test/src/main/java/com/baidu/hugegraph/computer/core/io/StreamGraphOutputInputTest.java Show resolved Hide resolved
computer-core/src/main/java/com/baidu/hugegraph/computer/core/io/StreamGraphOutput.java Show resolved Hide resolved
BIN, | ||
CSV, | ||
JSON; | ||
|
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.
unused row
No description provided.