Examples of BooleanWritable


Examples of org.apache.hadoop.io.BooleanWritable

    }

    @Override
    Object next(Object previous) throws IOException {
      super.next(previous);
      BooleanWritable result = null;
      if (valuePresent) {
        if (previous == null) {
          result = new BooleanWritable();
        } else {
          result = (BooleanWritable) previous;
        }
        result.set(reader.next() == 1);
      }
      return result;
    }
View Full Code Here

Examples of org.apache.hadoop.io.BooleanWritable

    // row 1
    OrcStruct row = (OrcStruct) rows.next(null);
    assertNotNull(row);
    assertNull(row.getFieldValue(0));
    assertNull(row.getFieldValue(1));
    assertEquals(new BooleanWritable(true), row.getFieldValue(2));
    assertEquals(new IntWritable(100),
        ((OrcStruct) ((ArrayList<?>) row.getFieldValue(3)).get(0)).
                 getFieldValue(0));

    rows.seekToRow(19998);
    // last-1 row
    row = (OrcStruct) rows.next(null);
    assertNotNull(row);
    assertNotNull(row.getFieldValue(1));
    assertEquals(new IntWritable(0), row.getFieldValue(0));
    assertEquals(new BooleanWritable(true), row.getFieldValue(2));
    assertEquals(new IntWritable(100),
        ((OrcStruct) ((ArrayList<?>) row.getFieldValue(3)).get(0)).
                 getFieldValue(0));

    // last row
    row = (OrcStruct) rows.next(row);
    assertNotNull(row);
    assertNull(row.getFieldValue(0));
    assertNull(row.getFieldValue(1));
    assertEquals(new BooleanWritable(true), row.getFieldValue(2));
    assertEquals(new IntWritable(100),
        ((OrcStruct) ((ArrayList<?>) row.getFieldValue(3)).get(0)).
                 getFieldValue(0));

    rows.close();
View Full Code Here

Examples of org.apache.hadoop.io.BooleanWritable

    OrcStruct row = (OrcStruct) rows.next(null);
    assertNotNull(row);
    assertNotNull(row.getFieldValue(1));
    assertEquals(new IntWritable(0), row.getFieldValue(0));
    assertEquals("a", row.getFieldValue(1).toString());
    assertEquals(new BooleanWritable(true), row.getFieldValue(2));
    assertEquals(new IntWritable(100),
                 ((OrcStruct) ((ArrayList<?>) row.getFieldValue(3)).get(0)).
                   getFieldValue(0));

    // last row
    row = (OrcStruct) rows.next(row);
    assertNotNull(row);
    assertNotNull(row.getFieldValue(0));
    assertNotNull(row.getFieldValue(1));
    assertEquals("b", row.getFieldValue(1).toString());
    assertEquals(new BooleanWritable(true), row.getFieldValue(2));
    assertEquals(new IntWritable(100),
                 ((OrcStruct) ((ArrayList<?>) row.getFieldValue(3)).get(0)).
                   getFieldValue(0));
    rows.close();
  }
View Full Code Here

Examples of org.apache.hadoop.io.BooleanWritable

    // row 1
    OrcStruct row = (OrcStruct) rows.next(null);
    assertNotNull(row);
    assertEquals(new IntWritable(3), row.getFieldValue(0));
    assertEquals("a", row.getFieldValue(1).toString());
    assertEquals(new BooleanWritable(true), row.getFieldValue(2));
    assertEquals(new IntWritable(100),
        ((OrcStruct) ((ArrayList<?>) row.getFieldValue(3)).get(0)).
                 getFieldValue(0));

    // row 2
    row = (OrcStruct) rows.next(row);
    assertNotNull(row);
    assertNull(row.getFieldValue(0));
    assertEquals("b", row.getFieldValue(1).toString());
    assertEquals(new BooleanWritable(true), row.getFieldValue(2));
    assertEquals(new IntWritable(100),
        ((OrcStruct) ((ArrayList<?>) row.getFieldValue(3)).get(0)).
                 getFieldValue(0));

    // row 3
    row = (OrcStruct) rows.next(row);
    assertNotNull(row);
    assertNull(row.getFieldValue(1));
    assertEquals(new IntWritable(3), row.getFieldValue(0));
    assertEquals(new BooleanWritable(false), row.getFieldValue(2));
    assertEquals(new IntWritable(100),
                 ((OrcStruct) ((ArrayList<?>) row.getFieldValue(3)).get(0)).
                 getFieldValue(0));
    rows.close();
  }
View Full Code Here

Examples of org.apache.hadoop.io.BooleanWritable

        final Path file = new Path(new File("target/test/test-camel-boolean").getAbsolutePath());
        Configuration conf = new Configuration();
        FileSystem fs1 = FileSystem.get(file.toUri(), conf);
        SequenceFile.Writer writer = createWriter(fs1, conf, file, NullWritable.class, BooleanWritable.class);
        NullWritable keyWritable = NullWritable.get();
        BooleanWritable valueWritable = new BooleanWritable();
        valueWritable.set(true);
        writer.append(keyWritable, valueWritable);
        writer.sync();
        writer.close();

        context.addRoutes(new RouteBuilder() {
View Full Code Here

Examples of org.apache.hadoop.io.BooleanWritable

        hiveTypeToJson(new MyHiveType(new FloatWritable(Float.MAX_VALUE), floatTypeInfo));
    }

    @Test
    public void testBoolean() {
        hiveTypeToJson(new MyHiveType(new BooleanWritable(Boolean.TRUE), booleanTypeInfo));
    }
View Full Code Here

Examples of org.apache.hadoop.io.BooleanWritable

        assertEquals(Float.MAX_VALUE + "", typeFromJson + "");
    }

    @Override
    public void checkBoolean(Object typeFromJson) {
        assertEquals(new BooleanWritable(Boolean.TRUE), typeFromJson);
    }
View Full Code Here

Examples of org.apache.hadoop.io.BooleanWritable

        writableTypeToJson(new FloatWritable(Float.MAX_VALUE));
    }

    @Test
    public void testBoolean() {
        writableTypeToJson(new BooleanWritable(Boolean.TRUE));
    }
View Full Code Here

Examples of org.apache.hadoop.io.BooleanWritable

    @Test
    public void testMap() {
        LinkedMapWritable map = new LinkedMapWritable();
        map.put(new Text("key"), new IntWritable(1));
        map.put(new BooleanWritable(Boolean.TRUE), new ArrayWritable(new String[] { "one", "two" }));
        writableTypeToJson(map);
    }
View Full Code Here

Examples of org.apache.hadoop.io.BooleanWritable

  @Test
  public void testConvertBooleanWritable() {
    AvroDatumConverter<BooleanWritable, Boolean> converter
        = mFactory.create(BooleanWritable.class);
    assertEquals(true, converter.convert(new BooleanWritable(true)).booleanValue());
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.