Package org.apache.avro.Schema

Examples of org.apache.avro.Schema.Field.order()


      SpecificRecord r1 = (SpecificRecord)o1;
      SpecificRecord r2 = (SpecificRecord)o2;
      Iterator<Field> fields = s.getFields().values().iterator();
      for (int i = 0; fields.hasNext(); i++) {
        Field f = fields.next();
        if (f.order() == Field.Order.IGNORE)
          continue;                               // ignore this field
        int compare = compare(r1.get(i), r2.get(i), f.schema());
        if (compare != 0)                         // not equal
          return f.order() == Field.Order.DESCENDING ? -compare : compare;
      }
View Full Code Here


        Field f = fields.next();
        if (f.order() == Field.Order.IGNORE)
          continue;                               // ignore this field
        int compare = compare(r1.get(i), r2.get(i), f.schema());
        if (compare != 0)                         // not equal
          return f.order() == Field.Order.DESCENDING ? -compare : compare;
      }
      return 0;
    case ENUM:
      return ((Enum)o1).ordinal() - ((Enum)o2).ordinal();
    default:
View Full Code Here

    case RECORD:
      GenericRecord r1 = (GenericRecord)o1;
      GenericRecord r2 = (GenericRecord)o2;
      for (Map.Entry<String, Field> e : s.getFields().entrySet()) {
        Field f = e.getValue();
        if (f.order() == Field.Order.IGNORE)
          continue;                               // ignore this field
        String name = e.getKey();
        int compare = compare(r1.get(name), r2.get(name), f.schema());
        if (compare != 0)                         // not equal
          return f.order() == Field.Order.DESCENDING ? -compare : compare;
View Full Code Here

        if (f.order() == Field.Order.IGNORE)
          continue;                               // ignore this field
        String name = e.getKey();
        int compare = compare(r1.get(name), r2.get(name), f.schema());
        if (compare != 0)                         // not equal
          return f.order() == Field.Order.DESCENDING ? -compare : compare;
      }
      return 0;
    case ENUM:
      return s.getEnumOrdinal((String)o1) - s.getEnumOrdinal((String)o2);
    case ARRAY:
View Full Code Here

    Decoder d1 = d.d1; Decoder d2 = d.d2;
    switch (schema.getType()) {
    case RECORD: {
      for (Map.Entry<String, Field> entry : schema.getFields().entrySet()) {
        Field field = entry.getValue();
        if (field.order() == Field.Order.IGNORE) {
          GenericDatumReader.skip(field.schema(), d1);
          GenericDatumReader.skip(field.schema(), d2);
          continue;
        }
        int c = compare(d, field.schema());
View Full Code Here

          GenericDatumReader.skip(field.schema(), d2);
          continue;
        }
        int c = compare(d, field.schema());
        if (c != 0)
          return (field.order() != Field.Order.DESCENDING) ? c : -c;
      }
      return 0;
    }
    case ENUM: case INT: case LONG: {
      long l1 = d1.readLong();
View Full Code Here

    case RECORD:
      GenericRecord r1 = (GenericRecord)o1;
      GenericRecord r2 = (GenericRecord)o2;
      for (Map.Entry<String, Field> e : s.getFields().entrySet()) {
        Field f = e.getValue();
        if (f.order() == Field.Order.IGNORE)
          continue;                               // ignore this field
        String name = e.getKey();
        int compare = compare(r1.get(name), r2.get(name), f.schema());
        if (compare != 0)                         // not equal
          return f.order() == Field.Order.DESCENDING ? -compare : compare;
View Full Code Here

        if (f.order() == Field.Order.IGNORE)
          continue;                               // ignore this field
        String name = e.getKey();
        int compare = compare(r1.get(name), r2.get(name), f.schema());
        if (compare != 0)                         // not equal
          return f.order() == Field.Order.DESCENDING ? -compare : compare;
      }
      return 0;
    case ENUM:
      return s.getEnumOrdinal((String)o1) - s.getEnumOrdinal((String)o2);
    case ARRAY:
View Full Code Here

      SpecificRecord r1 = (SpecificRecord)o1;
      SpecificRecord r2 = (SpecificRecord)o2;
      Iterator<Field> fields = s.getFields().values().iterator();
      for (int i = 0; fields.hasNext(); i++) {
        Field f = fields.next();
        if (f.order() == Field.Order.IGNORE)
          continue;                               // ignore this field
        int compare = compare(r1.get(i), r2.get(i), f.schema());
        if (compare != 0)                         // not equal
          return f.order() == Field.Order.DESCENDING ? -compare : compare;
      }
View Full Code Here

        Field f = fields.next();
        if (f.order() == Field.Order.IGNORE)
          continue;                               // ignore this field
        int compare = compare(r1.get(i), r2.get(i), f.schema());
        if (compare != 0)                         // not equal
          return f.order() == Field.Order.DESCENDING ? -compare : compare;
      }
      return 0;
    case ENUM:
      return ((Enum)o1).ordinal() - ((Enum)o2).ordinal();
    default:
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.