Package org.apache.hadoop.zebra.types

Examples of org.apache.hadoop.zebra.types.Schema


    @Override
    public void configure(JobConf job) {
      bytesKey = new BytesWritable();
      try {
        Schema outSchema = BasicTableOutputFormat.getSchema(job);
        tupleRow = TypesUtils.createTuple(outSchema);
      } catch (IOException e) {
        throw new RuntimeException(e);
      } catch (ParseException e) {
        throw new RuntimeException(e);
View Full Code Here


    pathTable1 = new Path(pathWorking, "TestBasicTableUnion" + "1");
    System.out.println("pathTable1 =" + pathTable1);

    BasicTable.Writer writer = new BasicTable.Writer(pathTable1,
        "a:string,b,c:string", "[a,b];[c]", false, conf);
    Schema schema = writer.getSchema();
    Tuple tuple = TypesUtils.createTuple(schema);

    final int numsBatch = 10;
    final int numsInserters = 2;
    TableInserter[] inserters = new TableInserter[numsInserters];
View Full Code Here

     */
    @Override
    public void configure(JobConf job) {
      bytesKey = new BytesWritable();
      try {
        Schema outSchema = BasicTableOutputFormat.getSchema(job);
        tupleRow = TypesUtils.createTuple(outSchema);
      } catch (IOException e) {
        throw new RuntimeException(e);
      } catch (ParseException e) {
        throw new RuntimeException(e);
View Full Code Here

public class TestSchemaPrimitive {
  @Test
  public void testSchemaValid1() throws ParseException {
    String strSch = "f1:int, f2:long, f3:float, f4:bool, f5:string, f6:bytes";
    TableSchemaParser parser;
    Schema schema;

    parser = new TableSchemaParser(new StringReader(strSch));
    schema = parser.RecordSchema(null);
    System.out.println(schema);

    ColumnSchema f2 = schema.getColumn(1);
    Assert.assertEquals("f2", f2.name);
    Assert.assertEquals(ColumnType.LONG, f2.type);
  }
View Full Code Here

  @Test
  public void testSchemaValid2() throws ParseException {
    String strSch = "f1:int, f2, f3:float, f4, f5:string, f6:bytes";
    TableSchemaParser parser;
    Schema schema;

    parser = new TableSchemaParser(new StringReader(strSch));
    schema = parser.RecordSchema(null);
    System.out.println(schema);

    ColumnSchema f2 = schema.getColumn(1);
    Assert.assertEquals("f2", f2.name);
    Assert.assertEquals(ColumnType.BYTES, f2.type);

    ColumnSchema f4 = schema.getColumn(3);
    Assert.assertEquals("f4", f4.name);
    Assert.assertEquals(ColumnType.BYTES, f4.type);
  }
View Full Code Here

  @Test
  public void testSchemaInvalid1() {
    try {
      String strSch = "f1:int, f2:xyz, f3:float";
      TableSchemaParser parser;
      Schema schema;

      parser = new TableSchemaParser(new StringReader(strSch));
      schema = parser.RecordSchema(null);
      System.out.println(schema);
    } catch (Exception e) {
View Full Code Here

  @Test
  public void testSchemaInvalid2() {
    try {
      String strSch = "f1:";
      TableSchemaParser parser;
      Schema schema;

      parser = new TableSchemaParser(new StringReader(strSch));
      schema = parser.RecordSchema(null);
      System.out.println(schema);
    } catch (Exception e) {
View Full Code Here

  @Test
  public void testSchemaInvalid3() {
    try {
      String strSch = ":";
      TableSchemaParser parser;
      Schema schema;

      parser = new TableSchemaParser(new StringReader(strSch));
      schema = parser.RecordSchema(null);
      System.out.println(schema);
    } catch (Exception e) {
View Full Code Here

  @Test
  public void testSchemaInvalid4() {
    try {
      String strSch = "f1:int abc";
      TableSchemaParser parser;
      Schema schema;

      parser = new TableSchemaParser(new StringReader(strSch));
      schema = parser.RecordSchema(null);
      System.out.println(schema);
    } catch (Exception e) {
View Full Code Here

    pathTable = new Path(pathWorking, "TestMapTableStorer");
    System.out.println("table path=" + pathTable);
    BasicTable.Writer writer = new BasicTable.Writer(pathTable,
        "m:map(string)", "[m#{a}]", false, conf);
    Schema schema = writer.getSchema();
    Tuple tuple = TypesUtils.createTuple(schema);

    final int numsBatch = 10;
    final int numsInserters = 2;
    TableInserter[] inserters = new TableInserter[numsInserters];
View Full Code Here

TOP

Related Classes of org.apache.hadoop.zebra.types.Schema

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.