Examples of ColumnOrder


Examples of org.apache.crunch.lib.Sort.ColumnOrder

    List<Schema.Field> fields = Lists.newArrayList();
    AvroType<S> parentAvroType = (AvroType<S>) ptype;
    Schema parentAvroSchema = parentAvroType.getSchema();

    for (int index = 0; index < orders.length; index++) {
      ColumnOrder columnOrder = orders[index];
      AvroType<?> atype = (AvroType<?>) ptype.getSubTypes().get(index);
      Schema fieldSchema = atype.getSchema();
      String fieldName = parentAvroSchema.getFields().get(index).name();
      // Note: avro sorting of strings is inverted relative to how sorting works for WritableComparable
      // Text instances: making this consistent
      Schema.Field.Order order = columnOrder.order() == Order.DESCENDING ? Schema.Field.Order.DESCENDING :
        Schema.Field.Order.ASCENDING;
      fields.add(new Schema.Field(fieldName, fieldSchema, "", null, order));
    }
    schema.setFields(fields);
    return schema;
View Full Code Here

Examples of org.apache.crunch.lib.Sort.ColumnOrder

    String sbv = tmpDir.copyResourceFileName("sort_by_value.txt");
    PTable<String, Long> letterCounts = pipeline.read(From.textFile(sbv)).parallelDo(new SplitFn("\t"),
        ptf.tableOf(ptf.strings(), ptf.longs()));
    PCollection<Pair<String, Long>> sorted = Sort.sortPairs(
        letterCounts,
        new ColumnOrder(2, Order.DESCENDING),
        new ColumnOrder(1, Order.ASCENDING));
    assertEquals(
        ImmutableList.of(Pair.of("C", 3L), Pair.of("A", 2L), Pair.of("D", 2L), Pair.of("B", 1L), Pair.of("E", 1L)),
        ImmutableList.copyOf(sorted.materialize()));
  }
View Full Code Here

Examples of org.apache.crunch.lib.Sort.ColumnOrder

    List<Schema.Field> fields = Lists.newArrayList();
    AvroType<S> parentAvroType = (AvroType<S>) ptype;
    Schema parentAvroSchema = parentAvroType.getSchema();

    for (int index = 0; index < orders.length; index++) {
      ColumnOrder columnOrder = orders[index];
      AvroType<?> atype = (AvroType<?>) ptype.getSubTypes().get(index);
      Schema fieldSchema = atype.getSchema();
      String fieldName = parentAvroSchema.getFields().get(index).name();
      // Note: avro sorting of strings is inverted relative to how sorting works for WritableComparable
      // Text instances: making this consistent
      Schema.Field.Order order = columnOrder.order() == Order.DESCENDING ? Schema.Field.Order.DESCENDING :
        Schema.Field.Order.ASCENDING;
      fields.add(new Schema.Field(fieldName, fieldSchema, "", null, order));
    }
    schema.setFields(fields);
    return schema;
View Full Code Here

Examples of org.araneaframework.uilib.list.structure.order.ColumnOrder

    }
    super.addListColumn(id, label, order, filter);
  }
 
  public void addBeanColumn(String id, String label, boolean isOrdered, ColumnFilter filter, Control control) {
    ColumnOrder order = null;
    if (isOrdered) {
      order = new SimpleColumnOrder();
      propagateValueType(order, id);
    }
    addBeanColumn(id, label, order, filter, control);
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.