Package org.apache.blur.thrift.generated

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


  }

  public Schema schema(String table) throws IOException {
    TableContext tableContext = getTableContext(table);
    FieldManager fieldManager = tableContext.getFieldManager();
    Schema schema = new Schema().setTable(table);
    schema.setFamilies(new HashMap<String, Map<String, ColumnDefinition>>());
    Set<String> fieldNames = fieldManager.getFieldNames();
    INNER: for (String fieldName : fieldNames) {
      FieldTypeDefinition fieldTypeDefinition = fieldManager.getFieldTypeDefinition(fieldName);
      if (fieldTypeDefinition == null) {
        continue INNER;
      }
      String columnName = fieldTypeDefinition.getColumnName();
      String columnFamily = fieldTypeDefinition.getFamily();
      String subColumnName = fieldTypeDefinition.getSubColumnName();
      Map<String, ColumnDefinition> map = schema.getFamilies().get(columnFamily);
      if (map == null) {
        map = new HashMap<String, ColumnDefinition>();
        schema.putToFamilies(columnFamily, map);
      }
      if (subColumnName == null) {
        map.put(columnName, getColumnDefinition(fieldTypeDefinition));
      } else {
        map.put(columnName + "." + subColumnName, getColumnDefinition(fieldTypeDefinition));
View Full Code Here


    List<Map<String, String>> data = new ArrayList<Map<String, String>>();
    for (String table : tables) {
      if (tableNamePattern != null && !table.equals(tableNamePattern)) {
        continue;
      }
      Schema schema = schemaMap.get(table);
      Map<String, Map<String, ColumnDefinition>> families = schema.getFamilies();
      addTableRow(data, table, table);
      for (String columnFamily : families.keySet()) {
        String tablePlusCf = table + "." + columnFamily;
        if (tableNamePattern != null && !tablePlusCf.equals(tableNamePattern)) {
          continue;
View Full Code Here

    return new HashSet<String>(terms);
  }

  private static Set<String> getFields(String connectionStr, final String tableName) throws BlurException, TException, IOException {
    Iface client = BlurClient.getClient(connectionStr);
    Schema schema = client.schema(tableName);
    Set<String> fields = new HashSet<String>();
    for (String cf : schema.families.keySet()) {
      for (String field : schema.families.get(cf).keySet()) {
        fields.add(cf + "." + field);
      }
View Full Code Here

          return client.schema(table);
        }
      }, new Merger<Schema>() {
        @Override
        public Schema merge(BlurExecutorCompletionService<Schema> service) throws BlurException {
          Schema result = null;
          while (service.getRemainingCount() > 0) {
            Future<Schema> future = service.poll(_defaultParallelCallTimeout, TimeUnit.MILLISECONDS, true, table);
            Schema schema = service.getResultThrowException(future, table);
            if (result == null) {
              result = schema;
            } else {
              result = BlurControllerServer.merge(result, schema);
            }
View Full Code Here

    assertEquals(0, indexManager.recordFrequency(TABLE, FAMILY, "testcol1", "NO VALUE"));
  }

  @Test
  public void testSchema() throws Exception {
    Schema schema = indexManager.schema(TABLE);
    assertEquals(TABLE, schema.table);
    Map<String, Map<String, ColumnDefinition>> families = schema.getFamilies();
    assertEquals(new TreeSet<String>(Arrays.asList(FAMILY, FAMILY2)), new TreeSet<String>(families.keySet()));
    assertEquals(new TreeSet<String>(Arrays.asList("testcol1", "testcol2", "testcol3", "testcol12", "testcol13")),
        new TreeSet<String>(families.get(FAMILY).keySet()));
    assertEquals(new TreeSet<String>(Arrays.asList("testcol18")), new TreeSet<String>(families.get(FAMILY2).keySet()));
  }
View Full Code Here

    return new HashSet<String>(terms);
  }

  private static Set<String> getFields(String connectionStr, final String tableName) throws BlurException, TException, IOException {
    Iface client = BlurClient.getClient(connectionStr);
    Schema schema = client.schema(tableName);
    Set<String> fields = new HashSet<String>();
    for (String cf : schema.families.keySet()) {
      for (String field : schema.families.get(cf).keySet()) {
        fields.add(cf + "." + field);
      }
View Full Code Here

    blurQueryRecord.setQuery(queryRecord);
    BlurResults resultsRecord = client.query("test", blurQueryRecord);
    assertRecordResults(resultsRecord);
    assertEquals(length, resultsRecord.getTotalResults());

    Schema schema = client.schema("test");
    assertFalse(schema.getFamilies().isEmpty());
  }
View Full Code Here

    if (args.length != 2) {
      throw new CommandException("Invalid args: " + help());
    }
    String tablename = args[1];

    Schema schema = client.schema(tablename);
    out.println(schema);
    out.println(schema.getTable());
    Map<String, Map<String, ColumnDefinition>> families = schema.getFamilies();
    Set<String> familyNames = new TreeSet<String>(families.keySet());
    for (String cf : familyNames) {
      out.println("family : " + cf);
      Map<String, ColumnDefinition> columns = families.get(cf);
      Set<String> columnNames = new TreeSet<String>(columns.keySet());
View Full Code Here

        if (descriptor.isEnabled()) {
          TableStats stats = client.tableStats(table);
          tableInfo.put("rows", stats.getRowCount());
          tableInfo.put("records", stats.getRecordCount());

          Schema schema = client.schema(table);
          tableInfo.put("families", new ArrayList<String>(schema.getFamilies().keySet()));
        } else {
          tableInfo.put("rows", "?");
          tableInfo.put("records", "?");
          tableInfo.put("families", new ArrayList<String>());
        }
View Full Code Here

  }

  public static Map<String, Map<String, Map<String, Object>>> getSchema(String table) throws IOException, TException {
    Iface client = BlurClient.getClient(Config.getConnectionString());

    Schema schema = client.schema(table);

    Map<String, Map<String, Map<String, Object>>> schemaInfo = new TreeMap<String, Map<String, Map<String, Object>>>();
    for (Map.Entry<String, Map<String, ColumnDefinition>> famEntry : schema.getFamilies().entrySet()) {
      Map<String, Map<String, Object>> columns = new TreeMap<String, Map<String, Object>>();
      for (Map.Entry<String, ColumnDefinition> colEntry : famEntry.getValue().entrySet()) {
        Map<String, Object> info = new HashMap<String, Object>();
        ColumnDefinition def = colEntry.getValue();
        info.put("fieldLess", def.isFieldLessIndexed());
View Full Code Here

TOP

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

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.