Package org.apache.hadoop.zebra.types

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


  @Test
  public void testStorageInvalid1() {
    try {
      String strStorage = "f1";
      Partition p = new Partition(schema.toString(), strStorage);
      CGSchema[] cgschemas = p.getCGSchemas();
      CGSchema cgs1 = cgschemas[0];
      System.out.println(cgs1);
    } catch (Exception e) {
      String errMsg = e.getMessage();
      String str = "Encountered \" <IDENTIFIER> \"f1 \"\" at line 1, column 1.\nWas expecting one of:\n    <EOF> \n    \"compress by\" ...\n    \"serialize by\" ...\n    \"[\" ...\n    ";
View Full Code Here


  @Test
  public void testStorageInvalid2() {
    try {
      String strStorage = "[f100]";
      Partition p = new Partition(schema.toString(), strStorage);
      CGSchema[] cgschemas = p.getCGSchemas();
      CGSchema cgs1 = cgschemas[0];
      System.out.println(cgs1);
    } catch (Exception e) {
      String errMsg = e.getMessage();
      String str = "Column f100 not defined in schema";
View Full Code Here

  @Test
  public void testStorageInvalid3() {
    try {
      String strStorage = "f1:long";
      Partition p = new Partition(schema.toString(), strStorage);
      CGSchema[] cgschemas = p.getCGSchemas();
      CGSchema cgs1 = cgschemas[0];
      System.out.println(cgs1);
    } catch (Exception e) {
      String errMsg = e.getMessage();
      String str = "Encountered \" <IDENTIFIER> \"f1 \"\" at line 1, column 1.\nWas expecting one of:\n    <EOF> \n    \"compress by\" ...\n    \"serialize by\" ...\n    \"[\" ...\n    ";
View Full Code Here

  @Test
  public void testStorageInvalid4() {
    try {
      String strStorage = "[";
      Partition p = new Partition(schema.toString(), strStorage);
      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 1.\nWas expecting one of:\n    \"compress by\" ...\n    \"serialize by\" ...\n    ";
View Full Code Here

  @Test
  public void testStorageInvalid5() {
    try {
      String strStorage = "[f1, f2]; [f1, f4]";
      Partition p = new Partition(schema.toString(), strStorage);
      CGSchema[] cgschemas = p.getCGSchemas();
      CGSchema cgs1 = cgschemas[0];
      System.out.println(cgs1);
    } catch (Exception e) {
      String errMsg = e.getMessage();
      String str = "Column f1 specified more than once!";
View Full Code Here

  @Test
  public void testStorageInvalid6() {
    try {
      String strStorage = ":";
      Partition p = new Partition(schema.toString(), strStorage);
      CGSchema[] cgschemas = p.getCGSchemas();
      CGSchema cgs1 = cgschemas[0];
      System.out.println(cgs1);
    } catch (Exception e) {
      String errMsg = e.getMessage();
      String str = "Lexical error at line 1, column 2.  Encountered: <EOF> after : \"\"";
View Full Code Here

  @Test
  public void testStorageInvalid7() {
    try {
      String strStorage = "[f1, f2] serialize by xyz compress by gzip; [f3, f4] SERIALIZE BY avro COMPRESS BY lzo2";
      Partition p = new Partition(schema.toString(), strStorage);
      CGSchema[] cgschemas = p.getCGSchemas();
      CGSchema cgs1 = cgschemas[0];
      System.out.println(cgs1);
    } catch (Exception e) {
      String errMsg = e.getMessage();
      String str = "Encountered \" \"serialize by\" \"serialize by \"\" at line 1, column 10.";
View Full Code Here

  @Test
  public void testStorageInvalid8() {
    try {
      String strStorage = "[f1, f2] serialize by avro compress by xyz; [f3, f4] SERIALIZE BY avro COMPRESS BY lzo2";
      Partition p = new Partition(schema.toString(), strStorage);
      CGSchema[] cgschemas = p.getCGSchemas();
      CGSchema cgs1 = cgschemas[0];
      System.out.println(cgs1);
    } catch (Exception e) {
      String errMsg = e.getMessage();
      String str = "Encountered \" \"compress by\" \"compress by \"\" at line 1, column 28.";
View Full Code Here

  @Test
  public void testStorageValid1() {
    try {
      String strStorage = "[c1]; [c2]";
      Partition p = new Partition(schema.toString(), strStorage);
      CGSchema[] cgschemas = p.getCGSchemas();

      // 2 column group;
      int size = cgschemas.length;
      Assert.assertEquals(size, 2);
      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("c1", f11.name);
      Assert.assertEquals(ColumnType.COLLECTION, f11.type);
      ColumnSchema f21 = cgs2.getSchema().getColumn(0);
      Assert.assertEquals("c2", f21.name);
      Assert.assertEquals(ColumnType.COLLECTION, f21.type);

      System.out.println("*********** Column Map **********");
      Map<String, HashSet<Partition.PartitionInfo.ColumnMappingEntry>> colmap = p
          .getPartitionInfo().getColMap();
      Assert.assertEquals(colmap.size(), 2);
      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 = "[c1.f1]";
      Partition p = new Partition(schema.toString(), strStorage);
      Assert.assertTrue(false);
      CGSchema[] cgschemas = p.getCGSchemas();

      // 2 column group;
      int size = cgschemas.length;
      Assert.assertEquals(size, 2);
      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("c1.f1", f11.name);
      Assert.assertEquals(ColumnType.INT, f11.type);
      ColumnSchema f21 = cgs2.getSchema().getColumn(0);
      Assert.assertEquals("c1.f2", f21.name);
      Assert.assertEquals(ColumnType.INT, f21.type);
      ColumnSchema f22 = cgs2.getSchema().getColumn(1);
      Assert.assertEquals("c2", f22.name);
      Assert.assertEquals(ColumnType.COLLECTION, f22.type);

      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

TOP

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

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.