YARN-6658. Remove columnFor() methods of Columns in HBaseTimeline backend (Haibo Chen via Varun Saxena)

(cherry picked from commit f7cba98504a5e968bb6ae976d20b71c84a4664f2)

Conflicts:
	hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice-hbase/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/apptoflow/AppToFlowColumn.java
This commit is contained in:
Varun Saxena 2017-05-31 10:14:35 +05:30
parent d53038626e
commit 473f2f00ee
7 changed files with 0 additions and 357 deletions

View File

@ -105,52 +105,4 @@ public enum ApplicationColumn implements Column<ApplicationTable> {
return column.getValueConverter(); return column.getValueConverter();
} }
/**
* Retrieve an {@link ApplicationColumn} given a name, or null if there is no
* match. The following holds true: {@code columnFor(x) == columnFor(y)} if
* and only if {@code x.equals(y)} or {@code (x == y == null)}.
*
* @param columnQualifier Name of the column to retrieve
* @return the corresponding {@link ApplicationColumn} or null
*/
public static final ApplicationColumn columnFor(String columnQualifier) {
// Match column based on value, assume column family matches.
for (ApplicationColumn ac : ApplicationColumn.values()) {
// Find a match based only on name.
if (ac.getColumnQualifier().equals(columnQualifier)) {
return ac;
}
}
// Default to null
return null;
}
/**
* Retrieve an {@link ApplicationColumn} given a name, or null if there is no
* match. The following holds true: {@code columnFor(a,x) == columnFor(b,y)}
* if and only if {@code a.equals(b) & x.equals(y)} or
* {@code (x == y == null)}
*
* @param columnFamily The columnFamily for which to retrieve the column.
* @param name Name of the column to retrieve
* @return the corresponding {@link ApplicationColumn} or null if both
* arguments don't match.
*/
public static final ApplicationColumn columnFor(
ApplicationColumnFamily columnFamily, String name) {
for (ApplicationColumn ac : ApplicationColumn.values()) {
// Find a match based column family and on name.
if (ac.columnFamily.equals(columnFamily)
&& ac.getColumnQualifier().equals(name)) {
return ac;
}
}
// Default to null
return null;
}
} }

View File

@ -233,56 +233,4 @@ public enum ApplicationColumnPrefix implements ColumnPrefix<ApplicationTable> {
keyConverter); keyConverter);
} }
/**
* Retrieve an {@link ApplicationColumnPrefix} given a name, or null if there
* is no match. The following holds true: {@code columnFor(x) == columnFor(y)}
* if and only if {@code x.equals(y)} or {@code (x == y == null)}
*
* @param columnPrefix Name of the column to retrieve
* @return the corresponding {@link ApplicationColumnPrefix} or null
*/
public static final ApplicationColumnPrefix columnFor(String columnPrefix) {
// Match column based on value, assume column family matches.
for (ApplicationColumnPrefix acp : ApplicationColumnPrefix.values()) {
// Find a match based only on name.
if (acp.getColumnPrefix().equals(columnPrefix)) {
return acp;
}
}
// Default to null
return null;
}
/**
* Retrieve an {@link ApplicationColumnPrefix} given a name, or null if there
* is no match. The following holds true:
* {@code columnFor(a,x) == columnFor(b,y)} if and only if
* {@code (x == y == null)} or {@code a.equals(b) & x.equals(y)}
*
* @param columnFamily The columnFamily for which to retrieve the column.
* @param columnPrefix Name of the column to retrieve
* @return the corresponding {@link ApplicationColumnPrefix} or null if both
* arguments don't match.
*/
public static final ApplicationColumnPrefix columnFor(
ApplicationColumnFamily columnFamily, String columnPrefix) {
// TODO: needs unit test to confirm and need to update javadoc to explain
// null prefix case.
for (ApplicationColumnPrefix acp : ApplicationColumnPrefix.values()) {
// Find a match based column family and on name.
if (acp.columnFamily.equals(columnFamily)
&& (((columnPrefix == null) && (acp.getColumnPrefix() == null)) ||
(acp.getColumnPrefix().equals(columnPrefix)))) {
return acp;
}
}
// Default to null
return null;
}
} }

View File

@ -94,28 +94,6 @@ public enum EntityColumn implements Column<EntityTable> {
return column.readResult(result, columnQualifierBytes); return column.readResult(result, columnQualifierBytes);
} }
/**
* Retrieve an {@link EntityColumn} given a name, or null if there is no
* match. The following holds true: {@code columnFor(x) == columnFor(y)} if
* and only if {@code x.equals(y)} or {@code (x == y == null)}
*
* @param columnQualifier Name of the column to retrieve
* @return the corresponding {@link EntityColumn} or null
*/
public static final EntityColumn columnFor(String columnQualifier) {
// Match column based on value, assume column family matches.
for (EntityColumn ec : EntityColumn.values()) {
// Find a match based only on name.
if (ec.getColumnQualifier().equals(columnQualifier)) {
return ec;
}
}
// Default to null
return null;
}
@Override @Override
public byte[] getColumnQualifierBytes() { public byte[] getColumnQualifierBytes() {
return columnQualifierBytes.clone(); return columnQualifierBytes.clone();
@ -131,30 +109,4 @@ public enum EntityColumn implements Column<EntityTable> {
return column.getValueConverter(); return column.getValueConverter();
} }
/**
* Retrieve an {@link EntityColumn} given a name, or null if there is no
* match. The following holds true: {@code columnFor(a,x) == columnFor(b,y)}
* if and only if {@code a.equals(b) & x.equals(y)} or
* {@code (x == y == null)}
*
* @param columnFamily The columnFamily for which to retrieve the column.
* @param name Name of the column to retrieve
* @return the corresponding {@link EntityColumn} or null if both arguments
* don't match.
*/
public static final EntityColumn columnFor(EntityColumnFamily columnFamily,
String name) {
for (EntityColumn ec : EntityColumn.values()) {
// Find a match based column family and on name.
if (ec.columnFamily.equals(columnFamily)
&& ec.getColumnQualifier().equals(name)) {
return ec;
}
}
// Default to null
return null;
}
} }

View File

@ -246,55 +246,4 @@ public enum EntityColumnPrefix implements ColumnPrefix<EntityTable> {
keyConverter); keyConverter);
} }
/**
* Retrieve an {@link EntityColumnPrefix} given a name, or null if there is no
* match. The following holds true: {@code columnFor(x) == columnFor(y)} if
* and only if {@code x.equals(y)} or {@code (x == y == null)}
*
* @param columnPrefix Name of the column to retrieve
* @return the corresponding {@link EntityColumnPrefix} or null
*/
public static final EntityColumnPrefix columnFor(String columnPrefix) {
// Match column based on value, assume column family matches.
for (EntityColumnPrefix ecp : EntityColumnPrefix.values()) {
// Find a match based only on name.
if (ecp.getColumnPrefix().equals(columnPrefix)) {
return ecp;
}
}
// Default to null
return null;
}
/**
* Retrieve an {@link EntityColumnPrefix} given a name, or null if there is no
* match. The following holds true: {@code columnFor(a,x) == columnFor(b,y)}
* if and only if {@code (x == y == null)} or
* {@code a.equals(b) & x.equals(y)}
*
* @param columnFamily The columnFamily for which to retrieve the column.
* @param columnPrefix Name of the column to retrieve
* @return the corresponding {@link EntityColumnPrefix} or null if both
* arguments don't match.
*/
public static final EntityColumnPrefix columnFor(
EntityColumnFamily columnFamily, String columnPrefix) {
// TODO: needs unit test to confirm and need to update javadoc to explain
// null prefix case.
for (EntityColumnPrefix ecp : EntityColumnPrefix.values()) {
// Find a match based column family and on name.
if (ecp.columnFamily.equals(columnFamily)
&& (((columnPrefix == null) && (ecp.getColumnPrefix() == null)) ||
(ecp.getColumnPrefix().equals(columnPrefix)))) {
return ecp;
}
}
// Default to null
return null;
}
} }

View File

@ -191,62 +191,6 @@ public enum FlowActivityColumnPrefix
keyConverter); keyConverter);
} }
/**
* Retrieve an {@link FlowActivityColumnPrefix} given a name, or null if there
* is no match. The following holds true: {@code columnFor(x) == columnFor(y)}
* if and only if {@code x.equals(y)} or {@code (x == y == null)}
*
* @param columnPrefix
* Name of the column to retrieve
* @return the corresponding {@link FlowActivityColumnPrefix} or null
*/
public static final FlowActivityColumnPrefix columnFor(String columnPrefix) {
// Match column based on value, assume column family matches.
for (FlowActivityColumnPrefix flowActivityColPrefix :
FlowActivityColumnPrefix.values()) {
// Find a match based only on name.
if (flowActivityColPrefix.getColumnPrefix().equals(columnPrefix)) {
return flowActivityColPrefix;
}
}
// Default to null
return null;
}
/**
* Retrieve an {@link FlowActivityColumnPrefix} given a name, or null if there
* is no match. The following holds true:
* {@code columnFor(a,x) == columnFor(b,y)} if and only if
* {@code (x == y == null)} or {@code a.equals(b) & x.equals(y)}
*
* @param columnFamily
* The columnFamily for which to retrieve the column.
* @param columnPrefix
* Name of the column to retrieve
* @return the corresponding {@link FlowActivityColumnPrefix} or null if both
* arguments don't match.
*/
public static final FlowActivityColumnPrefix columnFor(
FlowActivityColumnFamily columnFamily, String columnPrefix) {
// TODO: needs unit test to confirm and need to update javadoc to explain
// null prefix case.
for (FlowActivityColumnPrefix flowActivityColumnPrefix :
FlowActivityColumnPrefix.values()) {
// Find a match based column family and on name.
if (flowActivityColumnPrefix.columnFamily.equals(columnFamily)
&& (((columnPrefix == null) && (flowActivityColumnPrefix
.getColumnPrefix() == null)) || (flowActivityColumnPrefix
.getColumnPrefix().equals(columnPrefix)))) {
return flowActivityColumnPrefix;
}
}
// Default to null
return null;
}
/* /*
* (non-Javadoc) * (non-Javadoc)
* *

View File

@ -123,60 +123,9 @@ public enum FlowRunColumn implements Column<FlowRunTable> {
return column.readResult(result, columnQualifierBytes); return column.readResult(result, columnQualifierBytes);
} }
/**
* Retrieve an {@link FlowRunColumn} given a name, or null if there is no
* match. The following holds true: {@code columnFor(x) == columnFor(y)} if
* and only if {@code x.equals(y)} or {@code (x == y == null)}
*
* @param columnQualifier
* Name of the column to retrieve
* @return the corresponding {@link FlowRunColumn} or null
*/
public static final FlowRunColumn columnFor(String columnQualifier) {
// Match column based on value, assume column family matches.
for (FlowRunColumn ec : FlowRunColumn.values()) {
// Find a match based only on name.
if (ec.getColumnQualifier().equals(columnQualifier)) {
return ec;
}
}
// Default to null
return null;
}
@Override @Override
public ValueConverter getValueConverter() { public ValueConverter getValueConverter() {
return column.getValueConverter(); return column.getValueConverter();
} }
/**
* Retrieve an {@link FlowRunColumn} given a name, or null if there is no
* match. The following holds true: {@code columnFor(a,x) == columnFor(b,y)}
* if and only if {@code a.equals(b) & x.equals(y)} or
* {@code (x == y == null)}
*
* @param columnFamily
* The columnFamily for which to retrieve the column.
* @param name
* Name of the column to retrieve
* @return the corresponding {@link FlowRunColumn} or null if both arguments
* don't match.
*/
public static final FlowRunColumn columnFor(FlowRunColumnFamily columnFamily,
String name) {
for (FlowRunColumn ec : FlowRunColumn.values()) {
// Find a match based column family and on name.
if (ec.columnFamily.equals(columnFamily)
&& ec.getColumnQualifier().equals(name)) {
return ec;
}
}
// Default to null
return null;
}
} }

View File

@ -209,60 +209,9 @@ public enum FlowRunColumnPrefix implements ColumnPrefix<FlowRunTable> {
keyConverter); keyConverter);
} }
/**
* Retrieve an {@link FlowRunColumnPrefix} given a name, or null if there is
* no match. The following holds true: {@code columnFor(x) == columnFor(y)} if
* and only if {@code x.equals(y)} or {@code (x == y == null)}
*
* @param columnPrefix Name of the column to retrieve
* @return the corresponding {@link FlowRunColumnPrefix} or null
*/
public static final FlowRunColumnPrefix columnFor(String columnPrefix) {
// Match column based on value, assume column family matches.
for (FlowRunColumnPrefix frcp : FlowRunColumnPrefix.values()) {
// Find a match based only on name.
if (frcp.getColumnPrefix().equals(columnPrefix)) {
return frcp;
}
}
// Default to null
return null;
}
@Override @Override
public ValueConverter getValueConverter() { public ValueConverter getValueConverter() {
return column.getValueConverter(); return column.getValueConverter();
} }
/**
* Retrieve an {@link FlowRunColumnPrefix} given a name, or null if there is
* no match. The following holds true:
* {@code columnFor(a,x) == columnFor(b,y)} if and only if
* {@code (x == y == null)} or {@code a.equals(b) & x.equals(y)}
*
* @param columnFamily The columnFamily for which to retrieve the column.
* @param columnPrefix Name of the column to retrieve
* @return the corresponding {@link FlowRunColumnPrefix} or null if both
* arguments don't match.
*/
public static final FlowRunColumnPrefix columnFor(
FlowRunColumnFamily columnFamily, String columnPrefix) {
// TODO: needs unit test to confirm and need to update javadoc to explain
// null prefix case.
for (FlowRunColumnPrefix frcp : FlowRunColumnPrefix.values()) {
// Find a match based column family and on name.
if (frcp.columnFamily.equals(columnFamily)
&& (((columnPrefix == null) && (frcp.getColumnPrefix() == null)) ||
(frcp.getColumnPrefix().equals(columnPrefix)))) {
return frcp;
}
}
// Default to null
return null;
}
} }