當前位置: 首頁>>代碼示例>>Java>>正文


Java Tuple2.getField方法代碼示例

本文整理匯總了Java中org.apache.flink.api.java.tuple.Tuple2.getField方法的典型用法代碼示例。如果您正苦於以下問題:Java Tuple2.getField方法的具體用法?Java Tuple2.getField怎麽用?Java Tuple2.getField使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.flink.api.java.tuple.Tuple2的用法示例。


在下文中一共展示了Tuple2.getField方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: collectData

import org.apache.flink.api.java.tuple.Tuple2; //導入方法依賴的package包/類
private Map<Integer, Collection<String>> collectData(MutableObjectIterator<Tuple2<Integer, String>> iter)
		throws Exception
{
	Map<Integer, Collection<String>> map = new HashMap<Integer, Collection<String>>();
	Tuple2<Integer, String> pair = new Tuple2<Integer, String>();

	while ((pair = iter.next(pair)) != null) {
		final Integer key = pair.getField(0);

		if (!map.containsKey(key)) {
			map.put(key, new ArrayList<String>());
		}

		Collection<String> values = map.get(key);
		final String value = pair.getField(1);
		values.add(value);
	}

	return map;
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:21,代碼來源:NonReusingSortMergeInnerJoinIteratorITCase.java

示例2: collectData

import org.apache.flink.api.java.tuple.Tuple2; //導入方法依賴的package包/類
private Map<Integer, Collection<String>> collectData(MutableObjectIterator<Tuple2<Integer, String>> iter)
		throws Exception {
	final Map<Integer, Collection<String>> map = new HashMap<>();
	Tuple2<Integer, String> pair = new Tuple2<>();

	while ((pair = iter.next(pair)) != null) {
		final Integer key = pair.getField(0);

		if (!map.containsKey(key)) {
			map.put(key, new ArrayList<String>());
		}

		Collection<String> values = map.get(key);
		final String value = pair.getField(1);
		values.add(value);
	}

	return map;
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:20,代碼來源:AbstractSortMergeOuterJoinIteratorITCase.java

示例3: collectData

import org.apache.flink.api.java.tuple.Tuple2; //導入方法依賴的package包/類
private Map<Integer, Collection<String>> collectData(MutableObjectIterator<Tuple2<Integer, String>> iter)
throws Exception
{
	Map<Integer, Collection<String>> map = new HashMap<Integer, Collection<String>>();
	Tuple2<Integer, String> pair = new Tuple2<Integer, String>();
	
	while ((pair = iter.next(pair)) != null) {
		final Integer key = pair.getField(0);
		
		if (!map.containsKey(key)) {
			map.put(key, new ArrayList<String>());
		}

		Collection<String> values = map.get(key);
		final String value = pair.getField(1);
		values.add(value);
	}

	return map;
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:21,代碼來源:ReusingSortMergeInnerJoinIteratorITCase.java

示例4: join

import org.apache.flink.api.java.tuple.Tuple2; //導入方法依賴的package包/類
@Override
public void join(Tuple2<Integer, String> rec1, Tuple2<Integer, String> rec2, Collector<Tuple2<Integer, String>> out) throws Exception {
	final Integer key = rec1 != null ? (Integer) rec1.getField(0) : (Integer) rec2.getField(0);
	final String value1 = rec1 != null ? (String) rec1.getField(1) : null;
	final String value2 = rec2 != null ? (String) rec2.getField(1) : null;

	Collection<Match> matches = this.toRemoveFrom.get(key);
	if (matches == null) {
		Assert.fail("Match " + key + " - " + value1 + ":" + value2 + " is unexpected.");
	}

	boolean contained = matches.remove(new Match(value1, value2));
	if (!contained) {
		Assert.fail("Produced match was not contained: " + key + " - " + value1 + ":" + value2);
	}
	if (matches.isEmpty()) {
		this.toRemoveFrom.remove(key);
	}
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:20,代碼來源:MatchRemovingJoiner.java

示例5: unwrap

import org.apache.flink.api.java.tuple.Tuple2; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
private <V> V unwrap(Tuple2<K, V> t) {
	return t == null ? null : (V) (t.getField(1));
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:5,代碼來源:TupleUnwrappingJoiner.java

示例6: persist

import org.apache.flink.api.java.tuple.Tuple2; //導入方法依賴的package包/類
public void persist(Tuple2<String, Float> tuple){
	
	final TransactionSnapshot ts = new TransactionSnapshot(tuple.getField(0), tuple.getField(1));
	transactionSnapshotRepo.save(ts);
	
}
 
開發者ID:tuhingupta,項目名稱:kappa-streaming,代碼行數:7,代碼來源:TransactionSnapshotService.java


注:本文中的org.apache.flink.api.java.tuple.Tuple2.getField方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。