Package org.apache.hadoop.io

Examples of org.apache.hadoop.io.BooleanWritable


          } else if (args[i] instanceof ImmutableBytesWritable) {
            arr[i] = (ImmutableBytesWritable)args[i];
          } else if (args[i] instanceof String) {
            arr[i] = new ImmutableBytesWritable(Bytes.toBytes((String)args[i]));
          } else if (args[i] instanceof Boolean) {
            arr[i] = new BooleanWritable((Boolean) args[i]);
          } else {
            throw new IllegalArgumentException("Requires byte [] or " +
              "ImmutableBytesWritable, not " + args[i]);
          }
        }
View Full Code Here


  private boolean getDaughterRowChecked(final Result rowContent,
    final byte[] which)
  throws IOException {
    final byte[] b = rowContent.getValue(HConstants.CATALOG_FAMILY,
      getNameOfVerifiedDaughterColumn(which));
    BooleanWritable bw = null;
    if (b != null && b.length > 0) {
      bw = (BooleanWritable)Writables.getWritable(b, new BooleanWritable());
    }
    return bw == null? false: bw.get();
  }
View Full Code Here

public class BooleanWritableTest extends WritableTestBase {
 
  @Test
  public void test() throws IOException {
    BooleanWritable src = new BooleanWritable(true);
    BooleanWritable dest = new BooleanWritable();
    assertThat(writeTo(src, dest), is("01"));
    assertThat(dest.get(), is(src.get()));
  }
View Full Code Here

          inputs.stringValues, inputs.byteValues, inputs.words, rowNumber);
      break;
    }

    OrcLazyBoolean lazyBoolean1 = (OrcLazyBoolean) row.getFieldValue(0);
    BooleanWritable boolean1 = (BooleanWritable) lazyBoolean1.materialize();
    if (boolean1 == null) {
      assertNull(expected.boolean1);
    } else {
      assertEquals(expected.boolean1.booleanValue(), boolean1.get());
    }

    ByteWritable byte1 = (ByteWritable) ((OrcLazyByte) row.getFieldValue(1)).materialize();
    if (byte1 == null) {
      assertNull(expected.byte1);
View Full Code Here

      int nextCalls = 0;

      @Override
      public Object next(Object previous) throws IOException {
        if (nextCalls == 0) {
          return new BooleanWritable(true);
        }

        throw new IOException("next should only be called once");
      }
View Full Code Here

  private static Log LOG = LogFactory.getLog(UDFOPGreaterThan.class.getName());

  BooleanWritable resultCache;
  public UDFOPGreaterThan() {
    resultCache = new BooleanWritable();
  }
View Full Code Here

  public UDFOPGreaterThan() {
    resultCache = new BooleanWritable();
  }

  public BooleanWritable evaluate(Text a, Text b)  {
    BooleanWritable r = this.resultCache;
    if ((a == null) || (b == null)) {
      r = null;
    } else {
      r.set(ShimLoader.getHadoopShims().compareText(a, b) > 0);
    }
    // LOG.info("evaluate(" + a + "," + b + ")=" + r);
    return r;
  }
View Full Code Here

    // LOG.info("evaluate(" + a + "," + b + ")=" + r);
    return r;
  }

  public BooleanWritable evaluate(ByteWritable a, ByteWritable b)  {
    BooleanWritable r = this.resultCache;
    if ((a == null) || (b == null)) {
      r = null;
    } else {
      r.set(a.get() > b.get());
    }
    // LOG.info("evaluate(" + a + "," + b + ")=" + r);
    return r;
  }
View Full Code Here

    // LOG.info("evaluate(" + a + "," + b + ")=" + r);
    return r;
  }

  public BooleanWritable evaluate(ShortWritable a, ShortWritable b)  {
    BooleanWritable r = this.resultCache;
    if ((a == null) || (b == null)) {
      r = null;
    } else {
      r.set(a.get() > b.get());
    }
    // LOG.info("evaluate(" + a + "," + b + ")=" + r);
    return r;
  }
View Full Code Here

    // LOG.info("evaluate(" + a + "," + b + ")=" + r);
    return r;
  }

  public BooleanWritable evaluate(IntWritable a, IntWritable b)  {
    BooleanWritable r = this.resultCache;
    if ((a == null) || (b == null)) {
      r = null;
    } else {
      r.set(a.get() > b.get());
    }
    // LOG.info("evaluate(" + a + "," + b + ")=" + r);
    return r;
  }
View Full Code Here

TOP

Related Classes of org.apache.hadoop.io.BooleanWritable

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.