Examples of FTable


Examples of com.alibaba.wasp.meta.FTable

    return indexes.toArray(new Index[0]);
  }

  public String describeIndex(String tableName, String indexName)
      throws IOException {
    FTable table = getTableDescriptor(Bytes.toBytes(tableName));
    LinkedHashMap<String, Index> indexMap = table.getIndex();
    Index index = indexMap.get(indexName);
    if (index == null) {
      return "";
    }
View Full Code Here

Examples of com.alibaba.wasp.meta.FTable

    builder.append("+----------------------+----------+-------+\n");
    return builder.toString();
  }

  public String describeTable(String tableName) throws IOException {
    FTable table = getTableDescriptor(Bytes.toBytes(tableName));
    String parentTableName = table.getParentName() == null ? "ROOT" : table.getParentName();
    StringBuilder builder = new StringBuilder();
    builder.append("+-------------------------------------------------------------+\n");
    builder.append("|                       Parent Table                          |\n");
    builder.append("+-------------------------------------------------------------+\n");
    builder.append("| ").append(parentTableName).append(getGivenBlanks(60 - parentTableName.length())).append("|\n");
    builder.append("+---------------------------+----------+----------+-----+-----+\n");
    builder.append("| Field                     | Type     | REQUIRED | Key | EGK |\n");
    builder.append("+---------------------------+----------+----------+-----+-----+\n");
    String line = "| {0} | {1} | {2} | {3} | {4} |";
    LinkedHashMap<String, Field> priKeys = table.getPrimaryKeys();
    Field egKey = table.getEntityGroupKey();
    for (Field field : table.getColumns().values()) {
      String fieldname = field.getName();
      String s0 = fieldname
          + (fieldname.length() < 25 ? getGivenBlanks(25 - fieldname.length())
              : "");
      String type = field.getType().toString();
View Full Code Here

Examples of com.alibaba.wasp.meta.FTable

    });

    // Wait until all entityGroups deleted
    for (int tries = 0; tries < (this.numRetries * this.retryLongerMultiplier); tries++) {
      try {
        FTable fTable = this.getTableDescriptor(tableName);
        // let us wait until .FMETA. table is updated and
        tableExists = fTable != null;
        if (!tableExists) {
          break;
        }
View Full Code Here

Examples of com.alibaba.wasp.meta.FTable

   * @throws java.io.IOException
   *           if a remote or network exception occurs
   */
  public void addColumn(final byte[] tableName, final Field column)
      throws IOException {
    FTable newTable = this.getTableDescriptor(tableName);
    newTable.getColumns().put(column.getName(), column);
    modifyTable(tableName, newTable);
  }
View Full Code Here

Examples of com.alibaba.wasp.meta.FTable

   * @throws java.io.IOException
   *           if a remote or network exception occurs
   */
  public void deleteColumn(final byte[] tableName, final byte[] columnName)
      throws IOException {
    FTable newTable = this.getTableDescriptor(tableName);
    newTable.getColumns().remove(columnName);
    modifyTable(tableName, newTable);
  }
View Full Code Here

Examples of com.alibaba.wasp.meta.FTable

   * @throws java.io.IOException
   *           if a remote or network exception occurs
   */
  public void modifyColumn(final byte[] tableName, final Field field)
      throws IOException {
    FTable newTable = this.getTableDescriptor(tableName);
    Field oldField = newTable.getColumns().get(field.getName());
    if (oldField != null) {
      newTable.getColumns().put(field.getName(), field);
    }
    modifyTable(tableName, newTable);
  }
View Full Code Here

Examples of com.alibaba.wasp.meta.FTable

        + ".", nameStr);
  }

  @Test
  public void testContainsRange() {
    FTable table = new FTable();
    table.setTableName("testtable");
    EntityGroupInfo egi = new EntityGroupInfo(Bytes.toBytes(table
        .getTableName()), Bytes.toBytes("a"), Bytes.toBytes("g"));
    // Single row range at start of entityGroup
    assertTrue(egi.containsRange(Bytes.toBytes("a"), Bytes.toBytes("a")));
    // Fully contained range
    assertTrue(egi.containsRange(Bytes.toBytes("b"), Bytes.toBytes("c")));
View Full Code Here

Examples of com.alibaba.wasp.meta.FTable

    }
  }

  @Test
  public void testLastEntityGroupCompare() {
    FTable table = new FTable();
    table.setTableName("testtable");
    EntityGroupInfo egip = new EntityGroupInfo(Bytes.toBytes(table
        .getTableName()), Bytes.toBytes("a"), new byte[0]);
    EntityGroupInfo egic = new EntityGroupInfo(Bytes.toBytes(table
        .getTableName()), Bytes.toBytes("a"), Bytes.toBytes("b"));
    assertTrue(egip.compareTo(egic) > 0);
  }
View Full Code Here

Examples of com.alibaba.wasp.meta.FTable

   *         {@link EntityGroup#closeEntityGroup(EntityGroup)} when done.
   */
  private static EntityGroup initEntityGroup(byte[] tableName, byte[] startKey,
      byte[] stopKey, String callingMethod, Configuration conf,
      List<Field> fields) throws IOException {
    FTable table = new FTable();
    table.setTableName(Bytes.toString(tableName));
    LinkedHashMap<String, Field> finalFields = new LinkedHashMap<String, Field>();
    for (Field field : fields) {
      finalFields.put(field.getName(), field);
    }
    table.setColumns(finalFields);
    EntityGroupInfo info = new EntityGroupInfo(Bytes.toBytes(table
        .getTableName()), startKey, stopKey, false);

    if (FMetaReader.exists(TEST_UTIL.getConfiguration(), info)) {
      throw new IOException("All ready has a entityGroupInfo "
          + info.getEntityGroupNameAsString());
View Full Code Here

Examples of com.alibaba.wasp.meta.FTable

    }
  }

  @Test
  public void printFTable() {
    FTable user = FMetaTestUtil.User;
    FTable photo = FMetaTestUtil.Photo;
    System.out.println(user.toString());
    System.out.println("\n");
    System.out.println(photo.toString());
  }
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.