本文整理匯總了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();
}
}
示例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));
}
示例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)));
}
示例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());
}
}
示例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();
}
示例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());
}
}
示例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();
}