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


Java BooleanWritable.get方法代码示例

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


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

示例1: parseBooleanColumn

import org.apache.hadoop.io.BooleanWritable; //导入方法依赖的package包/类
private void parseBooleanColumn(int column)
{
    // don't include column number in message because it causes boxing which is expensive here
    checkArgument(!isPartitionColumn[column], "Column is a partition key");

    loaded[column] = true;

    Object object = getMaterializedValue(column);

    if (object == null) {
        nulls[column] = true;
    }
    else {
        nulls[column] = false;
        BooleanWritable booleanWritable = checkWritable(object, BooleanWritable.class);
        booleans[column] = booleanWritable.get();
    }
}
 
开发者ID:y-lan,项目名称:presto,代码行数:19,代码来源:DwrfHiveRecordCursor.java

示例2: reduce

import org.apache.hadoop.io.BooleanWritable; //导入方法依赖的package包/类
/***
 * reduce function estimates the value of PI.
 */
@Override
protected void reduce(Text key, Iterable<BooleanWritable> values,
			Context context) throws IOException, InterruptedException {
	
	if(key.toString().equalsIgnoreCase("monte-carlo")){
		
		MonteCarloReducer.TOTAL_NO_POINTS = MonteCarloReducer.TOTAL_NO_POINTS + 1;
		for(BooleanWritable value : values){
			if(value.get()){
				MonteCarloReducer.TOTAL_POINTS_INSIDE_CIRCLE = MonteCarloReducer.TOTAL_POINTS_INSIDE_CIRCLE + 1;
			}
		}
	}
	
	//Estimate the value of PI and write it to the output file.
	float pi = 4*(TOTAL_POINTS_INSIDE_CIRCLE/TOTAL_NO_POINTS);
	context.write(new Text("Value of PI:"), new DoubleWritable(pi));
}
 
开发者ID:joyghosh,项目名称:mapreduce,代码行数:22,代码来源:MonteCarloReducer.java

示例3: reduce

import org.apache.hadoop.io.BooleanWritable; //导入方法依赖的package包/类
@Override
protected void reduce(BytesWritable wordtimeb, Iterable<BooleanWritable> wordBools, Reducer<BytesWritable,BooleanWritable,LongWritable,BytesWritable>.Context context) throws IOException ,InterruptedException {
	ReadWritableStringLong wordtime = IOUtils.deserialize(wordtimeb.getBytes(), ReadWritableStringLong.class);
	long time = wordtime.secondObject();
	boolean seenInPresent = false;
	boolean seenInPast = false;
	for (BooleanWritable isfrompast: wordBools) {
		boolean frompast = isfrompast.get();
		seenInPresent |= !frompast;
		seenInPast |= frompast;
		if(seenInPast && seenInPresent){
			// then we've seen all the ones from this time if we were to see them, so we can break early. MASSIVE SAVINGS HERE
			break;
		}
	}
	ReadWritableBooleanBoolean intersectionUnion = new ReadWritableBooleanBoolean(seenInPast && seenInPresent,seenInPast || seenInPresent);
	context.write(new LongWritable(time), new BytesWritable(IOUtils.serialize(intersectionUnion)));
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:19,代码来源:CumulativeTimeWord.java

示例4: reduce

import org.apache.hadoop.io.BooleanWritable; //导入方法依赖的package包/类
/**
 * Accumulate number of points inside/outside results from the mappers.
 * @param isInside Is the points inside? 
 * @param values An iterator to a list of point counts
 * @param output dummy, not used here.
 * @param reporter
 */
public void reduce(BooleanWritable isInside,
                   Iterator<LongWritable> values,
                   Context context) throws IOException {
  if (isInside.get()) {
    for(; values.hasNext(); numInside += values.next().get());
  } else {
    for(; values.hasNext(); numOutside += values.next().get());
  }
}
 
开发者ID:yncxcw,项目名称:big-c,代码行数:17,代码来源:PiEstimator.java

示例5: getConstBoolean

import org.apache.hadoop.io.BooleanWritable; //导入方法依赖的package包/类
public static boolean getConstBoolean(@Nonnull final ObjectInspector oi)
        throws UDFArgumentException {
    if (!isBooleanOI(oi)) {
        throw new UDFArgumentException("argument must be a Boolean value: "
                + TypeInfoUtils.getTypeInfoFromObjectInspector(oi));
    }
    BooleanWritable v = getConstValue(oi);
    return v.get();
}
 
开发者ID:apache,项目名称:incubator-hivemall,代码行数:10,代码来源:HiveUtils.java

示例6: reduce

import org.apache.hadoop.io.BooleanWritable; //导入方法依赖的package包/类
/**
 * Accumulate number of points inside/outside results from the mappers.
 * @param isInside Is the points inside? 
 * @param values An iterator to a list of point counts
 * @param output dummy, not used here.
 * @param reporter
 */
public void reduce(BooleanWritable isInside,
                   Iterator<LongWritable> values,
                   OutputCollector<WritableComparable<?>, Writable> output,
                   Reporter reporter) throws IOException {
  if (isInside.get()) {
    for(; values.hasNext(); numInside += values.next().get());
  } else {
    for(; values.hasNext(); numOutside += values.next().get());
  }
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:18,代码来源:PiEstimator.java

示例7: readBoolean

import org.apache.hadoop.io.BooleanWritable; //导入方法依赖的package包/类
/** read the boolean value */
static boolean readBoolean(DataInput in) throws IOException {
  BooleanWritable uBoolean = TL_DATA.get().U_BOOLEAN;
  uBoolean.readFields(in);
  return uBoolean.get();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:7,代码来源:FSImageSerialization.java


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