Package org.apache.hadoop.zebra.parser

Examples of org.apache.hadoop.zebra.parser.ParseException


      fieldIndex = mName.indexOf('.');
      hashIndex = mName.indexOf('#');
      String prefix;
      if (hashIndex != -1 && fieldIndex == -1) {
        if (fs.type != ColumnType.MAP)
          throw new ParseException(mName + " : is not of type MAP");
        prefix = mName.substring(0, hashIndex);
        setName(mName.substring(hashIndex + 1), ColumnType.MAP);
      }
      else if (hashIndex == -1 && fieldIndex != -1) {
        if (fs.type != ColumnType.RECORD)
          throw new ParseException(mName + " : is not of type RECORD");
        prefix = mName.substring(0, fieldIndex);
        setName(mName.substring(fieldIndex + 1), ColumnType.RECORD);
      }
      else if (hashIndex != -1 && fieldIndex != -1) {
        if (hashIndex < fieldIndex) {
          if (fs.type != ColumnType.MAP)
            throw new ParseException(mName + " : is not of type MAP");
          prefix = mName.substring(0, hashIndex);
          setName(mName.substring(hashIndex + 1), ColumnType.MAP);
        }
        else {
          if (fs.type != ColumnType.RECORD)
            throw new ParseException(mName + " : is not of type RECORD");
          prefix = mName.substring(0, fieldIndex);
          setName(mName.substring(fieldIndex + 1), ColumnType.RECORD);
        }
      }
      else {
View Full Code Here


   */
  public static void setStorageHint(JobConf conf, String storehint) throws ParseException, IOException {
    String schema = conf.get(OUTPUT_SCHEMA);

    if (schema == null)
      throw new ParseException("Schema has not been set");

    // for sanity check purpose only
    new Partition(schema, storehint, null);

    conf.set(OUTPUT_STORAGEHINT, storehint);
View Full Code Here

   
    Schema schema = null;
    try {
      schema = new Schema(schemaStr);
    } catch (ParseException e) {
      throw new ParseException("[" + zSchema + "] " + " is not a valid schema string: " + e.getMessage());
    }

    /* validity check on storage hint*/
    if (zStorageHint == null) {
      storageHintStr = "";
    } else {
      storageHintStr = zStorageHint.toString();
    }
   
    try {
      new Partition(schemaStr, storageHintStr, null);
    } catch (ParseException e) {
      throw new ParseException("[" + zStorageHint + "] " + " is not a valid storage hint string: " + e.getMessage()  );
    } catch (IOException e) {
      throw new ParseException("[" + zStorageHint + "] " + " is not a valid storage hint string: " + e.getMessage()  );
    }
   
    conf.set(OUTPUT_SCHEMA, schemaStr);
    conf.set(OUTPUT_STORAGEHINT, storageHintStr);
   
View Full Code Here

    String normalizedProjectionString = Schema.normalize(projection.toString());
    try {
      schema = getSchema(conf);
      new org.apache.hadoop.zebra.types.Projection(schema, normalizedProjectionString);
    } catch (ParseException e) {
      throw new ParseException("[" + projection + "] " + "is not a valid Zebra projection string " + e.getMessage());
    } catch (IOException e) {
      throw new ParseException("[" + projection + "] " + "is not a valid Zebra projection string " + e.getMessage());
    }
   
    conf.set(INPUT_PROJ, normalizedProjectionString);
 
View Full Code Here

  public static void setStorageHint(JobContext jobContext, String storehint) throws ParseException, IOException {
    Configuration conf = jobContext.getConfiguration();
    String schema = ZebraConf.getOutputSchema(conf);

    if (schema == null)
      throw new ParseException("Schema has not been set");

    // for sanity check purpose only
    new Partition(schema, storehint, null);

    ZebraConf.setOutputStorageHint(conf, storehint);
View Full Code Here

    Schema schema = null;
    try {
      schema = new Schema(schemaStr);
    } catch (ParseException e) {
      throw new ParseException("[" + zSchema + "] " + " is not a valid schema string: " + e.getMessage());
    }

    /* validity check on storage hint*/
    if (zStorageHint == null) {
      storageHintStr = "";
    } else {
      storageHintStr = zStorageHint.toString();
    }

    try {
      new Partition(schemaStr, storageHintStr, null);
    } catch (ParseException e) {
      throw new ParseException("[" + zStorageHint + "] " + " is not a valid storage hint string: " + e.getMessage()  );
    } catch (IOException e) {
      throw new ParseException("[" + zStorageHint + "] " + " is not a valid storage hint string: " + e.getMessage()  );
    }

    Configuration conf = jobContext.getConfiguration();
    ZebraConf.setOutputSchema(conf, schemaStr);
    ZebraConf.setOutputStorageHint(conf, storageHintStr);   
View Full Code Here

     *          complex column type
     * @throws ParseException
     */
    public ColumnSchema(String a, Schema s, ColumnType t) throws ParseException {
      if ((null != s) && !(ColumnType.isSchemaType(t))) {
        throw new ParseException(
            "Only a COLLECTION or RECORD or MAP can have schemas.");
      }
      name = a;
      schema = s;
      type = t;
View Full Code Here

      fieldIndex = mName.indexOf('.');
      hashIndex = mName.indexOf('#');
      String prefix;
      if (hashIndex != -1 && fieldIndex == -1) {
        if (fs.type != ColumnType.MAP)
          throw new ParseException(mName + " : is not of type MAP");
        prefix = mName.substring(0, hashIndex);
        setName(mName.substring(hashIndex + 1), ColumnType.MAP);
      }
      else if (hashIndex == -1 && fieldIndex != -1) {
        if (fs.type != ColumnType.RECORD)
          throw new ParseException(mName + " : is not of type RECORD");
        prefix = mName.substring(0, fieldIndex);
        setName(mName.substring(fieldIndex + 1), ColumnType.RECORD);
      }
      else if (hashIndex != -1 && fieldIndex != -1) {
        if (hashIndex < fieldIndex) {
          if (fs.type != ColumnType.MAP)
            throw new ParseException(mName + " : is not of type MAP");
          prefix = mName.substring(0, hashIndex);
          setName(mName.substring(hashIndex + 1), ColumnType.MAP);
        }
        else {
          if (fs.type != ColumnType.RECORD)
            throw new ParseException(mName + " : is not of type RECORD");
          prefix = mName.substring(0, fieldIndex);
          setName(mName.substring(fieldIndex + 1), ColumnType.RECORD);
        }
      }
      else {
View Full Code Here

   */
  public static void setStorageHint(JobConf conf, String storehint) throws ParseException, IOException {
    String schema = conf.get(OUTPUT_SCHEMA);

    if (schema == null)
      throw new ParseException("Schema has not been set");

    // for sanity check purpose only
    new Partition(schema, storehint, null);

    conf.set(OUTPUT_STORAGEHINT, storehint);
View Full Code Here

   
    Schema schema = null;
    try {
      schema = new Schema(schemaStr);
    } catch (ParseException e) {
      throw new ParseException("[" + zSchema + "] " + " is not a valid schema string: " + e.getMessage());
    }

    /* validity check on storage hint*/
    if (zStorageHint == null) {
      storageHintStr = "";
    } else {
      storageHintStr = zStorageHint.toString();
    }
   
    try {
      new Partition(schemaStr, storageHintStr, null);
    } catch (ParseException e) {
      throw new ParseException("[" + zStorageHint + "] " + " is not a valid storage hint string: " + e.getMessage()  );
    } catch (IOException e) {
      throw new ParseException("[" + zStorageHint + "] " + " is not a valid storage hint string: " + e.getMessage()  );
    }
   
    conf.set(OUTPUT_SCHEMA, schemaStr);
    conf.set(OUTPUT_STORAGEHINT, storageHintStr);
   
View Full Code Here

TOP

Related Classes of org.apache.hadoop.zebra.parser.ParseException

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.