Package org.apache.hadoop.zebra.io

Examples of org.apache.hadoop.zebra.io.TableScanner


    String projection = new String("a,b,c,d,e,f,r1,m1");
   
    BasicTable.Reader reader = new BasicTable.Reader(pathTable1, conf);
    reader.setProjection(projection);
    List<RangeSplit> splits = reader.rangeSplit(1);
    TableScanner scanner = reader.getScanner(splits.get(0), true);
    BytesWritable key = new BytesWritable();
    Tuple RowValue = TypesUtils.createTuple(scanner.getSchema());
 
    scanner.getValue(RowValue);
    System.out.println("rowvalue size:"+RowValue.size());
    System.out.println("read a : " + RowValue.get(0).toString());
    System.out.println("read string: " + RowValue.get(1).toString());
 
    scanner.advance();
    scanner.getValue(RowValue);
    System.out.println("read float in 2nd row: "+ RowValue.get(1).toString());
    System.out.println("done insert table");
 
    reader.close();
   
View Full Code Here


    String projection = new String("a,b,c,d,e,f,r1,m1");
   
    BasicTable.Reader reader = new BasicTable.Reader(pathTable2, conf);
    reader.setProjection(projection);
    List<RangeSplit> splits = reader.rangeSplit(1);
    TableScanner scanner = reader.getScanner(splits.get(0), true);
    BytesWritable key = new BytesWritable();
    Tuple RowValue = TypesUtils.createTuple(scanner.getSchema());

    /*
    scanner.getValue(RowValue);
    System.out.println("rowvalue size:"+RowValue.size());
    System.out.println("read a : " + RowValue.get(7).toString());
View Full Code Here

      boolean s1dropped, boolean s2dropped) throws IOException, ParseException {
    System.out.println(myuser + "is reading....");
    BasicTable.Reader reader = new BasicTable.Reader(path, conf);
    reader.setProjection(projection);
    List<RangeSplit> splits = reader.rangeSplit(1);
    TableScanner scanner = reader.getScanner(splits.get(0), true);
    BytesWritable key = new BytesWritable();
    Tuple RowValue = TypesUtils.createTuple(scanner.getSchema());

    scanner.getKey(key);
    // Assert.assertEquals(key, new BytesWritable("k11".getBytes()));
    scanner.getValue(RowValue);
    if (s1dropped == true) {
      Assert.assertEquals(null, RowValue.get(0));
    } else {
      Assert.assertEquals("column1_1", RowValue.get(0));
    }
    if (s2dropped == true) {
      Assert.assertEquals(null, RowValue.get(1));
    } else {
      Assert.assertEquals("column2_1", RowValue.get(1));
    }
    scanner.advance();
    scanner.getKey(key);
    // Assert.assertEquals(key, new BytesWritable("k12".getBytes()));
    scanner.getValue(RowValue);
    if (s1dropped == true) {
      Assert.assertEquals(null, RowValue.get(0));
    } else {
      Assert.assertEquals("column1_2", RowValue.get(0));
    }
View Full Code Here

    String projection = new String("a,b,c,d,e,f,r1,m1");
   
    BasicTable.Reader reader = new BasicTable.Reader(pathTable1, conf);
    reader.setProjection(projection);
    List<RangeSplit> splits = reader.rangeSplit(1);
    TableScanner scanner = reader.getScanner(splits.get(0), true);
    BytesWritable key = new BytesWritable();
    Tuple RowValue = TypesUtils.createTuple(scanner.getSchema());
 
    scanner.getValue(RowValue);
    System.out.println("rowvalue size:"+RowValue.size());
    System.out.println("read a : " + RowValue.get(0).toString());
    System.out.println("read string: " + RowValue.get(1).toString());
 
    scanner.advance();
    scanner.getValue(RowValue);
    System.out.println("read float in 2nd row: "+ RowValue.get(1).toString());
    System.out.println("done insert table");
 
    reader.close();
   
View Full Code Here

    String projection = new String("a,b,c,d,e,f,r1,m1");
   
    BasicTable.Reader reader = new BasicTable.Reader(pathTable2, conf);
    reader.setProjection(projection);
    List<RangeSplit> splits = reader.rangeSplit(1);
    TableScanner scanner = reader.getScanner(splits.get(0), true);
    BytesWritable key = new BytesWritable();
    Tuple RowValue = TypesUtils.createTuple(scanner.getSchema());

    scanner.getValue(RowValue);
    System.out.println("rowvalue size:"+RowValue.size());
    System.out.println("read a : " + RowValue.get(7).toString());
    System.out.println("read string: " + RowValue.get(6).toString());
  
    scanner.advance();
    scanner.getValue(RowValue);
    System.out.println("read float in 2nd row: "+ RowValue.get(6).toString());
    System.out.println("done insert table");


    reader.close();
View Full Code Here

    List<RangeSplit> splits = reader.rangeSplit(1);
    reader.close();
    reader = new BasicTable.Reader(path, conf);
    reader.setProjection(projection);
    TableScanner scanner = reader.getScanner(splits.get(0), true);
    BytesWritable key = new BytesWritable();
    Tuple value = TypesUtils.createTuple(scanner.getSchema());

    scanner.getKey(key);
    Assert.assertEquals(key, new BytesWritable("k11".getBytes()));
    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));

    reader.close();
  }
View Full Code Here

    List<RangeSplit> splits = reader.rangeSplit(1);
    reader.close();
    reader = new BasicTable.Reader(path, conf);
    reader.setProjection(projection);
    TableScanner scanner = reader.getScanner(splits.get(0), true);
    BytesWritable key = new BytesWritable();
    Tuple value = TypesUtils.createTuple(scanner.getSchema());

    scanner.getKey(key);
    Assert.assertEquals(key, new BytesWritable("k11".getBytes()));
    scanner.getValue(value);

    Tuple recordTuple = (Tuple) value.get(1);
    Assert.assertEquals(1, recordTuple.get(0));
    Assert.assertEquals(1001L, recordTuple.get(1));
    Assert.assertEquals(true, value.get(0));
View Full Code Here

    List<RangeSplit> splits = reader.rangeSplit(1);
    reader.close();
    reader = new BasicTable.Reader(pathTable, conf);
    reader.setProjection(projection);

    TableScanner scanner = reader.getScanner(splits.get(0), true);
    BytesWritable key = new BytesWritable();
    Tuple value = TypesUtils.createTuple(scanner.getSchema());
    // HashMap<String, Object> mapval;
    while (!scanner.atEnd()) {
      scanner.getKey(key);
      // Assert.assertEquals(key, new BytesWritable("key0".getBytes()));
      scanner.getValue(value);
      System.out.println("key = " + key + " value = " + value);

      // mapval = (HashMap<String, Object>) value.get(0);
      // Assert.assertEquals("x", mapval.get("a"));
      // Assert.assertEquals(null, mapval.get("b"));
      // Assert.assertEquals(null, mapval.get("c"));
      scanner.advance();
    }
    reader.close();
  }
View Full Code Here

    List<RangeSplit> splits = reader.rangeSplit(1);
    reader.close();
    reader = new BasicTable.Reader(path, conf);
    reader.setProjection(projection);
    TableScanner scanner = reader.getScanner(splits.get(0), true);
    BytesWritable key = new BytesWritable();
    Tuple value = TypesUtils.createTuple(scanner.getSchema());

    scanner.getKey(key);
    Assert.assertEquals(key, new BytesWritable("k11".getBytes()));
    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));

    reader.close();
  }
View Full Code Here

    List<RangeSplit> splits = reader.rangeSplit(1);
    reader.close();
    reader = new BasicTable.Reader(path, conf);
    reader.setProjection(projection);
    TableScanner scanner = reader.getScanner(splits.get(0), true);
    BytesWritable key = new BytesWritable();
    Tuple value = TypesUtils.createTuple(scanner.getSchema());

    scanner.getKey(key);
    Assert.assertEquals(key, new BytesWritable("k11".getBytes()));
    scanner.getValue(value);

    Tuple recordTuple = (Tuple) value.get(1);
    Assert.assertEquals(1, recordTuple.get(0));
    Assert.assertEquals(1001L, recordTuple.get(1));
    Assert.assertEquals(true, value.get(0));
View Full Code Here

TOP

Related Classes of org.apache.hadoop.zebra.io.TableScanner

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.