Package com.alibaba.wasp.meta

Examples of com.alibaba.wasp.meta.FTable


    TableSchemaCacheReader.getInstance(conf, null);
  }

  @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


      Assert.assertTrue(result);
      try {
        Plan plan = context.getPlan();
        if (plan instanceof CreateTablePlan) {
          CreateTablePlan createTable = (CreateTablePlan) plan;
          FTable ftable = createTable.getTable();
          TableSchemaCacheReader.getService(conf).createTable(ftable);
          TableSchemaCacheReader.getInstance(conf).addSchema(
              ftable.getTableName(), ftable);
        } else if (plan instanceof CreateIndexPlan) {
          CreateIndexPlan createIndex = (CreateIndexPlan) plan;
          Index index = createIndex.getIndex();
          TableSchemaCacheReader.getService(conf).addIndex(
              index.getDependentTableName(), index);
View Full Code Here

  public void testYankingEntityGroupFromUnderIt() throws IOException,
      NodeExistsException, KeeperException {
    final Server server = new MockServer(WTU);
    final FServerServices rss = new MockFServerServices();

    FTable htd = TEST_FTD;
    final EntityGroupInfo egi = TEST_EGI;
    EntityGroup entityGroup = EntityGroup.createEntityGroup(egi,
        WTU.getConfiguration(), htd, rss);
    assertNotNull(entityGroup);
    try {
View Full Code Here

    }
  }

  @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

   *         {@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

  private Configuration conf = WaspConfiguration.create();

  @Test
  public void testCheckAndGetIndex() throws ZooKeeperConnectionException,
      MetaException {
    FTable table = FMetaTestUtil.getTestTable();
    List<String> fields = new ArrayList<String>();
    fields.add("c4");
    fields.add("c5");
    Index i1 = FMetaTestUtil.makeIndex(table, "i1", fields);
    table.addIndex(i1);
    fields = new ArrayList<String>();
    fields.add("c5");
    fields.add("c4");
    Index i2 = FMetaTestUtil.makeIndex(table, "i2", fields);
    table.addIndex(i2);

    String sql1 = "SELECT c1, c2, c3 from test where c4=1 and c5=2;";
    String sql2 = "SELECT c1, c2, c3 from test where c5=2 and c4=1;";

    String[] sqlList = { sql1, sql2 }; // sql1, sql2, sql3

    Index[] indexs = { i1, i2 }; // sql1, sql2, sql3

    DruidDQLParser druidParser = new DruidDQLParser(conf);
    for (int i = 0; i < sqlList.length; i++) {
      String sql = sqlList[i];
      context.setSql(sql);
      try {
        druidParser.parseSqlToStatement(context);
        SQLStatement stmt = context.getStmt();
        if (stmt instanceof SQLSelectStatement) {
          MemFMetaStore fmetaServices = new MemFMetaStore();
          TableSchemaCacheReader reader = TableSchemaCacheReader.getInstance(
              conf, fmetaServices);
          reader.addSchema(table.getTableName(), table);
          MetaEventOperation metaEventOperation = new FMetaEventOperation(
              reader);

          SQLSelectStatement sqlSelectStatement = (SQLSelectStatement) stmt;
          // this is SELECT clause
View Full Code Here

  public static void main(String[] args) throws IOException {
    Configuration conf = WaspConfiguration.create();
    LocalWaspCluster cluster = new LocalWaspCluster(conf);
    cluster.startup();
    WaspAdmin admin = new WaspAdmin(conf);
    FTable table = new FTable();
    table.setTableName(cluster.getClass().getName());
    admin.createTable(table);
    cluster.shutdown();
  }
View Full Code Here

  @Test
  public void testFailedCommitAborts() throws IOException, NodeExistsException,
      KeeperException {
    final Server server = new MockServer(WTU, false);
    final FServerServices rss = new MockFServerServices();
    FTable wtd = TEST_FTD;
    final EntityGroupInfo egi = new EntityGroupInfo(wtd.getTableName(),
        FConstants.EMPTY_END_ROW, FConstants.EMPTY_END_ROW);
    EntityGroup entityGroup = EntityGroup.createEntityGroup(egi,
        WTU.getConfiguration(), wtd, rss);
    try {
      assertNotNull(entityGroup);
View Full Code Here

  public void testZKClosingNodeVersionMismatch() throws IOException,
      NodeExistsException, KeeperException, DeserializationException {
    final Server server = new MockServer(WTU);
    final MockFServerServices rss = new MockFServerServices();

    FTable ftd = TEST_FTD;
    final EntityGroupInfo egi = TEST_EGI;

    // open a entityGroup first so that it can be closed later
    openEntityGroup(server, rss, ftd, egi);
View Full Code Here

  @Test
  public void testCloseEntityGroup() throws IOException, NodeExistsException,
      KeeperException, DeserializationException {
    final Server server = new MockServer(WTU);
    final MockFServerServices rss = new MockFServerServices();
    FTable htd = TEST_FTD;
    EntityGroupInfo egi = TEST_EGI;
    openEntityGroup(server, rss, htd, egi);
    int versionOfClosingNode = ZKAssign.createNodeClosing(
        server.getZooKeeper(), egi, server.getServerName());
    CloseEntityGroupHandler handler = new CloseEntityGroupHandler(server, rss,
View Full Code Here

TOP

Related Classes of com.alibaba.wasp.meta.FTable

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.