Package com.datasalt.pangool.tuplemr

Examples of com.datasalt.pangool.tuplemr.Criteria


    if(isMultipleSources) {
      int schemaId1 = tupleMRConf.getSchemaIdByName(w1.getSchema().getName());
      int schemaId2 = tupleMRConf.getSchemaIdByName(w2.getSchema().getName());
      int[] indexes1 = serInfo.getCommonSchemaIndexTranslation(schemaId1);
      int[] indexes2 = serInfo.getCommonSchemaIndexTranslation(schemaId2);
      Criteria c = tupleMRConf.getCommonCriteria();
      int comparison = compare(serInfo.getCommonSchema(), c, w1, indexes1, w2, indexes2,serInfo.getCommonSchemaSerializers());
      if(comparison != 0) {
        return comparison;
      } else if(schemaId1 != schemaId2) {
        int r = schemaId1 - schemaId2;
        return (tupleMRConf.getSchemasOrder() == Order.ASC) ? r : -r;
      }
      int schemaId = schemaId1;
      c = tupleMRConf.getSpecificOrderBys().get(schemaId);
      if(c != null) {
        int[] indexes = serInfo.getSpecificSchemaIndexTranslation(schemaId);
        return compare(serInfo.getSpecificSchema(schemaId), c, w1, indexes, w2, indexes,serInfo.getSpecificSchemaSerializers().get(schemaId));
      } else {
        return 0;
      }
    } else {
      int[] indexes = serInfo.getCommonSchemaIndexTranslation(0);
      Criteria c = tupleMRConf.getCommonCriteria();
      return compare(serInfo.getCommonSchema(), c, w1, indexes, w2, indexes,serInfo.getCommonSchemaSerializers());
    }

  }
View Full Code Here


  }

  protected int compareMultipleSources(byte[] b1, int s1, int l1, byte[] b2, int s2,
      int l2) throws IOException {
    Schema commonSchema = serInfo.getCommonSchema();
    Criteria commonOrder = tupleMRConf.getCommonCriteria();

    int comparison = compare(b1, s1, b2, s2, commonSchema, commonOrder, offsets);
    if(comparison != 0) {
      return comparison;
    }

    int schemaId1 = readVInt(b1, offsets.offset1);
    int schemaId2 = readVInt(b2, offsets.offset2);
    if(schemaId1 != schemaId2) {
      int r = schemaId1 - schemaId2;
      return (tupleMRConf.getSchemasOrder() == Order.ASC) ? r : -r;
    }

    int vintSize = WritableUtils.decodeVIntSize(b1[offsets.offset1]);
    offsets.offset1 += vintSize;
    offsets.offset2 += vintSize;

    // sources are the same
    Criteria criteria = tupleMRConf.getSpecificOrderBys().get(schemaId1);
    if(criteria == null) {
      return 0;
    }

    Schema specificSchema = serInfo.getSpecificSchema(schemaId1);
View Full Code Here

  }

  private int compareOneSource(byte[] b1, int s1, int l1, byte[] b2, int s2, int l2)
      throws IOException {
    Schema commonSchema = serInfo.getCommonSchema();
    Criteria commonOrder = tupleMRConf.getCommonCriteria();
    return compare(b1, s1, b2, s2, commonSchema, commonOrder, offsets);
  }
View Full Code Here

    List<SortElement> sortElements = tupleMRConf.getCommonCriteria().getElements();
    int numGroupByFields = tupleMRConf.getGroupByFields().size();
    List<SortElement> groupSortElements = new ArrayList<SortElement>();
    groupSortElements.addAll(sortElements);
    groupSortElements = groupSortElements.subList(0,numGroupByFields);
    groupCriteria = new Criteria(groupSortElements);         
    TupleMRConfigBuilder.initializeComparators(conf, tupleMRConf);   
  }
View Full Code Here

    if (isMultipleSources) {
      int schemaId1 = tupleMRConf.getSchemaIdByName(w1.getSchema().getName());
      int schemaId2 = tupleMRConf.getSchemaIdByName(w2.getSchema().getName());
      int[] indexes1 = serInfo.getCommonSchemaIndexTranslation(schemaId1);
      int[] indexes2 = serInfo.getCommonSchemaIndexTranslation(schemaId2);
      Criteria c = tupleMRConf.getCommonCriteria();
      int comparison = compare(serInfo.getCommonSchema(), c, w1, indexes1, w2, indexes2, serInfo.getCommonSchemaSerializers());
      if (comparison != 0) {
        return comparison;
      } else if (schemaId1 != schemaId2) {
        int r = schemaId1 - schemaId2;
        return (tupleMRConf.getSchemasOrder() == Order.ASC) ? r : -r;
      }
      int schemaId = schemaId1;
      c = tupleMRConf.getSpecificOrderBys().get(schemaId);
      if (c != null) {
        int[] indexes = serInfo.getSpecificSchemaIndexTranslation(schemaId);
        return compare(serInfo.getSpecificSchema(schemaId), c, w1, indexes, w2, indexes, serInfo.getSpecificSchemaSerializers().get(schemaId));
      } else {
        return 0;
      }
    } else {
      int[] indexes = serInfo.getCommonSchemaIndexTranslation(0);
      Criteria c = tupleMRConf.getCommonCriteria();
      return compare(serInfo.getCommonSchema(), c, w1, indexes, w2, indexes, serInfo.getCommonSchemaSerializers());
    }

  }
View Full Code Here

  }

  protected int compareMultipleSources(byte[] b1, int s1, int l1, byte[] b2, int s2,
                                       int l2) throws IOException {
    Schema commonSchema = serInfo.getCommonSchema();
    Criteria commonOrder = tupleMRConf.getCommonCriteria();

    int comparison = compare(b1, s1, b2, s2, commonSchema, commonOrder, offsets, nulls);
    if (comparison != 0) {
      return comparison;
    }

    int schemaId1 = readVInt(b1, offsets.offset1);
    int schemaId2 = readVInt(b2, offsets.offset2);
    if (schemaId1 != schemaId2) {
      int r = schemaId1 - schemaId2;
      return (tupleMRConf.getSchemasOrder() == Order.ASC) ? r : -r;
    }

    int vintSize = WritableUtils.decodeVIntSize(b1[offsets.offset1]);
    offsets.offset1 += vintSize;
    offsets.offset2 += vintSize;

    // sources are the same
    Criteria criteria = tupleMRConf.getSpecificOrderBys().get(schemaId1);
    if (criteria == null) {
      return 0;
    }

    Schema specificSchema = serInfo.getSpecificSchema(schemaId1);
View Full Code Here

  }

  private int compareOneSource(byte[] b1, int s1, int l1, byte[] b2, int s2, int l2)
      throws IOException {
    Schema commonSchema = serInfo.getCommonSchema();
    Criteria commonOrder = tupleMRConf.getCommonCriteria();
    return compare(b1, s1, b2, s2, commonSchema, commonOrder, offsets, nulls);
  }
View Full Code Here

    List<SortElement> sortElements = tupleMRConf.getCommonCriteria().getElements();
    int numGroupByFields = tupleMRConf.getGroupByFields().size();
    List<SortElement> groupSortElements = new ArrayList<SortElement>();
    groupSortElements.addAll(sortElements);
    groupSortElements = groupSortElements.subList(0,numGroupByFields);
    groupCriteria = new Criteria(groupSortElements);         
    TupleMRConfigBuilder.initializeComparators(conf, tupleMRConf);   
  }
View Full Code Here

    if(isMultipleSources) {
      int schemaId1 = tupleMRConf.getSchemaIdByName(w1.getSchema().getName());
      int schemaId2 = tupleMRConf.getSchemaIdByName(w2.getSchema().getName());
      int[] indexes1 = serInfo.getCommonSchemaIndexTranslation(schemaId1);
      int[] indexes2 = serInfo.getCommonSchemaIndexTranslation(schemaId2);
      Criteria c = tupleMRConf.getCommonCriteria();
      int comparison = compare(serInfo.getCommonSchema(), c, w1, indexes1, w2, indexes2,serInfo.getCommonSchemaSerializers());
      if(comparison != 0) {
        return comparison;
      } else if(schemaId1 != schemaId2) {
        int r = schemaId1 - schemaId2;
        return (tupleMRConf.getSchemasOrder() == Order.ASC) ? r : -r;
      }
      int schemaId = schemaId1;
      c = tupleMRConf.getSpecificOrderBys().get(schemaId);
      if(c != null) {
        int[] indexes = serInfo.getSpecificSchemaIndexTranslation(schemaId);
        return compare(serInfo.getSpecificSchema(schemaId), c, w1, indexes, w2, indexes,serInfo.getSpecificSchemaSerializers().get(schemaId));
      } else {
        return 0;
      }
    } else {
      int[] indexes = serInfo.getCommonSchemaIndexTranslation(0);
      Criteria c = tupleMRConf.getCommonCriteria();
      return compare(serInfo.getCommonSchema(), c, w1, indexes, w2, indexes,serInfo.getCommonSchemaSerializers());
    }

  }
View Full Code Here

  }

  protected int compareMultipleSources(byte[] b1, int s1, int l1, byte[] b2, int s2,
      int l2) throws IOException {
    Schema commonSchema = serInfo.getCommonSchema();
    Criteria commonOrder = tupleMRConf.getCommonCriteria();

    int comparison = compare(b1, s1, b2, s2, commonSchema, commonOrder, offsets);
    if(comparison != 0) {
      return comparison;
    }

    int schemaId1 = readVInt(b1, offsets.offset1);
    int schemaId2 = readVInt(b2, offsets.offset2);
    if(schemaId1 != schemaId2) {
      int r = schemaId1 - schemaId2;
      return (tupleMRConf.getSchemasOrder() == Order.ASC) ? r : -r;
    }

    int vintSize = WritableUtils.decodeVIntSize(b1[offsets.offset1]);
    offsets.offset1 += vintSize;
    offsets.offset2 += vintSize;

    // sources are the same
    Criteria criteria = tupleMRConf.getSpecificOrderBys().get(schemaId1);
    if(criteria == null) {
      return 0;
    }

    Schema specificSchema = serInfo.getSpecificSchema(schemaId1);
View Full Code Here

TOP

Related Classes of com.datasalt.pangool.tuplemr.Criteria

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.