Package org.apache.hadoop.zebra.io

Examples of org.apache.hadoop.zebra.io.TableScanner.advance()


    Assert.assertEquals(null, (((Map) RowValue.get(6)).get("ytestid")));
    Assert.assertEquals(null, ((Map) ((Map) RowValue.get(6)).get("x")));
    System.out.println("rowValue.get)1): " + RowValue.get(6).toString());
    // rowValue.get)1): {z=null, x={m311=311, m321=321, m331=331}}

    scanner.advance();

    scanner.getKey(key);
    Assert.assertEquals(key, new BytesWritable("k12".getBytes()));
    scanner.getValue(RowValue);
    Assert.assertEquals("key572", ((Map) RowValue.get(4)).get("key57"));
View Full Code Here


    scanner.getValue(RowValue);
    Assert.assertEquals(false, RowValue.isNull());
    Assert.assertEquals(null, RowValue.get(0));
    Assert.assertEquals(1, RowValue.size());

    scanner.advance();
    scanner.getKey(key);
    Assert.assertEquals(key, new BytesWritable("k12".getBytes()));
    scanner.getValue(RowValue);
    Assert.assertEquals(false, RowValue.isNull());
    Assert.assertEquals(null, RowValue.get(0));
View Full Code Here

    Assert.assertEquals(key, new BytesWritable("k11".getBytes()));
    scanner.getValue(RowValue);
    System.out.println("read1 : " + RowValue.toString());
    Assert.assertEquals("{}", RowValue.get(0).toString());

    scanner.advance();
    scanner.getKey(key);
    Assert.assertEquals(key, new BytesWritable("k12".getBytes()));
    scanner.getValue(RowValue);
    System.out.println(RowValue.get(0).toString());
    Assert.assertEquals("{}", RowValue.get(0).toString());
View Full Code Here

    scanner.getValue(value);

    Assert.assertEquals(1001L, value.get(0));
    Assert.assertEquals(true, value.get(1));

    scanner.advance();
    scanner.getKey(key);
    Assert.assertEquals(key, new BytesWritable("k12".getBytes()));
    scanner.getValue(value);
    Assert.assertEquals(1002L, value.get(0));
    Assert.assertEquals(false, value.get(1));
View Full Code Here

              "\n actual value   : " + newValLong1, (numbRows-1 + 4) / 4,
              newValLong1);

        }

        scanner.advance();
      }


    }
View Full Code Here

    BytesWritable key = new BytesWritable();

    while (!scanner.atEnd()) {
      ++numbRows;
      scanner.getKey(key);
      scanner.advance();
    }
    System.out.println("\nTable Path : " + pathTable1);
    System.out.println("Table Row number : " + numbRows);
  }
View Full Code Here

  long countRows(Path tablePath) throws IOException, ParseException {
    BasicTable.Reader reader = new BasicTable.Reader(tablePath, conf);
    reader.setProjection("");
    long totalRows = 0;
    TableScanner scanner = reader.getScanner(null, true);
    for (; !scanner.atEnd(); scanner.advance()) {
      ++totalRows;
    }
    scanner.close();
    return totalRows;
  }
View Full Code Here

    reader.setProjection("count");
    TableScanner scanner = reader.getScanner(null, true);
    Tuple tuple = TypesUtils.createTuple(Projection.toSchema(scanner
        .getProjection()));
    BytesWritable key = new BytesWritable();
    for (; !scanner.atEnd(); scanner.advance()) {
      scanner.getKey(key);
      scanner.getValue(tuple);
      int count = 0;
      try {
        count = (Integer) tuple.get(0);
View Full Code Here

    TableScanner scanner = reader.getScanner(null, true);
    BytesWritable key = new BytesWritable();
    Schema schema = Projection.toSchema(scanner.getProjection());
    int idxCount = schema.getColumnIndex("count");
    Tuple value = TypesUtils.createTuple(schema);
    for (; !scanner.atEnd(); scanner.advance()) {
      scanner.getKey(key);
      scanner.getValue(value);
      try {
        String word = new String(key.get(), 0, key.getSize());
        int count = (Integer) value.get(idxCount);
View Full Code Here

      Assert.fail("Failed to catch out of boundary exceptions.");
    } catch (IndexOutOfBoundsException e) {
      // no op, expecting out of bounds exceptions
    }

    scanner.advance();
    scanner.getKey(key);
    Assert.assertEquals(key, new BytesWritable("k2".getBytes()));
    TypesUtils.resetTuple(row);
    scanner.getValue(row);
    // Assert.assertEquals("c2", row.get(0));
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.