Package org.apache.blur.thrift.generated

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


  @Test
  public void testGetNumReducersBadPath() {

    BlurTask task = new BlurTask();
    TableDescriptor tableDescriptor = new TableDescriptor();
    tableDescriptor.setShardCount(5);
    tableDescriptor.setTableUri(new File(TMPDIR, "blur34746545").toURI().toString());
    tableDescriptor.setName("blur34746545");
    task.setTableDescriptor(tableDescriptor);
    assertEquals(5, task.getNumReducers(new Configuration()));
  }
View Full Code Here


    new File(TMPDIR, "blurTestShards/shard-1/").mkdirs();
    new File(TMPDIR, "blurTestShards/shard-2/").mkdirs();
    new File(TMPDIR, "blurTestShards/shard-3/").mkdirs();
    try {
      BlurTask task = new BlurTask();
      TableDescriptor tableDescriptor = new TableDescriptor();
      tableDescriptor.setShardCount(5);
      tableDescriptor.setTableUri(new File(TMPDIR, "blurTestShards").toURI().toString());
      tableDescriptor.setName("blurTestShards");
      task.setTableDescriptor(tableDescriptor);
      assertEquals(3, task.getNumReducers(new Configuration()));
    } finally {
      new File(TMPDIR, "blurTestShards/shard-1/").delete();
      new File(TMPDIR, "blurTestShards/shard-2/").delete();
View Full Code Here

      throw new BException("Table cannot be null.");
    }
    if (columnDefinition == null) {
      throw new BException("ColumnDefinition cannot be null.");
    }
    TableDescriptor tableDescriptor = describe(table);
    TableContext context = TableContext.create(tableDescriptor);
    FieldManager fieldManager = context.getFieldManager();
    String family = columnDefinition.getFamily();
    if (family == null) {
      throw new BException("Family in ColumnDefinition [{0}] cannot be null.", columnDefinition);
View Full Code Here

      e.printStackTrace();
    }
  }

  public void createTable(Iface client, String tableName, String cluster) throws BlurException, TException {
    TableDescriptor td = new TableDescriptor();

    td.name = tableName;
    // TODO: doc doesnt say required, yet it barfs without it?
    td.cluster = cluster == null ? "default" : cluster;
    // auto enable table
View Full Code Here

  @Test
  public void shouldAddQueriesToDB() throws BlurException, TException, IOException {
    Iface blurConnection = BlurClient.getClient(MiniCluster.getControllerConnectionStr());


    TableDescriptor td = new TableDescriptor();
    td.setTableUri(MiniCluster.getFileSystemUri() + "/blur-tables/test");
    td.setName("test");
    td.setShardCount(1);

    blurConnection.createTable(td);
   
    BlurQuery query = new BlurQuery();
    query.setQuery(new Query("test.col:*", true, ScoreType.SUPER, null, null));
View Full Code Here

  }

  @Test
  public void testCreateTable() throws BlurException, TException, IOException {
    Blur.Iface client = getClient();
    TableDescriptor tableDescriptor = new TableDescriptor();
    tableDescriptor.setName("test");
    tableDescriptor.setShardCount(5);
    tableDescriptor.setTableUri(MiniCluster.getFileSystemUri().toString() + "/blur/test");
    client.createTable(tableDescriptor);
    List<String> tableList = client.tableList();
    assertEquals(Arrays.asList("test"), tableList);
  }
View Full Code Here

  @Test
  public void testCreateDisableAndRemoveTable() throws IOException, BlurException, TException {
    Iface client = getClient();
    String tableName = UUID.randomUUID().toString();
    TableDescriptor tableDescriptor = new TableDescriptor();
    tableDescriptor.setName(tableName);
    tableDescriptor.setShardCount(5);
    tableDescriptor.setTableUri(MiniCluster.getFileSystemUri().toString() + "/blur/" + tableName);

    for (int i = 0; i < 3; i++) {
      client.createTable(tableDescriptor);
      client.disableTable(tableName);
      client.removeTable(tableName, true);
View Full Code Here

    byte[] data = new byte[input.readInt()];
    input.readFully(data);
    ByteArrayInputStream is = new ByteArrayInputStream(data);
    TIOStreamTransport trans = new TIOStreamTransport(is);
    TBinaryProtocol protocol = new TBinaryProtocol(trans);
    _tableDescriptor = new TableDescriptor();
    try {
      _tableDescriptor.read(protocol);
    } catch (TException e) {
      throw new IOException(e);
    }
View Full Code Here

      BlurException {
    CommandLine cmd = CreateTableCommandHelper.parse(args, out);
    if (cmd == null) {
      throw new CommandException(name() + " missing required arguments");
    }
    TableDescriptor td = new TableDescriptor();

    td.setCluster(Main.getCluster(client));
    td.setName(cmd.getOptionValue("t"));
    td.setShardCount(Integer.parseInt(cmd.getOptionValue("c")));

    if (cmd.hasOption("b")) {
      td.setBlockCaching(false);
    }
    if (cmd.hasOption("B")) {
      String[] optionValues = cmd.getOptionValues("B");
      Set<String> blockCachingFileTypes = new HashSet<String>();
      if (optionValues != null) {
        blockCachingFileTypes.addAll(Arrays.asList(cmd.getOptionValues("B")));
      }
      td.setBlockCachingFileTypes(blockCachingFileTypes);
    }
    if (cmd.hasOption("mfi")) {
      td.setDefaultMissingFieldLessIndexing(false);
    }
    if (cmd.hasOption("mft")) {
      String defaultMissingFieldType = cmd.getOptionValue("mft");
      td.setDefaultMissingFieldType(defaultMissingFieldType);
    }
    if (cmd.hasOption("mfp")) {
      Map<String, String> defaultMissingFieldProps = getProps(cmd, "mfp");
      td.setDefaultMissingFieldProps(defaultMissingFieldProps);
    }
    if (cmd.hasOption("d")) {
      td.setEnabled(false);
    }
    if (cmd.hasOption("p")) {
      Map<String, String> tableProperties = getProps(cmd, "p");
      td.setTableProperties(tableProperties);
    }
    if (cmd.hasOption("s")) {
      td.setStrictTypes(true);
    }
    if (cmd.hasOption("r")) {
      td.setReadOnly(true);
    }
    if (cmd.hasOption("l")) {
      String tableUri = cmd.getOptionValue("l");
      td.setTableUri(tableUri);
    }
    if (cmd.hasOption("P")) {
      td.setPreCacheCols(Arrays.asList(cmd.getOptionValues("P")));
    }
    if (cmd.hasOption("S")) {
      td.setSimilarityClass(cmd.getOptionValue("S"));
    }

    if (Main.debug) {
      out.println(td.toString());
      out.flush();
    }

    client.createTable(td);
  }
View Full Code Here

    List<String> tableList = client.tableList();
    if (!tableList.contains(tablename)) {
      out.println("Table does not exist.");
      return;
    }
    TableDescriptor tableDescriptor = client.describe(tablename);
    if (tableDescriptor.isEnabled()) {
      out.println("Disabling table.");
      out.flush();
      client.disableTable(tablename);
    }
    out.println("Removing table.");
View Full Code Here

TOP

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

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.