- java.lang.Object
-
- com.pervasive.datarush.util.ColumnSelector
-
public final class ColumnSelector extends Object
Utility class to select a number of column fields based on field name and type criteria.
-
-
Constructor Summary
Constructors Constructor Description ColumnSelector()
Create a column selector.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ColumnSelector
addExcludes(String... excludes)
Adds columns to exclude.ColumnSelector
addExcludes(Collection<String> excludes)
Adds columns to exclude.ColumnSelector
addIncludes(String... includes)
Adds columns to include.ColumnSelector
addIncludes(Collection<String> includes)
Adds columns to include.RecordTokenType
filter(RecordTokenType type)
Returns a type consisting of a subset of the given type that matches this column selector's criteria.String[]
filterNames(RecordTokenType type)
Returns the names of the fields of given type that match this column selector's criteria.ColumnSelector
setMaxDistinctValues(int value)
Sets the maximum number of distinct values to allow.ColumnSelector
setType(ScalarTokenType type)
Sets the type of columns to include.
-
-
-
Method Detail
-
addIncludes
public ColumnSelector addIncludes(String... includes)
Adds columns to include. If set, we will only return columns in this list- Parameters:
includes
- the set of columns to include- Returns:
- a "this" reference to allow method chaining
-
addIncludes
public ColumnSelector addIncludes(Collection<String> includes)
Adds columns to include. If set, we will only return columns in this list- Parameters:
includes
- the set of columns to include- Returns:
- a "this" reference to allow method chaining
-
addExcludes
public ColumnSelector addExcludes(String... excludes)
Adds columns to exclude. If set, we will exclude those columns specified- Parameters:
excludes
- the set of columns to exclude- Returns:
- a "this" reference to allow method chaining
-
addExcludes
public ColumnSelector addExcludes(Collection<String> excludes)
Adds columns to exclude. If set, we will exclude those columns specified- Parameters:
excludes
- the set of columns to exclude- Returns:
- a "this" reference to allow method chaining
-
setType
public ColumnSelector setType(ScalarTokenType type)
Sets the type of columns to include. If set, will only return those columns that are assignable to the given type.- Parameters:
type
- the type of columns to include- Returns:
- a "this" reference to allow method chaining
-
setMaxDistinctValues
public ColumnSelector setMaxDistinctValues(int value)
Sets the maximum number of distinct values to allow. Columns having more distinct values than that specified or that have an unspecified domain will be filtered. Note that this should only be used by operators that have already discovered domain information since, in general, domain information will not be available.- Parameters:
value
- the max distinct values
-
filter
public RecordTokenType filter(RecordTokenType type)
Returns a type consisting of a subset of the given type that matches this column selector's criteria. The set of fields returned is as follows- If
includes
are specified, include only those specified - If
excludes
are specified, exclude those specified - If
type
is specified, include only those columns matching the given type
- Parameters:
type
- the input type- Returns:
- a subset of the input type that matches this column selector's criteria
- If
-
filterNames
public String[] filterNames(RecordTokenType type)
Returns the names of the fields of given type that match this column selector's criteria. The set of fields returned is as follows- If
includes
are specified, include only those specified - If
excludes
are specified, exclude those specified - If
type
is specified, include only those columns matching the given type
- Parameters:
type
- the input type- Returns:
- a subset of the names of the fields of given type type that match this column selector's criteria
- If
-
-