Package org.apache.accumulo.core.client.mapreduce

Examples of org.apache.accumulo.core.client.mapreduce.InputTableConfig


      for (Map.Entry<String,InputTableConfig> tableConfig : inputTableConfigs.entrySet()) {
        if (!c.securityOperations().hasTablePermission(getPrincipal(implementingClass, conf), tableConfig.getKey(), TablePermission.READ))
          throw new IOException("Unable to access table");
      }
      for (Map.Entry<String,InputTableConfig> tableConfigEntry : inputTableConfigs.entrySet()) {
        InputTableConfig tableConfig = tableConfigEntry.getValue();
        if (!tableConfig.shouldUseLocalIterators()) {
          if (tableConfig.getIterators() != null) {
            for (IteratorSetting iter : tableConfig.getIterators()) {
              if (!c.tableOperations().testClassLoad(tableConfigEntry.getKey(), iter.getIteratorClass(), SortedKeyValueIterator.class.getName()))
                throw new AccumuloException("Servers are unable to load " + iter.getIteratorClass() + " as a " + SortedKeyValueIterator.class.getName());
            }
          }
        }
View Full Code Here


   * @since 1.6.0
   */
  protected static Map.Entry<String,InputTableConfig> getDefaultInputTableConfig(Class<?> implementingClass, Configuration conf) {
    String tableName = getInputTableName(implementingClass, conf);
    if (tableName != null) {
      InputTableConfig queryConfig = new InputTableConfig();
      List<IteratorSetting> itrs = getIterators(implementingClass, conf);
      if (itrs != null)
        queryConfig.setIterators(itrs);
      Set<Pair<Text,Text>> columns = getFetchedColumns(implementingClass, conf);
      if (columns != null)
        queryConfig.fetchColumns(columns);
      List<Range> ranges = null;
      try {
        ranges = getRanges(implementingClass, conf);
      } catch (IOException e) {
        throw new RuntimeException(e);
      }
      if (ranges != null)
        queryConfig.setRanges(ranges);

      queryConfig.setAutoAdjustRanges(getAutoAdjustRanges(implementingClass, conf)).setUseIsolatedScanners(isIsolated(implementingClass, conf))
          .setUseLocalIterators(usesLocalIterators(implementingClass, conf)).setOfflineScan(isOfflineScan(implementingClass, conf));
      return Maps.immutableEntry(tableName, queryConfig);
    }
    return null;
  }
View Full Code Here

 
  private InputTableConfig tableQueryConfig;
 
  @Before
  public void setUp() {
    tableQueryConfig = new InputTableConfig();
  }
View Full Code Here

  }
 
  @Test
  public void testSerialization_OnlyTable() throws IOException {
    byte[] serialized = serialize(tableQueryConfig);
    InputTableConfig actualConfig = deserialize(serialized);
   
    assertEquals(tableQueryConfig, actualConfig);
  }
View Full Code Here

    ranges.add(new Range("a", "b"));
    ranges.add(new Range("c", "d"));
    tableQueryConfig.setRanges(ranges);
   
    byte[] serialized = serialize(tableQueryConfig);
    InputTableConfig actualConfig = deserialize(serialized);
   
    assertEquals(ranges, actualConfig.getRanges());
  }
View Full Code Here

    columns.add(new Pair<Text,Text>(new Text("cf1"), new Text("cq1")));
    columns.add(new Pair<Text,Text>(new Text("cf2"), null));
    tableQueryConfig.fetchColumns(columns);
   
    byte[] serialized = serialize(tableQueryConfig);
    InputTableConfig actualConfig = deserialize(serialized);
   
    assertEquals(actualConfig.getFetchedColumns(), columns);
  }
View Full Code Here

    List<IteratorSetting> settings = new ArrayList<IteratorSetting>();
    settings.add(new IteratorSetting(50, "iter", "iterclass"));
    settings.add(new IteratorSetting(55, "iter2", "iterclass2"));
    tableQueryConfig.setIterators(settings);
    byte[] serialized = serialize(tableQueryConfig);
    InputTableConfig actualConfig = deserialize(serialized);
    assertEquals(actualConfig.getIterators(), settings);
   
  }
View Full Code Here

    return baos.toByteArray();
  }
 
  private InputTableConfig deserialize(byte[] bytes) throws IOException {
    ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
    InputTableConfig actualConfig = new InputTableConfig(new DataInputStream(bais));
    bais.close();
    return actualConfig;
  }
View Full Code Here

  @Test
  public void testTableQueryConfigSerialization() throws IOException {

    JobConf job = new JobConf();

    InputTableConfig table1 = new InputTableConfig().setRanges(Collections.singletonList(new Range("a", "b")))
        .fetchColumns(Collections.singleton(new Pair<Text,Text>(new Text("CF1"), new Text("CQ1"))))
        .setIterators(Collections.singletonList(new IteratorSetting(50, "iter1", "iterclass1")));

    InputTableConfig table2 = new InputTableConfig().setRanges(Collections.singletonList(new Range("a", "b")))
        .fetchColumns(Collections.singleton(new Pair<Text,Text>(new Text("CF1"), new Text("CQ1"))))
        .setIterators(Collections.singletonList(new IteratorSetting(50, "iter1", "iterclass1")));

    Map<String,InputTableConfig> configMap = new HashMap<String,InputTableConfig>();
    configMap.put(TEST_TABLE_1, table1);
View Full Code Here

      job.setInputFormat(AccumuloInputFormat.class);

      AccumuloMultiTableInputFormat.setConnectorInfo(job, user, new PasswordToken(pass));
      AccumuloMultiTableInputFormat.setMockInstance(job, INSTANCE_NAME);

      InputTableConfig tableConfig1 = new InputTableConfig();
      InputTableConfig tableConfig2 = new InputTableConfig();

      Map<String,InputTableConfig> configMap = new HashMap<String,InputTableConfig>();
      configMap.put(table1, tableConfig1);
      configMap.put(table2, tableConfig2);
View Full Code Here

TOP

Related Classes of org.apache.accumulo.core.client.mapreduce.InputTableConfig

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.