当前位置: 首页>>代码示例>>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;未经允许,请勿转载。