Package org.apache.hadoop.zebra.parser

Examples of org.apache.hadoop.zebra.parser.TableSchemaParser$LookaheadSuccess


public class TestSchemaAnonymousCollection {
  @Test
  public void testSchemaValid1() throws ParseException {
    String strSch = "c1:collection(Record(f1:int, f2:int)), c2:collection(record(f5:collection(record(f3:float, f4))))";
    TableSchemaParser parser;
    Schema schema;

    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("c1", f1.getName());
View Full Code Here


  TableSchemaParser parser;
  Schema schema;

  @Before
  public void init() throws ParseException {
    parser = new TableSchemaParser(new StringReader(strSch));
    schema = parser.RecordSchema(null);
  }
View Full Code Here

public class TestSchemaCollection {
  @Test
  public void testSchemaValid1() throws ParseException {
    String strSch = "c1:collection(record(f1:int, f2:int)), c2:collection(record(c3:collection(record(f3:float, f4))))";
    TableSchemaParser parser;
    Schema schema;

    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("c1", f1.getName());
View Full Code Here

  @Test
  public void testSchemaInvalid1() throws ParseException, Exception {
    try {
      String strSch = "c1:collection(record(f1:int, f2:int)), c2:collection(record(c3:collection(record(f3:float, f4)))))";
      TableSchemaParser parser;
      Schema schema;

      parser = new TableSchemaParser(new StringReader(strSch));
      schema = parser.RecordSchema(null);
      System.out.println(schema);
    } catch (Exception e) {
      String errMsg = e.getMessage();
      String str = "Encountered \" \")\" \") \"\" at line 1, column 98.";
      System.out.println(errMsg);
View Full Code Here

  public void testInvalidCollectionSchema() throws ParseException {
      String[] strSchs = { "c0:int, c1:collection(f1:int, f2:string)",
                       "c0:int, c1:collection(f1:int)",
                       "c0:int, c1:collection(int)" };
      for( String strSch : strSchs ) {
        TableSchemaParser parser = new TableSchemaParser( new StringReader( strSch ) );
        try {
          parser.RecordSchema(null);
        } catch(ParseException ex) {
          System.out.println( "Catch expected exception for schema: " + strSch );
         
          continue;
        }
View Full Code Here

  TableSchemaParser parser;
  Schema schema;

  @Before
  public void init() throws ParseException {
    parser = new TableSchemaParser(new StringReader(strSch));
    schema = parser.RecordSchema(null);
  }
View Full Code Here

   * ctor used by STORE
   */
  public Partition(final String schema, final String storage, String comparator, String sortColumns)
        throws ParseException, IOException
  {
    TableSchemaParser parser = new TableSchemaParser(new StringReader(schema));
    mSchema = parser.RecordSchema(null);
    mSortInfo = SortInfo.parse(sortColumns, mSchema, comparator);
    mSorted = (mSortInfo != null && mSortInfo.size() > 0);
    this.comparator = (mSorted ? mSortInfo.getComparator() : "");
    storeConst(storage);
  }
View Full Code Here

  }

  public Partition(String schema, final String storage, String comparator)
      throws ParseException, IOException
  {
    TableSchemaParser parser = new TableSchemaParser(new StringReader(schema));
    mSchema = parser.RecordSchema(null);
    this.comparator = comparator;
    storeConst(storage);
  }
View Full Code Here

        throw new ParseException("Column name should not contain "
            + COLUMN_DELIMITER);
      if (i > 0) sb.append(",");
      sb.append(columnNames[i]);
    }
    TableSchemaParser parser =
        new TableSchemaParser(new StringReader(sb.toString()));
    if (projection)
      parser.ProjectionSchema(this);
    else
      parser.RecordSchema(this);
  }
View Full Code Here

      }
      cgschemas = partition.getCGSchemas();
      int numCGs = WritableUtils.readVInt(in);
      physical = new Schema[numCGs];
      cgDeletedFlags = new boolean[physical.length];
      TableSchemaParser parser;
      String cgschemastr;
      try {
        for (int nx = 0; nx < numCGs; nx++) {
          cgschemastr = WritableUtils.readString(in);
          parser = new TableSchemaParser(new StringReader(cgschemastr));
          physical[nx] = parser.RecordSchema(null);
        }
      }
      catch (Exception e) {
        throw new IOException("parser.RecordSchema failed :" + e.getMessage());
      }
View Full Code Here

TOP

Related Classes of org.apache.hadoop.zebra.parser.TableSchemaParser$LookaheadSuccess

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.