You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by bi...@apache.org on 2012/03/06 20:18:07 UTC
svn commit: r1297657 - in
/incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core:
client/ client/mapreduce/ iterators/user/ util/shell/commands/
Author: billie
Date: Tue Mar 6 19:18:06 2012
New Revision: 1297657
URL: http://svn.apache.org/viewvc?rev=1297657&view=rev
Log:
ACCUMULO-411 wrote some javadocs
Modified:
incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/client/BatchDeleter.java
incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/client/IteratorSetting.java
incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/client/RowIterator.java
incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/client/ZooKeeperInstance.java
incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/client/mapreduce/InputFormatBase.java
incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/iterators/user/IntersectingIterator.java
incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/util/shell/commands/SelectCommand.java
incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/util/shell/commands/SelectrowCommand.java
Modified: incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/client/BatchDeleter.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/client/BatchDeleter.java?rev=1297657&r1=1297656&r2=1297657&view=diff
==============================================================================
--- incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/client/BatchDeleter.java (original)
+++ incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/client/BatchDeleter.java Tue Mar 6 19:18:06 2012
@@ -26,7 +26,14 @@ import org.apache.accumulo.core.data.Ran
*/
public interface BatchDeleter extends ScannerBase {
-
+ /**
+ * Deletes the ranges specified by {@link #setRanges}.
+ *
+ * @throws MutationsRejectedException
+ * this can be thrown when deletion mutations fail
+ * @throws TableNotFoundException
+ * when the table does not exist
+ */
public void delete() throws MutationsRejectedException, TableNotFoundException;
/**
@@ -37,5 +44,8 @@ public interface BatchDeleter extends Sc
*/
void setRanges(Collection<Range> ranges);
+ /**
+ * Releases any resources.
+ */
void close();
}
Modified: incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/client/IteratorSetting.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/client/IteratorSetting.java?rev=1297657&r1=1297656&r2=1297657&view=diff
==============================================================================
--- incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/client/IteratorSetting.java (original)
+++ incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/client/IteratorSetting.java Tue Mar 6 19:18:06 2012
@@ -48,7 +48,7 @@ public class IteratorSetting {
private Map<String,String> properties;
/**
- * Get layer at which this iterator applies. See {@link #setPriority(int) for how the priority is used.}
+ * Get layer at which this iterator applies. See {@link #setPriority(int)} for how the priority is used.
*
* @return the priority of this Iterator
*/
@@ -138,7 +138,7 @@ public class IteratorSetting {
* Constructs an iterator setting configured for the scan scope with no parameters. (Parameters can be added later.)
*
* @param priority
- * the priority for the iterator @see {@link #setPriority(int)}
+ * the priority for the iterator (see {@link #setPriority(int)})
* @param name
* the distinguishing name for the iterator
* @param iteratorClass
@@ -152,7 +152,7 @@ public class IteratorSetting {
* Constructs an iterator setting configured for the specified scopes with the specified parameters.
*
* @param priority
- * the priority for the iterator @see {@link #setPriority(int)}
+ * the priority for the iterator (see {@link #setPriority(int)})
* @param name
* the distinguishing name for the iterator
* @param iteratorClass
@@ -173,7 +173,7 @@ public class IteratorSetting {
* parameters.
*
* @param priority
- * the priority for the iterator @see {@link #setPriority(int)}
+ * the priority for the iterator (see {@link #setPriority(int)})
* @param iteratorClass
* the class for the iterator
*/
@@ -182,19 +182,18 @@ public class IteratorSetting {
}
/**
-
+ *
* Constructs an iterator setting using the given class's SimpleName for the iterator name and configured for the specified scopes with the specified
* parameters.
*
* @param priority
- * the priority for the iterator @see {@link #setPriority(int)}
+ * the priority for the iterator (see {@link #setPriority(int)})
* @param iteratorClass
* the class for the iterator
* @param properties
* any properties for the iterator
*/
- public IteratorSetting(int priority, Class<? extends SortedKeyValueIterator<Key,Value>> iteratorClass,
- Map<String,String> properties) {
+ public IteratorSetting(int priority, Class<? extends SortedKeyValueIterator<Key,Value>> iteratorClass, Map<String,String> properties) {
this(priority, iteratorClass.getSimpleName(), iteratorClass.getName(), properties);
}
@@ -202,7 +201,7 @@ public class IteratorSetting {
* Constructs an iterator setting configured for the scan scope with no parameters.
*
* @param priority
- * the priority for the iterator @see {@link #setPriority(int)}
+ * the priority for the iterator (see {@link #setPriority(int)})
* @param name
* the distinguishing name for the iterator
* @param iteratorClass
@@ -313,6 +312,6 @@ public class IteratorSetting {
public Text getColumnQualifier() {
return getSecond();
}
-
+
}
}
Modified: incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/client/RowIterator.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/client/RowIterator.java?rev=1297657&r1=1297656&r2=1297657&view=diff
==============================================================================
--- incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/client/RowIterator.java (original)
+++ incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/client/RowIterator.java Tue Mar 6 19:18:06 2012
@@ -26,7 +26,11 @@ import org.apache.accumulo.core.util.Pee
import org.apache.hadoop.io.Text;
/**
- * Group Key/Value pairs into Iterators over rows.
+ * Group Key/Value pairs into Iterators over rows. Suggested usage:
+ *
+ * <pre>
+ * RowIterator rowIterator = new RowIterator(connector.createScanner(tableName, authorizations));
+ * </pre>
*/
public class RowIterator implements Iterator<Iterator<Entry<Key,Value>>> {
Modified: incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/client/ZooKeeperInstance.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/client/ZooKeeperInstance.java?rev=1297657&r1=1297656&r2=1297657&view=diff
==============================================================================
--- incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/client/ZooKeeperInstance.java (original)
+++ incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/client/ZooKeeperInstance.java Tue Mar 6 19:18:06 2012
@@ -232,6 +232,13 @@ public class ZooKeeperInstance implement
this.conf = conf;
}
+ /**
+ * Given a zooCache and instanceId, look up the instance name.
+ *
+ * @param zooCache
+ * @param instanceId
+ * @return the instance name
+ */
public static String lookupInstanceName(ZooCache zooCache, UUID instanceId) {
ArgumentChecker.notNull(zooCache, instanceId);
for (String name : zooCache.getChildren(Constants.ZROOT + Constants.ZINSTANCES)) {
Modified: incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/client/mapreduce/InputFormatBase.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/client/mapreduce/InputFormatBase.java?rev=1297657&r1=1297656&r2=1297657&view=diff
==============================================================================
--- incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/client/mapreduce/InputFormatBase.java (original)
+++ incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/client/mapreduce/InputFormatBase.java Tue Mar 6 19:18:06 2012
@@ -140,12 +140,6 @@ public abstract class InputFormatBase<K,
private static final String ITERATORS_DELIM = ",";
/**
- * Enable or disable use of the {@link IsolatedScanner}. By default it is not enabled.
- *
- * @param job
- * The Hadoop job object
- * @param enable
- * if true, enable usage of the IsolatedScanner. Otherwise, disable.
* @deprecated Use {@link #setIsolated(Configuration,boolean)} instead
*/
public static void setIsolated(JobContext job, boolean enable) {
@@ -153,7 +147,7 @@ public abstract class InputFormatBase<K,
}
/**
- * Enable or disable use of the {@link IsolatedScanner}. By default it is not enabled.
+ * Enable or disable use of the {@link IsolatedScanner} in this configuration object. By default it is not enabled.
*
* @param conf
* The Hadoop configuration object
@@ -165,12 +159,6 @@ public abstract class InputFormatBase<K,
}
/**
- * Enable or disable use of the {@link ClientSideIteratorScanner}. By default it is not enabled.
- *
- * @param job
- * The Hadoop job object
- * @param enable
- * if true, enable usage of the ClientSideInteratorScanner. Otherwise, disable.
* @deprecated Use {@link #setLocalIterators(Configuration,boolean)} instead
*/
public static void setLocalIterators(JobContext job, boolean enable) {
@@ -178,7 +166,7 @@ public abstract class InputFormatBase<K,
}
/**
- * Enable or disable use of the {@link ClientSideIteratorScanner}. By default it is not enabled.
+ * Enable or disable use of the {@link ClientSideIteratorScanner} in this Configuration object. By default it is not enabled.
*
* @param conf
* The Hadoop configuration object
@@ -196,6 +184,20 @@ public abstract class InputFormatBase<K,
setInputInfo(job.getConfiguration(), user, passwd, table, auths);
}
+ /**
+ * Initialize the user, table, and authorization information for the configuration object that will be used with an Accumulo InputFormat.
+ *
+ * @param conf
+ * the Hadoop configuration object
+ * @param user
+ * a valid accumulo user
+ * @param passwd
+ * the user's password
+ * @param table
+ * the table to read
+ * @param auths
+ * the authorizations used to restrict data read
+ */
public static void setInputInfo(Configuration conf, String user, byte[] passwd, String table, Authorizations auths) {
if (conf.getBoolean(INPUT_INFO_HAS_BEEN_SET, false))
throw new IllegalStateException("Input info can only be set once per job");
@@ -216,6 +218,16 @@ public abstract class InputFormatBase<K,
setZooKeeperInstance(job.getConfiguration(), instanceName, zooKeepers);
}
+ /**
+ * Configure a {@link ZooKeeperInstance} for this configuration object.
+ *
+ * @param conf
+ * the Hadoop configuration object
+ * @param instanceName
+ * the accumulo instance name
+ * @param zooKeepers
+ * a comma-separated list of zookeeper servers
+ */
public static void setZooKeeperInstance(Configuration conf, String instanceName, String zooKeepers) {
if (conf.getBoolean(INSTANCE_HAS_BEEN_SET, false))
throw new IllegalStateException("Instance info can only be set once per job");
@@ -233,6 +245,14 @@ public abstract class InputFormatBase<K,
setMockInstance(job.getConfiguration(), instanceName);
}
+ /**
+ * Configure a {@link MockInstance} for this configuration object.
+ *
+ * @param conf
+ * the Hadoop configuration object
+ * @param instanceName
+ * the accumulo instance name
+ */
public static void setMockInstance(Configuration conf, String instanceName) {
conf.setBoolean(INSTANCE_HAS_BEEN_SET, true);
conf.setBoolean(MOCK, true);
@@ -246,6 +266,14 @@ public abstract class InputFormatBase<K,
setRanges(job.getConfiguration(), ranges);
}
+ /**
+ * Set the ranges to map over for this configuration object.
+ *
+ * @param conf
+ * the Hadoop configuration object
+ * @param ranges
+ * the ranges that will be mapped over
+ */
public static void setRanges(Configuration conf, Collection<Range> ranges) {
ArgumentChecker.notNull(ranges);
ArrayList<String> rangeStrings = new ArrayList<String>(ranges.size());
@@ -268,16 +296,26 @@ public abstract class InputFormatBase<K,
disableAutoAdjustRanges(job.getConfiguration());
}
+ /**
+ * Disables the adjustment of ranges for this configuration object. By default, overlapping ranges will be merged and ranges will be fit to existing tablet
+ * boundaries. Disabling this adjustment will cause there to be exactly one mapper per range set using {@link #setRanges(Configuration, Collection)}.
+ *
+ * @param conf
+ * the Hadoop configuration object
+ */
public static void disableAutoAdjustRanges(Configuration conf) {
conf.setBoolean(AUTO_ADJUST_RANGES, false);
}
+ /**
+ * @deprecated since 1.4 use {@link org.apache.accumulo.core.iterators.user.RegExFilter} and {@link #addIterator(Configuration, IteratorSetting)}
+ */
public static enum RegexType {
ROW, COLUMN_FAMILY, COLUMN_QUALIFIER, VALUE
}
/**
- * @deprecated since 1.4 {@link #addIterator(Configuration, IteratorSetting)}
+ * @deprecated since 1.4 use {@link #addIterator(Configuration, IteratorSetting)}
* @see org.apache.accumulo.core.iterators.user.RegExFilter#setRegexs(IteratorSetting, String, String, String, String, boolean)
* @param job
* @param type
@@ -311,14 +349,6 @@ public abstract class InputFormatBase<K,
}
/**
- * Sets the max # of values that may be returned for an individual Accumulo cell. By default, applied before all other Accumulo iterators (highest priority)
- * leveraged in the scan by the record reader. To adjust priority use setIterator() & setIteratorOptions() w/ the VersioningIterator type explicitly.
- *
- * @param job
- * the job
- * @param maxVersions
- * the max versions
- * @throws IOException
* @deprecated Use {@link #setMaxVersions(Configuration,int)} instead
*/
public static void setMaxVersions(JobContext job, int maxVersions) throws IOException {
@@ -330,10 +360,11 @@ public abstract class InputFormatBase<K,
* leveraged in the scan by the record reader. To adjust priority use setIterator() & setIteratorOptions() w/ the VersioningIterator type explicitly.
*
* @param conf
- * the job
+ * the Hadoop configuration object
* @param maxVersions
- * the max versions
+ * the max number of versions per accumulo cell
* @throws IOException
+ * if maxVersions is < 1
*/
public static void setMaxVersions(Configuration conf, int maxVersions) throws IOException {
if (maxVersions < 1)
@@ -342,10 +373,6 @@ public abstract class InputFormatBase<K,
}
/**
- *
- * @param columnFamilyColumnQualifierPairs
- * A pair of {@link Text} objects corresponding to column family and column qualifier. If the column qualifier is null, the entire column family is
- * selected. An empty set is the default and is equivalent to scanning the all columns.
* @deprecated Use {@link #fetchColumns(Configuration,Collection)} instead
*/
public static void fetchColumns(JobContext job, Collection<Pair<Text,Text>> columnFamilyColumnQualifierPairs) {
@@ -353,7 +380,10 @@ public abstract class InputFormatBase<K,
}
/**
+ * Restricts the columns that will be mapped over for this configuration object.
*
+ * @param conf
+ * the Hadoop configuration object
* @param columnFamilyColumnQualifierPairs
* A pair of {@link Text} objects corresponding to column family and column qualifier. If the column qualifier is null, the entire column family is
* selected. An empty set is the default and is equivalent to scanning the all columns.
@@ -380,6 +410,14 @@ public abstract class InputFormatBase<K,
setLogLevel(job.getConfiguration(), level);
}
+ /**
+ * Sets the log level for this configuration object.
+ *
+ * @param conf
+ * the Hadoop configuration object
+ * @param level
+ * the logging level
+ */
public static void setLogLevel(Configuration conf, Level level) {
ArgumentChecker.notNull(level);
log.setLevel(level);
@@ -387,12 +425,6 @@ public abstract class InputFormatBase<K,
}
/**
- * Encode an iterator on the input.
- *
- * @param job
- * The job in which to save the iterator configuration
- * @param cfg
- * The configuration of the iterator
* @deprecated Use {@link #addIterator(Configuration,IteratorSetting)} instead
*/
public static void addIterator(JobContext job, IteratorSetting cfg) {
@@ -400,10 +432,10 @@ public abstract class InputFormatBase<K,
}
/**
- * Encode an iterator on the input.
+ * Encode an iterator on the input for this configuration object.
*
* @param conf
- * The job in which to save the iterator configuration
+ * The Hadoop configuration in which to save the iterator configuration
* @param cfg
* The configuration of the iterator
*/
@@ -440,7 +472,7 @@ public abstract class InputFormatBase<K,
}
/**
- * Specify an Accumulo iterator type to manage the behavior of the underlying table scan this InputFormat's Record Reader will conduct, w/ priority dictating
+ * Specify an Accumulo iterator type to manage the behavior of the underlying table scan this InputFormat's RecordReader will conduct, w/ priority dictating
* the order in which specified iterators are applied. Repeat calls to specify multiple iterators are allowed.
*
* @param job
@@ -509,6 +541,14 @@ public abstract class InputFormatBase<K,
return isIsolated(job.getConfiguration());
}
+ /**
+ * Determines whether a configuration has isolation enabled.
+ *
+ * @param conf
+ * the Hadoop configuration object
+ * @return true if isolation is enabled, false otherwise
+ * @see #setIsolated(Configuration, boolean)
+ */
protected static boolean isIsolated(Configuration conf) {
return conf.getBoolean(ISOLATED, false);
}
@@ -520,6 +560,14 @@ public abstract class InputFormatBase<K,
return usesLocalIterators(job.getConfiguration());
}
+ /**
+ * Determines whether a configuration uses local iterators.
+ *
+ * @param conf
+ * the Hadoop configuration object
+ * @return true if uses local iterators, false otherwise
+ * @see #setLocalIterators(Configuration, boolean)
+ */
protected static boolean usesLocalIterators(Configuration conf) {
return conf.getBoolean(LOCAL_ITERATORS, false);
}
@@ -531,6 +579,14 @@ public abstract class InputFormatBase<K,
return getUsername(job.getConfiguration());
}
+ /**
+ * Gets the user name from the configuration.
+ *
+ * @param conf
+ * the Hadoop configuration object
+ * @return the user name
+ * @see #setInputInfo(Configuration, String, byte[], String, Authorizations)
+ */
protected static String getUsername(Configuration conf) {
return conf.get(USERNAME);
}
@@ -546,8 +602,13 @@ public abstract class InputFormatBase<K,
}
/**
- * WARNING: The password is stored in the Configuration and shared with all MapReduce tasks; It is BASE64 encoded to provide a charset safe conversion to a
- * string, and is not intended to be secure.
+ * Gets the password from the configuration. WARNING: The password is stored in the Configuration and shared with all MapReduce tasks; It is BASE64 encoded to
+ * provide a charset safe conversion to a string, and is not intended to be secure.
+ *
+ * @param conf
+ * the Hadoop configuration object
+ * @return the BASE64-encoded password
+ * @see #setInputInfo(Configuration, String, byte[], String, Authorizations)
*/
protected static byte[] getPassword(Configuration conf) {
return Base64.decodeBase64(conf.get(PASSWORD, "").getBytes());
@@ -560,6 +621,14 @@ public abstract class InputFormatBase<K,
return getTablename(job.getConfiguration());
}
+ /**
+ * Gets the table name from the configuration.
+ *
+ * @param conf
+ * the Hadoop configuration object
+ * @return the table name
+ * @see #setInputInfo(Configuration, String, byte[], String, Authorizations)
+ */
protected static String getTablename(Configuration conf) {
return conf.get(TABLE_NAME);
}
@@ -571,6 +640,14 @@ public abstract class InputFormatBase<K,
return getAuthorizations(job.getConfiguration());
}
+ /**
+ * Gets the authorizations to set for the scans from the configuration.
+ *
+ * @param conf
+ * the Hadoop configuration object
+ * @return the accumulo scan authorizations
+ * @see #setInputInfo(Configuration, String, byte[], String, Authorizations)
+ */
protected static Authorizations getAuthorizations(Configuration conf) {
String authString = conf.get(AUTHORIZATIONS);
return authString == null ? Constants.NO_AUTHS : new Authorizations(authString.split(","));
@@ -583,6 +660,15 @@ public abstract class InputFormatBase<K,
return getInstance(job.getConfiguration());
}
+ /**
+ * Initializes an Accumulo {@link Instance} based on the configuration.
+ *
+ * @param conf
+ * the Hadoop configuration object
+ * @return an accumulo instance
+ * @see #setZooKeeperInstance(Configuration, String, String)
+ * @see #setMockInstance(Configuration, String)
+ */
protected static Instance getInstance(Configuration conf) {
if (conf.getBoolean(MOCK, false))
return new MockInstance(conf.get(INSTANCE_NAME));
@@ -596,6 +682,15 @@ public abstract class InputFormatBase<K,
return getTabletLocator(job.getConfiguration());
}
+ /**
+ * Initializes an Accumulo {@link TabletLocator} based on the configuration.
+ *
+ * @param conf
+ * the Hadoop configuration object
+ * @return an accumulo tablet locator
+ * @throws TableNotFoundException
+ * if the table name set on the configuration doesn't exist
+ */
protected static TabletLocator getTabletLocator(Configuration conf) throws TableNotFoundException {
if (conf.getBoolean(MOCK, false))
return new MockTabletLocator();
@@ -614,6 +709,16 @@ public abstract class InputFormatBase<K,
return getRanges(job.getConfiguration());
}
+ /**
+ * Gets the ranges to scan over from a configuration object.
+ *
+ * @param conf
+ * the Hadoop configuration object
+ * @return the ranges
+ * @throws IOException
+ * if the ranges have been encoded improperly
+ * @see #setRanges(Configuration, Collection)
+ */
protected static List<Range> getRanges(Configuration conf) throws IOException {
ArrayList<Range> ranges = new ArrayList<Range>();
for (String rangeString : conf.getStringCollection(RANGES)) {
@@ -626,13 +731,10 @@ public abstract class InputFormatBase<K,
}
/**
- * @deprecated Use {@link #getRegex(Configuration,RegexType)} instead
+ * @deprecated since 1.4 use {@link org.apache.accumulo.core.iterators.user.RegExFilter} and {@link #addIterator(Configuration, IteratorSetting)}
+ * @see #setRegex(JobContext, RegexType, String)
*/
protected static String getRegex(JobContext job, RegexType type) {
- return getRegex(job.getConfiguration(), type);
- }
-
- protected static String getRegex(Configuration conf, RegexType type) {
String key = null;
switch (type) {
case ROW:
@@ -651,7 +753,7 @@ public abstract class InputFormatBase<K,
throw new NoSuchElementException();
}
try {
- String s = conf.get(key);
+ String s = job.getConfiguration().get(key);
if (s == null)
return null;
return URLDecoder.decode(s, "UTF-8");
@@ -668,6 +770,14 @@ public abstract class InputFormatBase<K,
return getFetchedColumns(job.getConfiguration());
}
+ /**
+ * Gets the columns to be mapped over from this configuration object.
+ *
+ * @param conf
+ * the Hadoop configuration object
+ * @return a set of columns
+ * @see #fetchColumns(Configuration, Collection)
+ */
protected static Set<Pair<Text,Text>> getFetchedColumns(Configuration conf) {
Set<Pair<Text,Text>> columns = new HashSet<Pair<Text,Text>>();
for (String col : conf.getStringCollection(COLUMNS)) {
@@ -686,6 +796,14 @@ public abstract class InputFormatBase<K,
return getAutoAdjustRanges(job.getConfiguration());
}
+ /**
+ * Determines whether a configuration has auto-adjust ranges enabled.
+ *
+ * @param conf
+ * the Hadoop configuration object
+ * @return true if auto-adjust is enabled, false otherwise
+ * @see #disableAutoAdjustRanges(Configuration)
+ */
protected static boolean getAutoAdjustRanges(Configuration conf) {
return conf.getBoolean(AUTO_ADJUST_RANGES, true);
}
@@ -697,6 +815,14 @@ public abstract class InputFormatBase<K,
return getLogLevel(job.getConfiguration());
}
+ /**
+ * Gets the log level from this configuration.
+ *
+ * @param conf
+ * the Hadoop configuration object
+ * @return the log level
+ * @see #setLogLevel(Configuration, Level)
+ */
protected static Level getLogLevel(Configuration conf) {
return Level.toLevel(conf.getInt(LOGLEVEL, Level.INFO.toInt()));
}
@@ -712,6 +838,14 @@ public abstract class InputFormatBase<K,
// InputFormat doesn't have the equivalent of OutputFormat's
// checkOutputSpecs(JobContext job)
+ /**
+ * Check whether a configuration is fully configured to be used with an Accumulo {@link org.apache.hadoop.mapreduce.InputFormat}.
+ *
+ * @param conf
+ * the Hadoop configuration object
+ * @throws IOException
+ * if the configuration is improperly configured
+ */
protected static void validateOptions(Configuration conf) throws IOException {
if (!conf.getBoolean(INPUT_INFO_HAS_BEEN_SET, false))
throw new IOException("Input info has not been set.");
@@ -740,7 +874,6 @@ public abstract class InputFormatBase<K,
}
}
- // Get the maxVersions the VersionsIterator should be configured with. Return -1 if none.
/**
* @deprecated Use {@link #getMaxVersions(Configuration)} instead
*/
@@ -748,12 +881,18 @@ public abstract class InputFormatBase<K,
return getMaxVersions(job.getConfiguration());
}
- // Get the maxVersions the VersionsIterator should be configured with. Return -1 if none.
+ /**
+ * Gets the maxVersions to use for the {@link VersioningIterator} from this configuration.
+ *
+ * @param conf
+ * the Hadoop configuration object
+ * @return the max versions, -1 if not configured
+ * @see #setMaxVersions(Configuration, int)
+ */
protected static int getMaxVersions(Configuration conf) {
return conf.getInt(MAX_VERSIONS, -1);
}
- // Return a list of the iterator settings (for iterators to apply to a scanner)
/**
* @deprecated Use {@link #getIterators(Configuration)} instead
*/
@@ -761,7 +900,14 @@ public abstract class InputFormatBase<K,
return getIterators(job.getConfiguration());
}
- // Return a list of the iterator settings (for iterators to apply to a scanner)
+ /**
+ * Gets a list of the iterator settings (for iterators to apply to a scanner) from this configuration.
+ *
+ * @param conf
+ * the Hadoop configuration object
+ * @return a list of iterators
+ * @see #addIterator(Configuration, IteratorSetting)
+ */
protected static List<AccumuloIterator> getIterators(Configuration conf) {
String iterators = conf.get(ITERATORS);
@@ -780,7 +926,6 @@ public abstract class InputFormatBase<K,
return list;
}
- // Return a list of the iterator options specified
/**
* @deprecated Use {@link #getIteratorOptions(Configuration)} instead
*/
@@ -788,7 +933,14 @@ public abstract class InputFormatBase<K,
return getIteratorOptions(job.getConfiguration());
}
- // Return a list of the iterator options specified
+ /**
+ * Gets a list of the iterator options specified on this configuration.
+ *
+ * @param conf
+ * the Hadoop configuration object
+ * @return a list of iterator options
+ * @see #addIterator(Configuration, IteratorSetting)
+ */
protected static List<AccumuloIteratorOption> getIteratorOptions(Configuration conf) {
String iteratorOptions = conf.get(ITERATORS_OPTIONS);
@@ -812,7 +964,9 @@ public abstract class InputFormatBase<K,
private boolean scannerRegexEnabled = false;
protected RangeInputSplit split;
- @SuppressWarnings("deprecation")
+ /**
+ * @deprecated since 1.4, configure {@link org.apache.accumulo.core.iterators.user.RegExFilter} instead.
+ */
private void checkAndEnableRegex(String regex, Scanner scanner, String methodName) throws IllegalArgumentException, SecurityException,
IllegalAccessException, InvocationTargetException, NoSuchMethodException, IOException {
if (regex != null) {
@@ -826,18 +980,14 @@ public abstract class InputFormatBase<K,
}
/**
- * @deprecated Use {@link #setupRegex(Configuration,Scanner)} instead
+ * @deprecated since 1.4, configure {@link org.apache.accumulo.core.iterators.user.RegExFilter} instead.
*/
protected boolean setupRegex(TaskAttemptContext attempt, Scanner scanner) throws AccumuloException {
- return setupRegex(attempt.getConfiguration(), scanner);
- }
-
- protected boolean setupRegex(Configuration conf, Scanner scanner) throws AccumuloException {
try {
- checkAndEnableRegex(getRegex(conf, RegexType.ROW), scanner, "setRowRegex");
- checkAndEnableRegex(getRegex(conf, RegexType.COLUMN_FAMILY), scanner, "setColumnFamilyRegex");
- checkAndEnableRegex(getRegex(conf, RegexType.COLUMN_QUALIFIER), scanner, "setColumnQualifierRegex");
- checkAndEnableRegex(getRegex(conf, RegexType.VALUE), scanner, "setValueRegex");
+ checkAndEnableRegex(getRegex(attempt, RegexType.ROW), scanner, "setRowRegex");
+ checkAndEnableRegex(getRegex(attempt, RegexType.COLUMN_FAMILY), scanner, "setColumnFamilyRegex");
+ checkAndEnableRegex(getRegex(attempt, RegexType.COLUMN_QUALIFIER), scanner, "setColumnQualifierRegex");
+ checkAndEnableRegex(getRegex(attempt, RegexType.VALUE), scanner, "setValueRegex");
return true;
} catch (Exception e) {
throw new AccumuloException("Can't set up regex for scanner");
@@ -852,7 +1002,15 @@ public abstract class InputFormatBase<K,
setupIterators(attempt.getConfiguration(), scanner);
}
- // Apply the configured iterators from the job to the scanner
+ /**
+ * Apply the configured iterators from the configuration to the scanner.
+ *
+ * @param conf
+ * the Hadoop configuration object
+ * @param scanner
+ * the scanner to configure
+ * @throws AccumuloException
+ */
protected void setupIterators(Configuration conf, Scanner scanner) throws AccumuloException {
List<AccumuloIterator> iterators = getIterators(conf);
List<AccumuloIteratorOption> options = getIteratorOptions(conf);
@@ -869,7 +1027,6 @@ public abstract class InputFormatBase<K,
}
}
- // Apply the VersioningIterator at priority 0 based on the job config
/**
* @deprecated Use {@link #setupMaxVersions(Configuration,Scanner)} instead
*/
@@ -877,7 +1034,14 @@ public abstract class InputFormatBase<K,
setupMaxVersions(attempt.getConfiguration(), scanner);
}
- // Apply the VersioningIterator at priority 0 based on the job config
+ /**
+ * If maxVersions has been set, configure a {@link VersioningIterator} at priority 0 for this scanner.
+ *
+ * @param conf
+ * the Hadoop configuration object
+ * @param scanner
+ * the scanner to configure
+ */
protected void setupMaxVersions(Configuration conf, Scanner scanner) {
int maxVersions = getMaxVersions(conf);
// Check to make sure its a legit value
@@ -888,6 +1052,9 @@ public abstract class InputFormatBase<K,
}
}
+ /**
+ * Initialize a scanner over the given input split using this task attempt configuration.
+ */
public void initialize(InputSplit inSplit, TaskAttemptContext attempt) throws IOException {
Scanner scanner;
split = (RangeInputSplit) inSplit;
@@ -912,7 +1079,7 @@ public abstract class InputFormatBase<K,
scanner = new ClientSideIteratorScanner(scanner);
}
setupMaxVersions(attempt.getConfiguration(), scanner);
- setupRegex(attempt.getConfiguration(), scanner);
+ setupRegex(attempt, scanner);
setupIterators(attempt.getConfiguration(), scanner);
} catch (Exception e) {
throw new IOException(e);
@@ -962,7 +1129,7 @@ public abstract class InputFormatBase<K,
}
/**
- * read the metadata table to get tablets of interest these each become a split
+ * Read the metadata table to get tablets and match up ranges to them.
*/
public List<InputSplit> getSplits(JobContext job) throws IOException {
log.setLevel(getLogLevel(job.getConfiguration()));
Modified: incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/iterators/user/IntersectingIterator.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/iterators/user/IntersectingIterator.java?rev=1297657&r1=1297656&r2=1297657&view=diff
==============================================================================
--- incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/iterators/user/IntersectingIterator.java (original)
+++ incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/iterators/user/IntersectingIterator.java Tue Mar 6 19:18:06 2012
@@ -382,11 +382,10 @@ public class IntersectingIterator implem
private static final String notFlagOptionName = "notFlag";
/**
- * to be made protected
- *
* @param columns
* @return encoded columns
- * @deprecated since 1.4 {@link #setColumnFamilies(IteratorSetting, Text[] columns)}
+ * @deprecated since 1.4. To be made protected. Do not interact with flags string directly, just use
+ * {@link #setColumnFamilies(IteratorSetting, Text[], boolean[])}.
*/
public static String encodeColumns(Text[] columns) {
StringBuilder sb = new StringBuilder();
@@ -398,11 +397,10 @@ public class IntersectingIterator implem
}
/**
- * to be made protected
- *
* @param flags
* @return encoded flags
- * @deprecated since 1.4 {@link #setColumnFamilies(IteratorSetting, Text[] columns, boolean[] flags)}
+ * @deprecated since 1.4. To be made protected. Do not interact with flags string directly, just use
+ * {@link #setColumnFamilies(IteratorSetting, Text[], boolean[])}.
*/
public static String encodeBooleans(boolean[] flags) {
byte[] bytes = new byte[flags.length];
@@ -429,7 +427,8 @@ public class IntersectingIterator implem
*
* @param flags
* @return decoded flags
- * @deprecated since 1.4
+ * @deprecated since 1.4. To be made protected. Do not interact with flags string directly, just use
+ * {@link #setColumnFamilies(IteratorSetting, Text[], boolean[])}.
*/
public static boolean[] decodeBooleans(String flags) {
// return null of there were no flags
Modified: incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/util/shell/commands/SelectCommand.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/util/shell/commands/SelectCommand.java?rev=1297657&r1=1297656&r2=1297657&view=diff
==============================================================================
--- incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/util/shell/commands/SelectCommand.java (original)
+++ incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/util/shell/commands/SelectCommand.java Tue Mar 6 19:18:06 2012
@@ -34,8 +34,9 @@ import org.apache.commons.cli.Option;
import org.apache.commons.cli.Options;
import org.apache.hadoop.io.Text;
-@Deprecated
-// deprecated since 1.4
+/**
+ * @deprecated since 1.4, use {@code scan -r <row> -c <columnfamily>[:<columnqualifier>]} instead.
+ */
public class SelectCommand extends Command {
private Option selectOptAuths, timestampOpt, disablePaginationOpt, tableOpt;
@@ -44,8 +45,8 @@ public class SelectCommand extends Comma
IOException {
String tableName;
- shellState.log.warn("select is deprecated, use 'scan -r <row> -c <columnfamily>[:<columnqualifier>]'");
-
+ Shell.log.warn("select is deprecated, use scan -r <row> -c <columnfamily>[:<columnqualifier>]'");
+
if (cl.hasOption(tableOpt.getOpt())) {
tableName = cl.getOptionValue(tableOpt.getOpt());
if (!shellState.getConnector().tableOperations().exists(tableName))
@@ -102,4 +103,4 @@ public class SelectCommand extends Comma
public int numArgs() {
return 3;
}
-}
\ No newline at end of file
+}
Modified: incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/util/shell/commands/SelectrowCommand.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/util/shell/commands/SelectrowCommand.java?rev=1297657&r1=1297656&r2=1297657&view=diff
==============================================================================
--- incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/util/shell/commands/SelectrowCommand.java (original)
+++ incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/util/shell/commands/SelectrowCommand.java Tue Mar 6 19:18:06 2012
@@ -32,8 +32,9 @@ import org.apache.commons.cli.Option;
import org.apache.commons.cli.Options;
import org.apache.hadoop.io.Text;
-@Deprecated
-// deprecated since 1.4
+/**
+ * @deprecated since 1.4, use {@code scan -r <row>} instead.
+ */
public class SelectrowCommand extends Command {
private Option selectrowOptAuths, timestampOpt, disablePaginationOpt, tableOpt;
@@ -43,8 +44,8 @@ public class SelectrowCommand extends Co
String tableName;
- shellState.log.warn("selectrow is deprecated, use 'scan -r <row>'");
-
+ Shell.log.warn("selectrow is deprecated, use 'scan -r <row>'");
+
if (cl.hasOption(tableOpt.getOpt())) {
tableName = cl.getOptionValue(tableOpt.getOpt());
if (!shellState.getConnector().tableOperations().exists(tableName))
@@ -103,4 +104,4 @@ public class SelectrowCommand extends Co
public int numArgs() {
return 1;
}
-}
\ No newline at end of file
+}