当前位置: 首页>>代码示例>>Java>>正文


Java PairFunction.call方法代码示例

本文整理汇总了Java中org.apache.spark.api.java.function.PairFunction.call方法的典型用法代码示例。如果您正苦于以下问题:Java PairFunction.call方法的具体用法?Java PairFunction.call怎么用?Java PairFunction.call使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.spark.api.java.function.PairFunction的用法示例。


在下文中一共展示了PairFunction.call方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: assertMaptoPairFunction

import org.apache.spark.api.java.function.PairFunction; //导入方法依赖的package包/类
private void assertMaptoPairFunction(PairFunction<Tuple2<String, Tuple2<Citation, String>>, String, Citation> function) throws Exception {
    
    Citation inputCitation = new Citation("source-id", 1, null);
    String inputExternalId = "external-id";
    Tuple2<String, Tuple2<Citation, String>> inputTuple = new Tuple2<String, Tuple2<Citation,String>>("groupedId", 
            new Tuple2<Citation, String>(inputCitation, inputExternalId));
    
    Tuple2<String, Citation> result = function.call(inputTuple);
    
    assertEquals(inputExternalId, result._1);
    assertEquals(inputCitation, result._2);
}
 
开发者ID:openaire,项目名称:iis,代码行数:13,代码来源:ExternalIdCitationMatcherTest.java

示例2: assertRelationMapToPair

import org.apache.spark.api.java.function.PairFunction; //导入方法依赖的package包/类
private void assertRelationMapToPair(PairFunction<DocumentToProject, CharSequence, Object> function) throws Exception {
    String docId = "docId";
    String projId = "projId";
    
    Tuple2<CharSequence, Object> result = function.call(DocumentToProject.newBuilder().setDocumentId(docId)
            .setProjectId(projId).setConfidenceLevel(1).build());
    
    assertEquals(docId, result._1);
    assertNull(result._2);
}
 
开发者ID:openaire,项目名称:iis,代码行数:11,代码来源:DocumentFilterTest.java

示例3: assertEntityMapToPair

import org.apache.spark.api.java.function.PairFunction; //导入方法依赖的package包/类
private void assertEntityMapToPair(PairFunction<DocumentText, CharSequence, CharSequence> function) throws Exception {
    String id = "docId";
    String text = "some text";
    
    Tuple2<CharSequence, CharSequence> result = function
            .call(DocumentText.newBuilder().setId(id).setText(text).build());
    
    assertEquals(id, result._1);
    assertEquals(text, result._2);
}
 
开发者ID:openaire,项目名称:iis,代码行数:11,代码来源:DocumentFilterTest.java

示例4: assertRelationMapToPair

import org.apache.spark.api.java.function.PairFunction; //导入方法依赖的package包/类
private void assertRelationMapToPair(PairFunction<DocumentToDataSet, CharSequence, Object> function) throws Exception {
    String docId = "docId";
    String datasetId = "datasetId";
    
    Tuple2<CharSequence, Object> result = function.call(DocumentToDataSet.newBuilder().setDocumentId(docId)
            .setDatasetId(datasetId).setConfidenceLevel(1).build());
    
    assertEquals(datasetId, result._1);
    assertNull(result._2);
}
 
开发者ID:openaire,项目名称:iis,代码行数:11,代码来源:DatasetFilterTest.java

示例5: assertEntityMapToPair

import org.apache.spark.api.java.function.PairFunction; //导入方法依赖的package包/类
private void assertEntityMapToPair(PairFunction<DocumentText, CharSequence, CharSequence> function) throws Exception {
    String id = "datasetId";
    String text = "some text";
    
    Tuple2<CharSequence, CharSequence> result = function
            .call(DocumentText.newBuilder().setId(id).setText(text).build());
    
    assertEquals(id, result._1);
    assertEquals(text, result._2);
}
 
开发者ID:openaire,项目名称:iis,代码行数:11,代码来源:DatasetFilterTest.java

示例6: assertMapToPairFunction

import org.apache.spark.api.java.function.PairFunction; //导入方法依赖的package包/类
private void assertMapToPairFunction(PairFunction<String, AvroKey<String>, NullWritable> mapToPairFunction) throws Exception {
    Tuple2<AvroKey<String>, NullWritable> tuple = mapToPairFunction.call("xyz");
    assertEquals(new AvroKey<String>("xyz"), tuple._1());
    assertEquals(NullWritable.get(), tuple._2());
}
 
开发者ID:CeON,项目名称:spark-utils,代码行数:6,代码来源:SparkAvroSaverTest.java

示例7: assertAffHashFunction

import org.apache.spark.api.java.function.PairFunction; //导入方法依赖的package包/类
private void assertAffHashFunction(PairFunction<AffMatchAffiliation, String, AffMatchAffiliation> function) throws Exception {
    
    // given
    
    AffMatchAffiliation aff = new AffMatchAffiliation("DOC1", 1);
    when(affiliationBucketHasher.hash(aff)).thenReturn("HASH");
    
    
    // execute
    
    Tuple2<String, AffMatchAffiliation> hashAff = function.call(aff);
    
    
    // assert
    
    assertEquals("HASH", hashAff._1());
    assertTrue(aff == hashAff._2());
}
 
开发者ID:openaire,项目名称:iis,代码行数:19,代码来源:AffOrgHashBucketJoinerTest.java

示例8: assertOrgHashFunction

import org.apache.spark.api.java.function.PairFunction; //导入方法依赖的package包/类
private void assertOrgHashFunction(PairFunction<AffMatchOrganization, String, AffMatchOrganization> function) throws Exception {
    
    // given
    
    AffMatchOrganization org = new AffMatchOrganization("ORG1");
    when(organizationBucketHasher.hash(org)).thenReturn("HASH");
    
    
    // execute
    
    Tuple2<String, AffMatchOrganization> hashOrg = function.call(org);
    
    
    // assert
    
    assertEquals("HASH", hashOrg._1());
    assertTrue(org == hashOrg._2());
}
 
开发者ID:openaire,项目名称:iis,代码行数:19,代码来源:AffOrgHashBucketJoinerTest.java

示例9: assertAttachIdFunction

import org.apache.spark.api.java.function.PairFunction; //导入方法依赖的package包/类
private void assertAttachIdFunction(PairFunction<DocumentMetadata, String, DocumentMetadata> function) throws Exception {

        DocumentMetadata docMetadata = DocumentMetadata.newBuilder()
                .setId("someId")
                .setBasicMetadata(new BasicMetadata())
                .setReferences(Lists.newArrayList())
                .build();


        Tuple2<String, DocumentMetadata> retDocWithId = function.call(docMetadata);


        assertEquals("doc_someId", retDocWithId._1);
        assertTrue(retDocWithId._2 == docMetadata);

    }
 
开发者ID:openaire,项目名称:iis,代码行数:17,代码来源:DocumentMetadataInputReaderTest.java

示例10: assertConvertMatchedCitationFunction

import org.apache.spark.api.java.function.PairFunction; //导入方法依赖的package包/类
private void assertConvertMatchedCitationFunction(PairFunction<Tuple2<MatchableEntity, IdWithSimilarity>, Citation, NullWritable> function) throws Exception {

        MatchableEntity entity = mock(MatchableEntity.class);
        IdWithSimilarity idWithSimilarity = mock(IdWithSimilarity.class);
        Citation citation = mock(Citation.class);

        when(converter.convertToCitation(entity, idWithSimilarity)).thenReturn(citation);


        Tuple2<Citation, NullWritable> retConverted = function.call(new Tuple2<>(entity, idWithSimilarity));


        assertTrue(retConverted._1 == citation);
        verify(converter).convertToCitation(entity, idWithSimilarity);
    }
 
开发者ID:openaire,项目名称:iis,代码行数:16,代码来源:CitationOutputConverterTest.java

示例11: assertConvertDocumentFunction

import org.apache.spark.api.java.function.PairFunction; //导入方法依赖的package包/类
private void assertConvertDocumentFunction(PairFunction<Tuple2<String, DocumentMetadata>, String, MatchableEntity> function) throws Exception {
    DocumentMetadata documentMetadata = mock(DocumentMetadata.class);
    MatchableEntity matchableEntity = mock(MatchableEntity.class);

    when(converter.convertToMatchableEntity("doc_someId", documentMetadata)).thenReturn(matchableEntity);


    Tuple2<String, MatchableEntity> retDocument = function.call(new Tuple2<>("doc_someId", documentMetadata));


    assertTrue(retDocument._2 == matchableEntity);
    assertEquals("doc_someId", retDocument._1);
}
 
开发者ID:openaire,项目名称:iis,代码行数:14,代码来源:DocumentMetadataInputConverterTest.java

示例12: assertAvroDocumentToAvroKeyValueFunction

import org.apache.spark.api.java.function.PairFunction; //导入方法依赖的package包/类
private void assertAvroDocumentToAvroKeyValueFunction(PairFunction<Document, AvroKey<GenericRecord>, NullWritable> function) throws Exception {
	Document document = new Document(5, "doc_title");
	
	Tuple2<AvroKey<GenericRecord>, NullWritable> retTuple = function.call(document);
	
	assertEquals(document, retTuple._1.datum());
}
 
开发者ID:openaire,项目名称:iis,代码行数:8,代码来源:SparkPipeExecutorTest.java


注:本文中的org.apache.spark.api.java.function.PairFunction.call方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。