- Notifications
You must be signed in to change notification settings - Fork 44
add DefaultPropertiesCombiner and DefaultVertexValueCombiner #16
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
efd3688
to 99d0197
Compare * specifies how to combine their values. | ||
*/ | ||
public class DefaultVertexValueCombiner<T extends Value> | ||
implements VertexValueCombiner<T> { |
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.
align with 'class' keyword
@RunWith(Suite.class) | ||
@Suite.SuiteClasses({ | ||
DefaultPropertiesCombinerTest.class, | ||
DefaultVertexValueCombinerTest.class, |
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 OverwriteValueCombiner for any type.
and add MergeNewPropertiesCombiner and MergeOldPropertiesCombiner
Codecov Report
@@ Coverage Diff @@ ## master #16 +/- ## ============================================ + Coverage 77.33% 77.64% +0.30% - Complexity 621 634 +13 ============================================ Files 65 70 +5 Lines 2118 2138 +20 Branches 172 174 +2 ============================================ + Hits 1638 1660 +22 + Misses 372 371 -1 + Partials 108 107 -1
Continue to review full report at Codecov.
|
*/ | ||
public class DefaultVertexValueCombiner<T extends Value> | ||
implements VertexValueCombiner<T> { | ||
implements VertexValueCombiner<T> { |
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.
remove VertexValueCombiner class
| ||
import com.baidu.hugegraph.computer.core.graph.value.Value; | ||
| ||
public class OverwriteValueCombiner<T extends 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.
OverwriteCombiner<T>
| ||
@Test | ||
public void test() { | ||
Properties properties1 = new DefaultProperties(); |
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.
testOverwriteProperties() for OverwriteCombiner<Properties>
public class OverwriteValueCombinerTest { | ||
| ||
@Test | ||
public void test() { |
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 3 tests:
testOverwriteValue()
testOverwriteVertex()
testOverwriteProperties()
f5cc502
to 2a76289
Compare DefaultVertexValueCombinerTest.class, | ||
DoubleValueSumCombinerTest.class, | ||
OverwriteValueCombinerTest.class, | ||
OverwriteCombinerTest.class, |
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.
move to line 27
Vertex vertex2 = factory.createVertex(longId2, value2); | ||
vertex2.addEdge(factory.createEdge(new LongId(1L), NullValue.get())); | ||
| ||
OverwriteCombiner<Vertex> combiner = new OverwriteCombiner(); |
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.
new OverwriteCombiner<>()
public class MergeNewPropertiesCombinerTest { | ||
| ||
@Test | ||
public void test() { |
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.
testCombine
* remain the value in v2. | ||
*/ | ||
@Override | ||
public Properties combine(Properties v1, Properties v2) { |
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.
check v1 and v2 not null, and add test case.
also improve Value*Combiner
public class MergeOldPropertiesCombinerTest { | ||
| ||
@Test | ||
public void test() { |
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
| ||
@Override | ||
public LongValue combine(LongValue v1, LongValue v2) { | ||
E.checkArgumentNotNull(v1, "The parameter v1 can't be null"); |
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.
The combine parameter
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's unified with others not null checks. If it fails, the stack trance will show the information.
add a one time output example in pagerank-master
No description provided.