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