Package org.apache.hadoop.zebra.types

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


      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];
      System.out.println(cgs2);
      CGSchema cgs3 = cgschemas[2];
      System.out.println(cgs3);

      Assert.assertEquals(cgs1.getName(), "PI");
      Assert.assertEquals(cgs2.getName(), "Pi");
      Assert.assertEquals(cgs3.getName(), "CG100");
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
View Full Code Here


    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);

      Assert.assertEquals(cgs1.getName(), "C1");
      Assert.assertEquals(cgs2.getName(), "C2");
    } catch (Exception e) {
      e.printStackTrace();
    }
  } 
View Full Code Here

  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) {
      String errMsg = e.getMessage();
View Full Code Here

  public void testStorageInvalid2() {
    try {
      String strStorage = "[f1, f2] serialize by avro compress by gz as C1; [f3, f4] as C2 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 (ParseException e) {
      System.out.println(e.getMessage());
View Full Code Here

      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(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
View Full Code Here

      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(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
View Full Code Here

  public void testStorageInvalid1() {
    try {
      String strStorage = "m1#{k1}";
      Partition p = new Partition(schema.toString(), strStorage, null);
      CGSchema[] cgschemas = p.getCGSchemas();
      CGSchema cgs1 = cgschemas[0];
      System.out.println(cgs1);
    } catch (Exception e) {
      String errMsg = e.getMessage();
      String str = "Encountered \" <IDENTIFIER> \"m1 \"\" at line 1, column 1.";
      System.out.println(errMsg);
View Full Code Here

  public void testStorageInvalid2() {
    try {
      String strStorage = "[m1#{k1}] abc; [m1#{k2}, f3] xyz";
      Partition p = new Partition(schema.toString(), strStorage, null);
      CGSchema[] cgschemas = p.getCGSchemas();
      CGSchema cgs1 = cgschemas[0];
      System.out.println(cgs1);
    } catch (Exception e) {
      String errMsg = e.getMessage();
      String str = "Encountered \" <IDENTIFIER> \"abc \"\" at line 1, column 11.";
      System.out.println(errMsg);
View Full Code Here

  public void testStorageInvalid3() {
    try {
      String strStorage = "[m1{#k1}{#k2}]";
      Partition p = new Partition(schema.toString(), strStorage, null);
      CGSchema[] cgschemas = p.getCGSchemas();
      CGSchema cgs1 = cgschemas[0];
      System.out.println(cgs1);
    } catch (Exception e) {
      String errMsg = e.getMessage();
      String str = "Encountered \" \"{\" \"{ \"\" at line 1, column 4.";
      System.out.println(errMsg);
View Full Code Here

      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];

      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 **********");
      Map<String, HashSet<Partition.PartitionInfo.ColumnMappingEntry>> colmap = p
          .getPartitionInfo().getColMap();
      Assert.assertEquals(colmap.size(), 2);
View Full Code Here

TOP

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

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.