Package org.apache.hadoop.zebra.types

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


  @Test
  public void testSchemaInvalid5() throws ParseException {
    try {
      String strSch = "m1:map(abc)";
      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 7.";
      System.out.println(errMsg);
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 TestSchemaPrimitive {
  @Test
  public void testSchemaValid1() throws ParseException {
    String strSch = "f1:int, f2:long, f3:float, f4:bool, f5:string, f6:bytes";
    TableSchemaParser parser;
    Schema schema;

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

    ColumnSchema f2 = schema.getColumn(1);
    Assert.assertEquals("f2", f2.name);
    Assert.assertEquals(ColumnType.LONG, f2.type);
View Full Code Here

  }

  @Test
  public void testSchemaValid2() throws ParseException {
    String strSch = "f1:int, f2, f3:float, f4, f5:string, f6:bytes";
    TableSchemaParser parser;
    Schema schema;

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

    ColumnSchema f2 = schema.getColumn(1);
    Assert.assertEquals("f2", f2.name);
    Assert.assertEquals(ColumnType.BYTES, f2.type);
View Full Code Here

  @Test
  public void testSchemaInvalid1() {
    try {
      String strSch = "f1:int, f2:xyz, f3:float";
      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 \" <IDENTIFIER> \"xyz \"\" at line 1, column 12.";
      System.out.println(errMsg);
View Full Code Here

  @Test
  public void testSchemaInvalid2() {
    try {
      String strSch = "f1:";
      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 \"<EOF>\" at line 1, column 3.";
      System.out.println(errMsg);
View Full Code Here

  @Test
  public void testSchemaInvalid3() {
    try {
      String strSch = ":";
      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 1.";
      System.out.println(errMsg);
View Full Code Here

  @Test
  public void testSchemaInvalid4() {
    try {
      String strSch = "f1:int abc";
      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 \" <IDENTIFIER> \"abc \"\" at line 1, column 8.";
      System.out.println(errMsg);
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(f1:int, f2:int), c2:collection(c3:collection(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.name);
View Full Code Here

TOP

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

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.