Package org.apache.hadoop.zebra.types

Examples of org.apache.hadoop.zebra.types.Partition$PartitionedColumn


  @Test
  public void testStorageValid3() {
    try {
      String strStorage = "[c.r.f1] compress by gz; [m1] serialize by avro";
      Partition p = new Partition(schema.toString(), strStorage, null);
      Assert.assertTrue(false);
      CGSchema[] cgschemas = p.getCGSchemas();

      // 3 column group;
      int size = cgschemas.length;
      Assert.assertEquals(size, 3);
      System.out.println("********** Column Groups **********");
      for (int i = 0; i < cgschemas.length; i++) {
        System.out.println(cgschemas[i]);
        System.out.println("--------------------------------");
      }
      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");
      Assert.assertEquals(cgs3.getCompressor(), "lzo");
      Assert.assertEquals(cgs3.getSerializer(), "pig");

      System.out.println("*********** Column Map **********");
      Map<String, HashSet<Partition.PartitionInfo.ColumnMappingEntry>> colmap = p
          .getPartitionInfo().getColMap();
      Assert.assertEquals(colmap.size(), 3);
      Iterator<Map.Entry<String, HashSet<Partition.PartitionInfo.ColumnMappingEntry>>> it = colmap
          .entrySet().iterator();
      for (int i = 0; i < colmap.size(); i++) {
View Full Code Here


  @Test
  public void testStorageValid1() {
    try {
      String strStorage = "[f1, f2] as PI; [f3, f4] as General secure by uid:joe gid:secure perm:640 COMPRESS BY gz SERIALIZE BY avro; [f5, f6] as ULT";
      Partition p = new Partition(schema.toString(), strStorage, null);
      CGSchema[] cgschemas = p.getCGSchemas();

      // 3 column group;
      int size = cgschemas.length;
      Assert.assertEquals(size, 3);
      System.out.println("********** Column Groups **********");
      for (int i = 0; i < cgschemas.length; i++) {
        System.out.println(cgschemas[i]);
        System.out.println("--------------------------------");
      }
      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");
      Assert.assertEquals(cgs3.getCompressor(), "gz");
      Assert.assertEquals(cgs3.getSerializer(), "pig");
     
      //Assert.assertEquals(cgs2.getOwner(), "joe");
      //Assert.assertEquals(cgs2.getGroup(), "secure");
      //Assert.assertEquals(cgs2.getPerm(), (short) Short.parseShort("640", 8));
      Assert.assertEquals(cgs1.getName(), "PI");
      Assert.assertEquals(cgs2.getName(), "General");
      Assert.assertEquals(cgs3.getName(), "ULT");
     
      System.out.println("*********** Column Map **********");
      Map<String, HashSet<Partition.PartitionInfo.ColumnMappingEntry>> colmap = p
          .getPartitionInfo().getColMap();
      Assert.assertEquals(colmap.size(), 6);
      Iterator<Map.Entry<String, HashSet<Partition.PartitionInfo.ColumnMappingEntry>>> it = colmap
          .entrySet().iterator();
      for (int i = 0; i < colmap.size(); i++) {
View Full Code Here

  @Test
  public void testStorageValid2() {
    try {
      String strStorage = "[f1, f2] serialize by avro compress by gz; [f3, f4] SERIALIZE BY avro COMPRESS BY gz; [f5, f6]";
      Partition p = new Partition(schema.toString(), strStorage, null);
      CGSchema[] cgschemas = p.getCGSchemas();

      Assert.assertEquals(cgschemas.length, 3);
      CGSchema cgs1 = cgschemas[0];
      System.out.println(cgs1);
      CGSchema cgs2 = cgschemas[1];
View Full Code Here

 
  @Test
  public void testStorageValid3() {
    try {
      String strStorage = "[f1, f2] as PI serialize by avro compress by gz; [f3, f4] as General SERIALIZE BY avro COMPRESS BY gz; [f5, f6]";
      Partition p = new Partition(schema.toString(), strStorage, null);
      CGSchema[] cgschemas = p.getCGSchemas();

      Assert.assertEquals(cgschemas.length, 3);
      CGSchema cgs1 = cgschemas[0];
      System.out.println(cgs1);
      CGSchema cgs2 = cgschemas[1];
View Full Code Here

 
  @Test
  public void testStorageValid4() {
    try {
      String strStorage = "[f1, f2] as C1 serialize by avro compress by gz; [f3, f4] as C2 SERIALIZE BY avro COMPRESS BY gz; as C3";
      Partition p = new Partition(schema.toString(), strStorage, null);
      CGSchema[] cgschemas = p.getCGSchemas();

      Assert.assertEquals(cgschemas.length, 3);
      CGSchema cgs1 = cgschemas[0];
      System.out.println(cgs1);
      CGSchema cgs2 = cgschemas[1];
View Full Code Here

  @Test
  public void testStorageValid5() {
    try {
      String strStorage = "[f1, f2] as C1 serialize by avro compress by gz; [f3, f4] as C2 SERIALIZE BY avro COMPRESS BY gz;";
      Partition p = new Partition(schema.toString(), strStorage, null);
      CGSchema[] cgschemas = p.getCGSchemas();

      Assert.assertEquals(cgschemas.length, 3);
      CGSchema cgs1 = cgschemas[0];
      System.out.println(cgs1);
      CGSchema cgs2 = cgschemas[1];
View Full Code Here

  @Test
  public void testStorageValid6() {
    try {
      String strStorage = "[f1, f2] as PI serialize by avro compress by gz; [f3, f4] SERIALIZE BY avro COMPRESS BY gz; [f5, f6] as CG0";
      Partition p = new Partition(schema.toString(), strStorage, null);
      CGSchema[] cgschemas = p.getCGSchemas();

      Assert.assertEquals(cgschemas.length, 3);
      CGSchema cgs1 = cgschemas[0];
      System.out.println(cgs1);
      CGSchema cgs2 = cgschemas[1];
View Full Code Here

 
  @Test
  public void testStorageValid7() {
    try {
      String strStorage = "[f1, f2] as PI serialize by avro compress by gz; [f3, f4] as Pi SERIALIZE BY avro COMPRESS BY gz; [f5, f6] as CG100";
      Partition p = new Partition(schema.toString(), strStorage, null);
      CGSchema[] cgschemas = p.getCGSchemas();

      Assert.assertEquals(cgschemas.length, 3);
      CGSchema cgs1 = cgschemas[0];
      System.out.println(cgs1);
      CGSchema cgs2 = cgschemas[1];
View Full Code Here

   */
  @Test
  public void testStorageValid8() {
    try {
      String strStorage = "[f1, f2] as C1 serialize by avro compress by gz; [f3, f4, f5, f6] as C2 SERIALIZE BY avro COMPRESS BY gz; as C3 compress by gz";
      Partition p = new Partition(schema.toString(), strStorage, null);
      CGSchema[] cgschemas = p.getCGSchemas();
      Assert.assertEquals(cgschemas.length, 2);
      CGSchema cgs1 = cgschemas[0];
      System.out.println(cgs1);
      CGSchema cgs2 = cgschemas[1];
      System.out.println(cgs2);
View Full Code Here

  @Test
  public void testStorageInvalid1() {
    try {
      String strStorage = "[f1, f2] as C1 serialize by avro compress by gz; [f3, f4] as C1 SERIALIZE BY avro COMPRESS BY gz; [f5, f6] as C3";
      Partition p = new Partition(schema.toString(), strStorage, null);
      CGSchema[] cgschemas = p.getCGSchemas();
      CGSchema cgs1 = cgschemas[0];
      System.out.println(cgs1);

      Assert.assertTrue(false);
    } catch (Exception e) {
View Full Code Here

TOP

Related Classes of org.apache.hadoop.zebra.types.Partition$PartitionedColumn

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.