use of org.apache.flink.types.LongValue in project flink by apache.
the class EdgeDegreePairTest method testWithRMatGraph.
@Test
public void testWithRMatGraph() throws Exception {
DataSet<Edge<LongValue, Tuple3<NullValue, LongValue, LongValue>>> degreePairOnSourceId = undirectedRMatGraph.run(new EdgeDegreePair<LongValue, NullValue, NullValue>());
Checksum checksumOnSourceId = new ChecksumHashCode<Edge<LongValue, Tuple3<NullValue, LongValue, LongValue>>>().run(degreePairOnSourceId).execute();
assertEquals(20884, checksumOnSourceId.getCount());
assertEquals(0x00000001e051efe4L, checksumOnSourceId.getChecksum());
DataSet<Edge<LongValue, Tuple3<NullValue, LongValue, LongValue>>> degreePairOnTargetId = undirectedRMatGraph.run(new EdgeDegreePair<LongValue, NullValue, NullValue>().setReduceOnTargetId(true));
Checksum checksumOnTargetId = new ChecksumHashCode<Edge<LongValue, Tuple3<NullValue, LongValue, LongValue>>>().run(degreePairOnTargetId).execute();
assertEquals(checksumOnSourceId, checksumOnTargetId);
}
use of org.apache.flink.types.LongValue in project flink by apache.
the class LongValueToUnsignedIntValueTest method testTranslation.
@Test
public void testTranslation() throws Exception {
assertEquals(new IntValue(0), translator.translate(new LongValue(0L), reuse));
assertEquals(new IntValue(Integer.MIN_VALUE), translator.translate(new LongValue((long) Integer.MAX_VALUE + 1), reuse));
assertEquals(new IntValue(-1), translator.translate(new LongValue((1L << 32) - 1), reuse));
}
use of org.apache.flink.types.LongValue in project flink by apache.
the class ToNullValueTest method testTranslation.
@Test
public void testTranslation() throws Exception {
NullValue reuse = NullValue.getInstance();
assertEquals(NullValue.getInstance(), new ToNullValue<>().translate(new DoubleValue(), reuse));
assertEquals(NullValue.getInstance(), new ToNullValue<>().translate(new FloatValue(), reuse));
assertEquals(NullValue.getInstance(), new ToNullValue<>().translate(new IntValue(), reuse));
assertEquals(NullValue.getInstance(), new ToNullValue<>().translate(new LongValue(), reuse));
assertEquals(NullValue.getInstance(), new ToNullValue<>().translate(new StringValue(), reuse));
}
use of org.apache.flink.types.LongValue in project flink by apache.
the class LocalClusteringCoefficientTest method testRMatGraph.
@Test
public void testRMatGraph() throws Exception {
DataSet<Result<LongValue>> cc = undirectedRMatGraph.run(new LocalClusteringCoefficient<LongValue, NullValue, NullValue>());
Checksum checksum = new ChecksumHashCode<Result<LongValue>>().run(cc).execute();
assertEquals(902, checksum.getCount());
assertEquals(0x000001cab2d3677bL, checksum.getChecksum());
}
use of org.apache.flink.types.LongValue in project flink by apache.
the class TriangleListingTest method testCompleteGraph.
@Test
public void testCompleteGraph() throws Exception {
long expectedDegree = completeGraphVertexCount - 1;
long expectedCount = completeGraphVertexCount * CombinatoricsUtils.binomialCoefficient((int) expectedDegree, 2) / 3;
DataSet<Result<LongValue>> tl = completeGraph.run(new TriangleListing<LongValue, NullValue, NullValue>());
Checksum checksum = new ChecksumHashCode<Result<LongValue>>().run(tl).execute();
assertEquals(expectedCount, checksum.getCount());
}
Aggregations