/** Put a SummingIterator on all columns. */ public static void assignDegreeAccumulator(String tableName, Connector c) { IteratorSetting cfg = null; try { cfg = c.tableOperations().getIteratorSetting(tableName, ITER_SUMALL_NAME, IteratorUtil.IteratorScope.scan); } catch (AccumuloSecurityException | AccumuloException ignored) { } catch (TableNotFoundException e) { log.warn(tableName + " does not exist", e); } if (cfg != null) { log.info("table "+tableName+": iterator "+ITER_SUMALL_NAME+" already exists with priority "+cfg.getPriority()+" and options: "+cfg.getOptions()); } else { cfg = new IteratorSetting(2, ITER_SUMALL_NAME, SummingCombiner.class); //Combiner.setColumns(cfg, columnList); Combiner.setCombineAllColumns(cfg, true); LongCombiner.setEncodingType(cfg, LongCombiner.Type.STRING); try { //c.tableOperations().checkIteratorConflicts(tableName, cfg, EnumSet.allOf(IteratorUtil.IteratorScope.class)); c.tableOperations().attachIterator(tableName, cfg); } catch (AccumuloSecurityException | AccumuloException e) { log.warn("error trying to add "+ITER_SUMALL_NAME+" iterator to " + tableName, e); } catch (TableNotFoundException e) { log.warn(tableName + " does not exist", e); } } }
LongCombiner.setEncodingType(itSet, LongCombiner.Type.STRING);
LongCombiner.setEncodingType(summer, LongCombiner.Type.STRING); LongCombiner.setCombineAllColumns(summer, true); c.tableOperations().attachIterator(t2, summer);