Skip to content

Conversation

houzhizhen
Copy link
Contributor

No description provided.

* specifies how to combine their values.
*/
public class DefaultVertexValueCombiner<T extends Value>
implements VertexValueCombiner<T> {
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 'class' keyword

@RunWith(Suite.class)
@Suite.SuiteClasses({
DefaultPropertiesCombinerTest.class,
DefaultVertexValueCombinerTest.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 OverwriteValueCombiner for any type.
and add MergeNewPropertiesCombiner and MergeOldPropertiesCombiner

@codecov-io
Copy link

Codecov Report

Merging #16 (1553768) into master (7c7178a) will increase coverage by 0.30%.
The diff coverage is 100.00%.

Impacted file tree graph

@@ 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 
Impacted Files Coverage Δ Complexity Δ
...puter/core/combiner/DefaultPropertiesCombiner.java 100.00% <100.00%> (ø) 2.00 <2.00> (?)
...uter/core/combiner/DefaultVertexValueCombiner.java 100.00% <100.00%> (ø) 2.00 <2.00> (?)
...uter/core/combiner/MergeNewPropertiesCombiner.java 100.00% <100.00%> (ø) 3.00 <3.00> (?)
...uter/core/combiner/MergeOldPropertiesCombiner.java 100.00% <100.00%> (ø) 3.00 <3.00> (?)
...computer/core/combiner/OverwriteValueCombiner.java 100.00% <100.00%> (ø) 2.00 <2.00> (?)
... and 1 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7c7178a...1553768. Read the comment docs.

*/
public class DefaultVertexValueCombiner<T extends Value>
implements VertexValueCombiner<T> {
implements VertexValueCombiner<T> {
Copy link
Contributor

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>
Copy link
Contributor

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();
Copy link
Contributor

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() {
Copy link
Contributor

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

DefaultVertexValueCombinerTest.class,
DoubleValueSumCombinerTest.class,
OverwriteValueCombinerTest.class,
OverwriteCombinerTest.class,
Copy link
Contributor

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();
Copy link
Contributor

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() {
Copy link
Contributor

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) {
Copy link
Contributor

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() {
Copy link
Contributor

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");
Copy link
Contributor

Choose a reason for hiding this comment

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

The combine parameter

Copy link
Contributor Author

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.

@Linary Linary merged commit bb462d3 into master Mar 10, 2021
@Linary Linary deleted the vertex-combiner branch March 10, 2021 11:36
coderzc pushed a commit that referenced this pull request Nov 9, 2021
add a one time output example in pagerank-master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

5 participants