Package org.apache.hadoop.zebra.schema.Schema

Examples of org.apache.hadoop.zebra.schema.Schema.ColumnSchema


      }
      CGSchema cgs1 = cgschemas[0];
      CGSchema cgs2 = cgschemas[1];
      CGSchema cgs3 = cgschemas[2];

      ColumnSchema f11 = cgs1.getSchema().getColumn(0);
      Assert.assertEquals(f11.getName(), "m1");
      Assert.assertEquals(ColumnType.MAP, f11.getType());

      ColumnSchema f21 = cgs2.getSchema().getColumn(0);
      Assert.assertEquals(f21.getName(), "m2");
      // TODO: type should be MAP!
      Assert.assertEquals(ColumnType.MAP, f21.getType());

      ColumnSchema f22 = cgs2.getSchema().getColumn(1);
      Assert.assertEquals(f22.getName(), "f3");
      Assert.assertEquals(ColumnType.INT, f22.getType());
      ColumnSchema f31 = cgs3.getSchema().getColumn(0);
      Assert.assertEquals(f31.getName(), "m1");
      Assert.assertEquals(ColumnType.MAP, f31.getType());
      ColumnSchema f32 = cgs3.getSchema().getColumn(1);
      Assert.assertEquals(f32.getName(), "m2");
      Assert.assertEquals(ColumnType.MAP, f32.getType());

      System.out.println("*********** Column Map **********");
      Map<String, HashSet<Partition.PartitionInfo.ColumnMappingEntry>> colmap = p
          .getPartitionInfo().getColMap();
      Assert.assertEquals(colmap.size(), 3);
View Full Code Here


      }
      CGSchema cgs1 = cgschemas[0];
      CGSchema cgs2 = cgschemas[1];
      CGSchema cgs3 = cgschemas[2];

      ColumnSchema f11 = cgs1.getSchema().getColumn(0);
      Assert.assertEquals(f11.getName(), "m1");
      Assert.assertEquals(ColumnType.MAP, f11.getType());
      ColumnSchema f21 = cgs2.getSchema().getColumn(0);
      Assert.assertEquals(f21.getName(), "m1");
      Assert.assertEquals(ColumnType.MAP, f21.getType());
      ColumnSchema f22 = cgs2.getSchema().getColumn(1);
      Assert.assertEquals(f22.getName(), "f3");
      Assert.assertEquals(ColumnType.INT, f22.getType());
      ColumnSchema f31 = cgs3.getSchema().getColumn(0);
      Assert.assertEquals(f31.getName(), "m1");
      Assert.assertEquals(ColumnType.MAP, f31.getType());
      ColumnSchema f32 = cgs3.getSchema().getColumn(1);
      Assert.assertEquals(f32.getName(), "m2");
      Assert.assertEquals(ColumnType.MAP, f32.getType());

      System.out.println("*********** Column Map **********");
      Map<String, HashSet<Partition.PartitionInfo.ColumnMappingEntry>> colmap = p
          .getPartitionInfo().getColMap();
      Assert.assertEquals(colmap.size(), 3);
View Full Code Here

        System.out.println("--------------------------------");
      }
      CGSchema cgs1 = cgschemas[0];
      CGSchema cgs2 = cgschemas[1];

      ColumnSchema f11 = cgs1.getSchema().getColumn(0);
      Assert.assertEquals("c", f11.getName());
      Assert.assertEquals(ColumnType.COLLECTION, f11.getType());

      ColumnSchema f21 = cgs2.getSchema().getColumn(0);
      Assert.assertEquals("m1", f21.getName());
      Assert.assertEquals(ColumnType.MAP, f21.getType());

      Assert.assertEquals(cgs1.getCompressor(), "gz");
      Assert.assertEquals(cgs2.getSerializer(), "avro");

      System.out.println("*********** Column Map **********");
 
View Full Code Here

        System.out.println("--------------------------------");
      }
      CGSchema cgs1 = cgschemas[0];
      CGSchema cgs2 = cgschemas[1];

      ColumnSchema f11 = cgs1.getSchema().getColumn(0);
      Assert.assertEquals("c.r", f11.getName());
      Assert.assertEquals(ColumnType.RECORD, f11.getType());

      ColumnSchema f21 = cgs2.getSchema().getColumn(0);
      Assert.assertEquals("m1", f21.getName());
      Assert.assertEquals(ColumnType.MAP, f21.getType());

      Assert.assertEquals(cgs1.getCompressor(), "gz");
      Assert.assertEquals(cgs2.getSerializer(), "avro");

      System.out.println("*********** Column Map **********");
 
View Full Code Here

      }
      CGSchema cgs1 = cgschemas[0];
      CGSchema cgs2 = cgschemas[1];
      CGSchema cgs3 = cgschemas[2];

      ColumnSchema f11 = cgs1.getSchema().getColumn(0);
      Assert.assertEquals("c.r.f1", f11.getName());
      Assert.assertEquals(ColumnType.INT, f11.getType());

      ColumnSchema f21 = cgs2.getSchema().getColumn(0);
      Assert.assertEquals("m1", f21.getName());
      Assert.assertEquals(ColumnType.MAP, f21.getType());

      ColumnSchema f31 = cgs3.getSchema().getColumn(0);
      Assert.assertEquals("c.r.f2", f31.getName());
      Assert.assertEquals(ColumnType.INT, f31.getType());

      Assert.assertEquals(cgs1.getCompressor(), "gz");
      Assert.assertEquals(cgs1.getSerializer(), "pig");
      Assert.assertEquals(cgs2.getCompressor(), "lzo");
      Assert.assertEquals(cgs2.getSerializer(), "avro");
View Full Code Here

        System.out.println("--------------------------------");
      }
      CGSchema cgs1 = cgschemas[0];
      CGSchema cgs2 = cgschemas[1];

      ColumnSchema f11 = cgs1.getSchema().getColumn(0);
      Assert.assertEquals("r1.f1", f11.getName());
      Assert.assertEquals(ColumnType.INT, f11.getType());
      ColumnSchema f12 = cgs1.getSchema().getColumn(1);
      Assert.assertEquals("r2.r3.f3", f12.getName());
      Assert.assertEquals(ColumnType.FLOAT, f12.getType());

      ColumnSchema f21 = cgs2.getSchema().getColumn(0);
      Assert.assertEquals("r1.f2", f21.getName());
      Assert.assertEquals(ColumnType.INT, f21.getType());
      ColumnSchema f22 = cgs2.getSchema().getColumn(1);
      Assert.assertEquals("r2.r3.f4", f22.getName());
      Assert.assertEquals(ColumnType.BYTES, f22.getType());

      System.out.println("*********** Column Map **********");
      Map<String, HashSet<Partition.PartitionInfo.ColumnMappingEntry>> colmap = p
          .getPartitionInfo().getColMap();
      Assert.assertEquals(colmap.size(), 4);
View Full Code Here

    schema = parser.RecordSchema(null);
  }

  @Test
  public void testSchema() throws ParseException {
    ColumnSchema f1 = schema.getColumn(0);
    Assert.assertEquals("f1", f1.getName());
    Assert.assertEquals(ColumnType.INT, f1.getType());
    ColumnSchema f2 = schema.getColumn(1);
    Assert.assertEquals("f2", f2.getName());
    Assert.assertEquals(ColumnType.LONG, f2.getType());
    ColumnSchema f3 = schema.getColumn(2);
    Assert.assertEquals("f3", f3.getName());
    Assert.assertEquals(ColumnType.FLOAT, f3.getType());
    ColumnSchema f4 = schema.getColumn(3);
    Assert.assertEquals("f4", f4.getName());
    Assert.assertEquals(ColumnType.BOOL, f4.getType());
    ColumnSchema f5 = schema.getColumn(4);
    Assert.assertEquals("f5", f5.getName());
    Assert.assertEquals(ColumnType.STRING, f5.getType());
    ColumnSchema f6 = schema.getColumn(5);
    Assert.assertEquals("f6", f6.getName());
    Assert.assertEquals(ColumnType.BYTES, f6.getType());

    System.out.println(schema.toString());
  }
View Full Code Here

      }
      CGSchema cgs1 = cgschemas[0];
      CGSchema cgs2 = cgschemas[1];
      CGSchema cgs3 = cgschemas[2];

      ColumnSchema f11 = cgs1.getSchema().getColumn(0);
      Assert.assertEquals("f1", f11.getName());
      Assert.assertEquals(ColumnType.INT, f11.getType());
      ColumnSchema f12 = cgs1.getSchema().getColumn(1);
      Assert.assertEquals("f2", f12.getName());
      Assert.assertEquals(ColumnType.LONG, f12.getType());
      ColumnSchema f21 = cgs2.getSchema().getColumn(0);
      Assert.assertEquals("f3", f21.getName());
      Assert.assertEquals(ColumnType.FLOAT, f21.getType());
      ColumnSchema f22 = cgs2.getSchema().getColumn(1);
      Assert.assertEquals("f4", f22.getName());
      Assert.assertEquals(ColumnType.BOOL, f22.getType());
      ColumnSchema f31 = cgs3.getSchema().getColumn(0);
      Assert.assertEquals("f5", f31.getName());
      Assert.assertEquals(ColumnType.STRING, f31.getType());
      ColumnSchema f32 = cgs3.getSchema().getColumn(1);
      Assert.assertEquals("f6", f32.getName());
      Assert.assertEquals(ColumnType.BYTES, f32.getType());

      Assert.assertEquals(cgs1.getCompressor(), "gz");
      Assert.assertEquals(cgs1.getSerializer(), "pig");
      Assert.assertEquals(cgs2.getCompressor(), "gz");
      Assert.assertEquals(cgs2.getSerializer(), "avro");
View Full Code Here

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

    // test 1st level schema;
    ColumnSchema f1 = schema.getColumn(0);
    Assert.assertEquals("r1", f1.getName());
    Assert.assertEquals(ColumnType.RECORD, f1.getType());

    ColumnSchema f2 = schema.getColumn(1);
    Assert.assertEquals("r2", f2.getName());
    Assert.assertEquals(ColumnType.RECORD, f2.getType());

    // test 2nd level schema;
    Schema f1Schema = f1.getSchema();
    ColumnSchema f11 = f1Schema.getColumn(0);
    Assert.assertEquals("f1", f11.getName());
    Assert.assertEquals(ColumnType.INT, f11.getType());
    ColumnSchema f12 = f1Schema.getColumn(1);
    Assert.assertEquals("f2", f12.getName());
    Assert.assertEquals(ColumnType.INT, f12.getType());

    Schema f2Schema = f2.getSchema();
    ColumnSchema f21 = f2Schema.getColumn(0);
    Assert.assertEquals("r3", f21.getName());
    Assert.assertEquals(ColumnType.RECORD, f21.getType());

    // test 3rd level schema;
    Schema f21Schema = f21.getSchema();
    ColumnSchema f211 = f21Schema.getColumn(0);
    Assert.assertEquals("f3", f211.getName());
    Assert.assertEquals(ColumnType.FLOAT, f211.getType());
    ColumnSchema f212 = f21Schema.getColumn(1);
    Assert.assertEquals("f4", f212.getName());
    Assert.assertEquals(ColumnType.BYTES, f212.getType());
  }
View Full Code Here

        System.out.println("--------------------------------");
      }
      CGSchema cgs1 = cgschemas[0];
      CGSchema cgs2 = cgschemas[1];

      ColumnSchema f11 = cgs1.getSchema().getColumn(0);
      Assert.assertEquals("r1.f1", f11.getName());
      Assert.assertEquals(ColumnType.INT, f11.getType());
      ColumnSchema f12 = cgs1.getSchema().getColumn(1);
      Assert.assertEquals("r2.r3.f3", f12.getName());
      Assert.assertEquals(ColumnType.FLOAT, f12.getType());

      ColumnSchema f21 = cgs2.getSchema().getColumn(0);
      Assert.assertEquals("r1.f2", f21.getName());
      Assert.assertEquals(ColumnType.INT, f21.getType());
      ColumnSchema f22 = cgs2.getSchema().getColumn(1);
      Assert.assertEquals("r2.r3.f4", f22.getName());
      Assert.assertEquals(ColumnType.BYTES, f22.getType());

      System.out.println("*********** Column Map **********");
      Map<String, HashSet<Partition.PartitionInfo.ColumnMappingEntry>> colmap = p
          .getPartitionInfo().getColMap();
      Assert.assertEquals(colmap.size(), 5);
View Full Code Here

TOP

Related Classes of org.apache.hadoop.zebra.schema.Schema.ColumnSchema

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.