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


Java ObjectWritable.set方法代码示例

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


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

示例1: map

import org.apache.hadoop.io.ObjectWritable; //导入方法依赖的package包/类
/**
 * Wrap values in ObjectWritable.
 */
public void map(Text key, Writable value,
  OutputCollector<Text, ObjectWritable> output, Reporter reporter)
  throws IOException {

  ObjectWritable objWrite = new ObjectWritable();
  Writable cloned = null;
  if (value instanceof LinkDatum) {
    cloned = new Text(((LinkDatum)value).getUrl());
  }
  else {
    cloned = WritableUtils.clone(value, conf);
  }
  objWrite.set(cloned);
  output.collect(key, objWrite);
}
 
开发者ID:yahoo,项目名称:anthelion,代码行数:19,代码来源:Loops.java

示例2: map

import org.apache.hadoop.io.ObjectWritable; //导入方法依赖的package包/类
/**
 * Changes input into ObjectWritables.
 */
public void map(Text key, Writable value,
    OutputCollector<Text, ObjectWritable> output, Reporter reporter)
    throws IOException {

  ObjectWritable objWrite = new ObjectWritable();
  objWrite.set(value);
  output.collect(key, objWrite);
}
 
开发者ID:jorcox,项目名称:GeoCrawler,代码行数:12,代码来源:ScoreUpdater.java

示例3: map

import org.apache.hadoop.io.ObjectWritable; //导入方法依赖的package包/类
/**
 * Convert values to ObjectWritable
 */
public void map(Text key, Writable value,
    OutputCollector<Text, ObjectWritable> output, Reporter reporter)
    throws IOException {

  ObjectWritable objWrite = new ObjectWritable();
  objWrite.set(value);
  output.collect(key, objWrite);
}
 
开发者ID:jorcox,项目名称:GeoCrawler,代码行数:12,代码来源:LinkRank.java

示例4: map

import org.apache.hadoop.io.ObjectWritable; //导入方法依赖的package包/类
/**
 * Wraps all values in ObjectWritables.
 */
public void map(Text key, Writable value,
    OutputCollector<Text, ObjectWritable> output, Reporter reporter)
    throws IOException {

  ObjectWritable objWrite = new ObjectWritable();
  objWrite.set(value);
  output.collect(key, objWrite);
}
 
开发者ID:jorcox,项目名称:GeoCrawler,代码行数:12,代码来源:LinkDumper.java

示例5: map

import org.apache.hadoop.io.ObjectWritable; //导入方法依赖的package包/类
/**
 * Changes input into ObjectWritables.
 */
public void map(Text key, Writable value,
  OutputCollector<Text, ObjectWritable> output, Reporter reporter)
  throws IOException {

  ObjectWritable objWrite = new ObjectWritable();
  objWrite.set(value);
  output.collect(key, objWrite);
}
 
开发者ID:yahoo,项目名称:anthelion,代码行数:12,代码来源:ScoreUpdater.java

示例6: map

import org.apache.hadoop.io.ObjectWritable; //导入方法依赖的package包/类
/**
 * Convert values to ObjectWritable
 */
public void map(Text key, Writable value,
  OutputCollector<Text, ObjectWritable> output, Reporter reporter)
  throws IOException {

  ObjectWritable objWrite = new ObjectWritable();
  objWrite.set(value);
  output.collect(key, objWrite);
}
 
开发者ID:yahoo,项目名称:anthelion,代码行数:12,代码来源:LinkRank.java

示例7: map

import org.apache.hadoop.io.ObjectWritable; //导入方法依赖的package包/类
/**
 * Wraps all values in ObjectWritables.
 */
public void map(Text key, Writable value,
  OutputCollector<Text, ObjectWritable> output, Reporter reporter)
  throws IOException {

  ObjectWritable objWrite = new ObjectWritable();
  objWrite.set(value);
  output.collect(key, objWrite);
}
 
开发者ID:yahoo,项目名称:anthelion,代码行数:12,代码来源:LinkDumper.java

示例8: testMapper

import org.apache.hadoop.io.ObjectWritable; //导入方法依赖的package包/类
@Test
public void testMapper()
		throws IOException {

	final GeoWaveInputKey inputKey = new GeoWaveInputKey();
	inputKey.setInsertionId(null);
	inputKey.setAdapterId(testObjectAdapter.getAdapterId());
	inputKey.setDataId(new ByteArrayId(
			"abc".getBytes()));

	final ObjectWritable ow = new ObjectWritable();
	ow.set(new FeatureWritable(
			ftype,
			AnalyticFeature.createGeometryFeature(
					ftype,
					batchId,
					"123",
					"fred",
					grp1,
					20.30203,
					factory.createPoint(new Coordinate(
							02.33,
							0.23)),
					new String[] {
						"extra1"
					},
					new double[] {
						0.022
					},
					1,
					1,
					0)));

	mapDriver.withInput(
			inputKey,
			ow);

	final List<Pair<Text, CountofDoubleWritable>> results = mapDriver.run();
	// output key has the dataID adjusted to contain the rank
	assertEquals(
			results.get(
					0).getFirst().toString(),
			grp1);
	// output value is the same as input value
	assertEquals(
			results.get(
					0).getSecond().getValue(),
			0.0,
			0.0001);

}
 
开发者ID:locationtech,项目名称:geowave,代码行数:52,代码来源:KMeansDistortionMapReduceTest.java

示例9: testMapperWithMidRankedKey

import org.apache.hadoop.io.ObjectWritable; //导入方法依赖的package包/类
@Test
public void testMapperWithMidRankedKey()
		throws IOException {

	capturedObjects.clear();
	mapDriver.getConfiguration().setClass(
			GeoWaveConfiguratorBase.enumToConfKey(
					KSamplerMapReduce.class,
					SampleParameters.Sample.SAMPLE_RANK_FUNCTION),
			TestSamplingMidRankFunction.class,
			SamplingRankFunction.class);

	final GeoWaveInputKey inputKey = new GeoWaveInputKey();
	inputKey.setAdapterId(testObjectAapter.getAdapterId());
	inputKey.setDataId(new ByteArrayId(
			"abc".getBytes()));

	final ObjectWritable ow = new ObjectWritable();
	ow.set(new TestObjectWritable(
			new TestObject(
					new Coordinate(
							25.4,
							25.6),
					"abc")));

	final GeoWaveInputKey outputKey = new GeoWaveInputKey();
	outputKey.setAdapterId(testObjectAapter.getAdapterId());

	final ByteBuffer keyBuf = ByteBuffer.allocate(64);
	keyBuf.putDouble(0.5);
	keyBuf.putInt(1);
	keyBuf.put("1".getBytes());
	keyBuf.putInt(3);
	keyBuf.put(inputKey.getDataId().getBytes());
	outputKey.setDataId(new ByteArrayId(
			keyBuf.array()));

	mapDriver.withInput(
			inputKey,
			ow);

	final List<Pair<GeoWaveInputKey, ObjectWritable>> results = mapDriver.run();
	// output key has the dataID adjusted to contain the rank
	assertEquals(
			results.get(
					0).getFirst(),
			outputKey);
	// output value is the same as input value
	assertEquals(
			results.get(
					0).getSecond().get(),
			ow.get());

	// results from sample rank function to make sure it was provided the
	// correct object
	assertEquals(
			1,
			capturedObjects.size());
	assertEquals(
			"abc",
			((TestObject) capturedObjects.get(0)).id);
}
 
开发者ID:locationtech,项目名称:geowave,代码行数:63,代码来源:KSamplerMapReduceTest.java

示例10: testMapperWithZeroRank

import org.apache.hadoop.io.ObjectWritable; //导入方法依赖的package包/类
@Test
public void testMapperWithZeroRank()
		throws IOException {
	capturedObjects.clear();
	mapDriver.getConfiguration().setClass(
			GeoWaveConfiguratorBase.enumToConfKey(
					KSamplerMapReduce.class,
					SampleParameters.Sample.SAMPLE_RANK_FUNCTION),
			TestSamplingNoRankFunction.class,
			SamplingRankFunction.class);

	final GeoWaveInputKey inputKey = new GeoWaveInputKey();
	inputKey.setAdapterId(testObjectAapter.getAdapterId());
	inputKey.setDataId(new ByteArrayId(
			"abc".getBytes()));

	final ObjectWritable ow = new ObjectWritable();
	ow.set(new TestObjectWritable(
			new TestObject(
					new Coordinate(
							25.4,
							25.6),
					"abc")));

	final GeoWaveInputKey outputKey = new GeoWaveInputKey();
	outputKey.setAdapterId(testObjectAapter.getAdapterId());

	final ByteBuffer keyBuf = ByteBuffer.allocate(64);
	keyBuf.putDouble(0.0);
	keyBuf.putInt(3);
	keyBuf.put(inputKey.getDataId().getBytes());
	outputKey.setDataId(new ByteArrayId(
			keyBuf.array()));

	mapDriver.withInput(
			inputKey,
			ow);

	final List<Pair<GeoWaveInputKey, ObjectWritable>> results = mapDriver.run();

	assertEquals(
			0,
			results.size());

	// results from sample rank function to make sure it was provided the
	// correct object
	assertEquals(
			1,
			capturedObjects.size());
	assertEquals(
			"abc",
			((TestObject) capturedObjects.get(0)).id);
}
 
开发者ID:locationtech,项目名称:geowave,代码行数:54,代码来源:KSamplerMapReduceTest.java


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