Package org.apache.blur.thrift.generated

Examples of org.apache.blur.thrift.generated.RowMutation


    child.addField("recordid", "1");
    child.addField("fam.key", "value");

    parent.addChildDocument(child);

    RowMutation mutate = RowMutationHelper.from(parent, "foo");

    assertEquals("Should get our rowid back.", "123", mutate.getRowId());
    assertEquals("Should get a single record.", 1, mutate.getRecordMutationsSize());
    assertEquals("Tablename should be set", "foo", mutate.getTable());
  }
View Full Code Here


    SolrInputDocument child = new SolrInputDocument();
    child.addField("recordid", "1");
    child.addField("fam.key", "value1");
    child.addField("fam.key", "value2");
    doc.addChildDocument(child);
    RowMutation mutate = RowMutationHelper.from(doc, "foo");

    List<Object> vals = getRecordValues("key", mutate);
    assertEquals("Should get both values back.", 2, vals.size());

    assertEquals("value1", vals.get(0).toString());
View Full Code Here

      child.addField("fam.key", "value" + i);
      children.add(child);
    }
    doc.addChildDocuments(children);

    RowMutation mutate = RowMutationHelper.from(doc, "foo");

    assertEquals("Children should turn into records.", 10, mutate.getRecordMutationsSize());
    assertEquals("Should get a simple value back.", "value0", getRecordValue("key", mutate));
    assertEquals("Should properly figure our family.", "fam", getFirstRecord(mutate).getFamily());
  }
View Full Code Here

    }
    thread.join();
  }

  private RowMutation genRowMutation(String table) {
    RowMutation rowMutation = new RowMutation();
    rowMutation.setRowId(Long.toString(random.nextLong()));
    rowMutation.setTable(table);
    rowMutation.setRowMutationType(RowMutationType.REPLACE_ROW);
    Record record = new Record();
    record.setFamily("testing");
    record.setRecordId(Long.toString(random.nextLong()));
    for (int i = 0; i < 10; i++) {
      record.addToColumns(new Column("col" + i, Long.toString(random.nextLong())));
    }
    rowMutation.addToRecordMutations(new RecordMutation(RecordMutationType.REPLACE_ENTIRE_RECORD, record));
    return rowMutation;
  }
View Full Code Here

      }
    });
  }

  private RowMutation toDeleteMutation(String id) {
    RowMutation mutate = new RowMutation();
    mutate.setRowId(id);
    mutate.setRowMutationType(RowMutationType.DELETE_ROW);
    mutate.setTable(tableName);
    return mutate;
  }
View Full Code Here

  }

  public static RowMutation from(SolrInputDocument doc, String table) {
    validateAsRow(doc);

    RowMutation mutate = new RowMutation();
    String rowid = extractRowId(doc);
    mutate.setRowId(rowid);
    mutate.setTable(table);
    List<RecordMutation> recordMutations = Lists.newArrayList();

    if (doc.hasChildDocuments()) {
      for (SolrInputDocument child : doc.getChildDocuments()) {
        validateAsRecord(child);
        recordMutations.add(createRecordMutation(child, extractRecordId(child)));
      }

    }
    mutate.setRecordMutations(recordMutations);
    return mutate;
  }
View Full Code Here

  }

  public static List<RowMutation> reduceMutates(List<RowMutation> mutations) throws BlurException {
    Map<String, RowMutation> mutateMap = new TreeMap<String, RowMutation>();
    for (RowMutation mutation : mutations) {
      RowMutation rowMutation = mutateMap.get(mutation.getRowId());
      if (rowMutation != null) {
        mutateMap.put(mutation.getRowId(), merge(rowMutation, mutation));
      } else {
        mutateMap.put(mutation.getRowId(), mutation);
      }
View Full Code Here

  private void doEnqueue(final String table, List<RowMutation> mutations) throws IOException, BlurException {
    final Map<String, BlurIndex> indexes = _indexServer.getIndexes(table);
    Map<String, List<RowMutation>> mutationsByShard = new HashMap<String, List<RowMutation>>();
    for (int i = 0; i < mutations.size(); i++) {
      RowMutation mutation = mutations.get(i);
      String shard = MutationHelper.getShardName(table, mutation.rowId, getNumberOfShards(table), _blurPartitioner);
      List<RowMutation> list = mutationsByShard.get(shard);
      if (list == null) {
        list = new ArrayList<RowMutation>();
        mutationsByShard.put(shard, list);
View Full Code Here

  private void doMutates(final String table, List<RowMutation> mutations) throws IOException, BlurException {
    final Map<String, BlurIndex> indexes = _indexServer.getIndexes(table);
    Map<String, List<RowMutation>> mutationsByShard = new HashMap<String, List<RowMutation>>();
    for (int i = 0; i < mutations.size(); i++) {
      RowMutation mutation = mutations.get(i);
      String shard = MutationHelper.getShardName(table, mutation.rowId, getNumberOfShards(table), _blurPartitioner);
      List<RowMutation> list = mutationsByShard.get(shard);
      if (list == null) {
        list = new ArrayList<RowMutation>();
        mutationsByShard.put(shard, list);
View Full Code Here

      }
    }
  }

  private static RowMutation getRowMutation(int rowid, String table, boolean wal, int numberRecordsPerRow, int numberOfColumns, int numberOfFamilies, int numberOfWords) {
    RowMutation mutation = new RowMutation();
    mutation.setTable(table);
    mutation.setRowId(Integer.toString(rowid));
    mutation.setRowMutationType(RowMutationType.REPLACE_ROW);
    for (int j = 0; j < numberRecordsPerRow; j++) {
      mutation.addToRecordMutations(getRecordMutation(numberOfColumns, numberOfFamilies, numberOfWords));
    }
    return mutation;
  }
View Full Code Here

TOP

Related Classes of org.apache.blur.thrift.generated.RowMutation

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.