當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。