Examples of SortInfo


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

    public void configure(JobConf job) {
      bytesKey = new BytesWritable();
      try {
       
      /* New M/R Interface to get sort information */ 
      SortInfo sortInfo = BasicTableOutputFormat.getSortInfo(job);
     
      /* New M/R Interface SortInfo is exposed to user
       * To get types of sort columns.
       * Similar interface to get names and indices
       */
         sortColTypes  = sortInfo.getSortColumnTypes();
         types = new byte[sortColTypes.length];
         for(int i =0 ; i < sortColTypes.length; ++i){
           types[i] = sortColTypes[i].pigDataType();
         }
        Schema outSchema = BasicTableOutputFormat.getSchema(job);
View Full Code Here

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

   * @return the zebra tables's SortInfo; null if the table is unsorted.
   */
  public static SortInfo getSortInfo(JobConf conf) throws IOException
  {
    TableExpr expr = getInputExpr(conf);
    SortInfo result = null;
    int sortSize = 0;
    if (expr instanceof BasicTableExpr)
    {
      BasicTable.Reader reader = new BasicTable.Reader(((BasicTableExpr) expr).getPath(), conf);
      SortInfo sortInfo = reader.getSortInfo();
      reader.close();
      result = sortInfo;
    } else {
      List<LeafTableInfo> leaves = expr.getLeafTables(null);
      for (Iterator<LeafTableInfo> it = leaves.iterator(); it.hasNext(); )
      {
        LeafTableInfo leaf = it.next();
        BasicTable.Reader reader = new BasicTable.Reader(leaf.getPath(), conf);
        SortInfo sortInfo = reader.getSortInfo();
        reader.close();
        if (sortSize == 0)
        {
          sortSize = sortInfo.size();
          result = sortInfo;
        } else if (sortSize != sortInfo.size()) {
          throw new IOException("Tables of the table union do not possess the same sort property.");
        }
      }
    }
    return result;
View Full Code Here

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

         }

   if (expr instanceof BasicTableExpr)
   {
     BasicTable.Reader reader = new BasicTable.Reader(((BasicTableExpr) expr).getPath(), conf);
     SortInfo mySortInfo = reader.getSortInfo();

     reader.close();
     if (mySortInfo == null)
       throw new IOException("The table is not sorted");
     if (comparatorName == null)
       // cheat the equals method's comparator comparison
       comparatorName = mySortInfo.getComparator();
     if (sortcolumns != null && !mySortInfo.equals(sortcolumns, comparatorName))
     {
       throw new IOException("The table is not properly sorted");
     }
    } else {
     List<LeafTableInfo> leaves = expr.getLeafTables(null);
     for (Iterator<LeafTableInfo> it = leaves.iterator(); it.hasNext(); )
     {
       LeafTableInfo leaf = it.next();
       BasicTable.Reader reader = new BasicTable.Reader(leaf.getPath(), conf);
       SortInfo mySortInfo = reader.getSortInfo();
       reader.close();
       if (mySortInfo == null)
         throw new IOException("The table is not sorted");
       if (comparatorName == null)
         comparatorName = mySortInfo.getComparator(); // use the first table's comparator as comparison base
       if (sortcolumns == null)
       {
         sortcolumns = mySortInfo.getSortColumnNames();
         comparatorName = mySortInfo.getComparator();
       } else {
         if (!mySortInfo.equals(sortcolumns, comparatorName))
         {
           throw new IOException("The table is not properly sorted");
         }
       }
     }
View Full Code Here

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

   *          The JobContext object.
   * @return Object of type zebra.pig.comaprator.KeyGenerator.
   *        
   */
  public static Object getSortKeyGenerator(JobContext jobContext) throws IOException, ParseException {
    SortInfo sortInfo = getSortInfo( jobContext );
    Schema schema     = getSchema(jobContext);
    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();
    }
View Full Code Here

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

      // Set up SortInfo related stuff only once;
      if (i == 0) {
        if (writer.getSortInfo() != null)
        {
          sortColIndices = writer.getSortInfo().getSortIndices();
          SortInfo sortInfo =  writer.getSortInfo();
          String[] sortColNames = sortInfo.getSortColumnNames();
          org.apache.hadoop.zebra.schema.Schema schema = writer.getSchema();

          byte[] types = new byte[sortColNames.length];
         
          for(int j =0 ; j < sortColNames.length; ++j){
View Full Code Here

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

   * @return Object of type zebra.pig.comaprator.KeyGenerator.
   *        
   */
  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();
    }
View Full Code Here

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

      String storageStr = reader.getStorageString();
      IOutils.indent(out, indent);
      out.printf("Schema : %s\n", schemaStr);
      IOutils.indent(out, indent);
      out.printf("Storage Information : %s\n", storageStr);
      SortInfo sortInfo = reader.getSortInfo();
      if (sortInfo != null && sortInfo.size() > 0)
      {
        IOutils.indent(out, indent);
        String[] sortedCols = sortInfo.getSortColumnNames();
        out.println("Sorted Columns :");
        for (int nx = 0; nx < sortedCols.length; nx++) {
          if (nx > 0)
            out.printf(" , ");
          out.printf("%s", sortedCols[nx]);
View Full Code Here

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

        writer = new BasicTable.Writer( new Path( path ), conf );

        if (writer.getSortInfo() != null)
        {
            sortColIndices = writer.getSortInfo().getSortIndices();
            SortInfo sortInfo =  writer.getSortInfo();
            String[] sortColNames = sortInfo.getSortColumnNames();
            org.apache.hadoop.zebra.schema.Schema schema = writer.getSchema();

            byte[] types = new byte[sortColNames.length];
            for(int i =0 ; i < sortColNames.length; ++i){
                types[i] = schema.getColumn(sortColNames[i]).getType().pigDataType();
View Full Code Here

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

   * @return Object of type zebra.pig.comaprator.KeyGenerator.
   *        
   */
  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();
    }
View Full Code Here

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

   *          The JobContext object.
   * @return Object of type zebra.pig.comaprator.KeyGenerator.
   *        
   */
  public static Object getSortKeyGenerator(JobContext jobContext) throws IOException, ParseException {
    SortInfo sortInfo = getSortInfo( jobContext );
    Schema schema     = getSchema(jobContext);
    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();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.