Package org.apache.hadoop.zebra.schema

Examples of org.apache.hadoop.zebra.schema.Schema


    String schema = conf.get(OUTPUT_SCHEMA);
    if (schema == null) {
      return null;
    }
    //schema = schema.replaceAll(";", ",");
    return new Schema(schema);
  }
View Full Code Here


   *        
   */
  public static Object getSortKeyGenerator(JobConf conf) throws IOException, ParseException {

    SortInfo sortInfo = getSortInfo(conf);
    Schema schema     = getSchema(conf);
    String[] sortColNames = sortInfo.getSortColumnNames();

    byte[] types = new byte[sortColNames.length];
    for(int i =0 ; i < sortColNames.length; ++i){
      types[i] = schema.getColumn(sortColNames[i]).getType().pigDataType();
    }
    KeyGenerator builder = makeKeyBuilder(types);
    return builder;

  }
View Full Code Here

      throw new IllegalArgumentException("ZebraSchema object cannot be null.");
    } else {
      schemaStr = zSchema.toString();
    }
   
    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*/
 
View Full Code Here

    createSecondTable();
  }
  public static void createFirstTable() throws IOException, ParseException {
    BasicTable.Writer writer = new BasicTable.Writer(pathTable1, STR_SCHEMA1,
        STR_STORAGE1, conf);
    Schema schema = writer.getSchema();
    //System.out.println("typeName" + schema.getColumn("a").type.pigDataType());
    Tuple tuple = TypesUtils.createTuple(schema);
 
    TableInserter[] inserters = new TableInserter[numsInserters];
    for (int i = 0; i < numsInserters; i++) {
      inserters[i] = writer.getInserter("ins" + i, false);
    }
    Tuple tupRecord1;
    try {
      tupRecord1 = TypesUtils.createTuple(schema.getColumnSchema("r1")
          .getSchema());
    } catch (ParseException e) {
      e.printStackTrace();
      throw new IOException(e);
    }
View Full Code Here

  public static SortInfo getSortInfo(JobConf conf)throws IOException
  {
    String sortColumns = conf.get(OUTPUT_SORTCOLUMNS);
    if (sortColumns == null)
      return null;
    Schema schema = null;
    try {
      schema = getSchema(conf);
    } catch (ParseException e) {
      throw new IOException("Schema parsing failure : "+e.getMessage());
    }
View Full Code Here

   
  }
  public static void createSecondTable() throws IOException, ParseException {
    BasicTable.Writer writer = new BasicTable.Writer(pathTable2, STR_SCHEMA2,
        STR_STORAGE2, conf);
    Schema schema = writer.getSchema();
    //System.out.println("typeName" + schema.getColumn("a").type.pigDataType());
    Tuple tuple = TypesUtils.createTuple(schema);

    TableInserter[] inserters = new TableInserter[numsInserters];
    for (int i = 0; i < numsInserters; i++) {
      inserters[i] = writer.getInserter("ins" + i, false);
    }
    Tuple tupRecord1;
    try {
      tupRecord1 = TypesUtils.createTuple(schema.getColumnSchema("r1")
          .getSchema());
    } catch (ParseException e) {
      e.printStackTrace();
      throw new IOException(e);
    }
View Full Code Here

    //
    // Create table from tableData array
    //
    BasicTable.Writer writer = new BasicTable.Writer(path, schemaString, storageString, conf);
   
    Schema schema = writer.getSchema();
    Tuple tuple = TypesUtils.createTuple(schema);
    TableInserter inserter = writer.getInserter("ins", false);
   
    for (int i = 0; i < tableData.length; ++i) {
      TypesUtils.resetTuple(tuple);
View Full Code Here

    pathTable = new Path(pathWorking, "TestTableStorer");
    System.out.println("pathTable =" + pathTable);
    BasicTable.Writer writer = new BasicTable.Writer(pathTable,
        "SF_a:int,SF_b:string,SF_c,SF_d,SF_e,SF_f,SF_g",
        "[SF_a, SF_b, SF_c]; [SF_e, SF_f, SF_g]", conf);
    Schema schema = writer.getSchema();
    System.out.println("typeName" + schema.getColumn("SF_a").getType().pigDataType());
    Tuple tuple = TypesUtils.createTuple(schema);

    final int numsBatch = 10;
    final int numsInserters = 1;
    TableInserter[] inserters = new TableInserter[numsInserters];
View Full Code Here

    public void configure(JobConf job) {
      bytesKey = new BytesWritable();
      conf = job;
      sortKey = job.get("sortKey");
      try {
        Schema outSchema = BasicTableOutputFormat.getSchema(job);
        tupleRow = TypesUtils.createTuple(outSchema);
        javaObj = BasicTableOutputFormat.getSortKeyGenerator(job);
      } catch (IOException e) {
        throw new RuntimeException(e);
      } catch (org.apache.hadoop.zebra.parser.ParseException e) {
View Full Code Here

      }
    }

    BasicTable.Writer writer = new BasicTable.Writer(pathTable,
        "a:string,b,c:string,d,e,f,g", "[a,b,c];[d,e,f,g]", conf);
    Schema schema = writer.getSchema();
    Tuple tuple = TypesUtils.createTuple(schema);

    final int numsBatch = 10;
    final int numsInserters = 2;
    TableInserter[] inserters = new TableInserter[numsInserters];
View Full Code Here

TOP

Related Classes of org.apache.hadoop.zebra.schema.Schema

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.