Module datarush.analytics
Class ReplaceSpecification
- java.lang.Object
-
- com.pervasive.datarush.analytics.cleansing.ReplaceSpecification
-
- All Implemented Interfaces:
Serializable
public final class ReplaceSpecification extends Object implements Serializable
Specify per field or per group of fields how missing (null) values should be handled. An action must be specified that defines how missing values are handled. A field name can be specified or a group of fields by type. A replacement value can be given if the action is to replace missing values with a constant value.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ReplaceSpecification.Action
The action to take when a missing value is discovered within a field.
-
Constructor Summary
Constructors Constructor Description ReplaceSpecification()
Default public constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ReplaceSpecification
constant(ScalarTokenType type, String value)
Create a replacement specification with theReplaceSpecification.Action.REPLACE_CONSTANT
action for fields with the specified type.static ReplaceSpecification
constant(String fieldName, String value)
Create a replacement specification with theReplaceSpecification.Action.REPLACE_CONSTANT
action for the specified field.static ReplaceSpecification
freq(ScalarTokenType type)
Create a replacement specification with theReplaceSpecification.Action.REPLACE_MOST_FREQ
action for fields with the specified type.static ReplaceSpecification
freq(String fieldName)
Create a replacement specification with theReplaceSpecification.Action.REPLACE_MOST_FREQ
action for the specified field.ReplaceSpecification.Action
getAction()
Get the replacement action value.String
getFieldName()
Get the field name.ScalarTokenType
getFieldType()
Get the field type.String
getReplacementValue()
Get the constant replacement value.static ReplaceSpecification
max(ScalarTokenType type)
Create a replacement specification with theReplaceSpecification.Action.REPLACE_MAX
action for fields with the specified type.static ReplaceSpecification
max(String fieldName)
Create a replacement specification with theReplaceSpecification.Action.REPLACE_MAX
action for the specified field.static ReplaceSpecification
mean(ScalarTokenType type)
Create a replacement specification with theReplaceSpecification.Action.REPLACE_MEAN
action for fields with the specified type.static ReplaceSpecification
mean(String fieldName)
Create a replacement specification with theReplaceSpecification.Action.REPLACE_MEAN
action for the specified field.static ReplaceSpecification
median(ScalarTokenType type)
Create a replacement specification with theReplaceSpecification.Action.REPLACE_MEDIAN
action for fields with the specified type.static ReplaceSpecification
median(String fieldName)
Create a replacement specification with theReplaceSpecification.Action.REPLACE_MEDIAN
action for the specified field.static ReplaceSpecification
min(ScalarTokenType type)
Create a replacement specification with theReplaceSpecification.Action.REPLACE_MIN
action for fields with the specified type.static ReplaceSpecification
min(String fieldName)
Create a replacement specification with theReplaceSpecification.Action.REPLACE_MIN
action for the specified field.static ReplaceSpecification
none(ScalarTokenType type)
Create a replacement specification with theReplaceSpecification.Action.NONE
action for fields with the specified type.static ReplaceSpecification
none(String fieldName)
Create a replacement specification with theReplaceSpecification.Action.NONE
action for the specified field.void
setAction(ReplaceSpecification.Action action)
Set the replacementReplaceSpecification.Action
.void
setFieldName(String fieldName)
Set the field name to apply the replacement action.void
setFieldType(ScalarTokenType fieldType)
Set the field (token) type.void
setReplacementValue(String replacementValue)
Set the replacement value.static ReplaceSpecification
skip(ScalarTokenType type)
Create a replacement specification with theReplaceSpecification.Action.SKIP_RECORD
action for fields with the specified type.static ReplaceSpecification
skip(String fieldName)
Create a replacement specification with theReplaceSpecification.Action.SKIP_RECORD
action for the specified field.
-
-
-
Method Detail
-
none
public static ReplaceSpecification none(String fieldName)
Create a replacement specification with theReplaceSpecification.Action.NONE
action for the specified field.- Parameters:
fieldName
- apply the action to this field- Returns:
- specification with the
NONE
action
-
none
public static ReplaceSpecification none(ScalarTokenType type)
Create a replacement specification with theReplaceSpecification.Action.NONE
action for fields with the specified type.- Parameters:
type
- apply the action to all fields of this type- Returns:
- specification with the
NONE
action
-
skip
public static ReplaceSpecification skip(String fieldName)
Create a replacement specification with theReplaceSpecification.Action.SKIP_RECORD
action for the specified field.- Parameters:
fieldName
- apply the action to this field- Returns:
- specification with the
SKIP_RECORD
action
-
skip
public static ReplaceSpecification skip(ScalarTokenType type)
Create a replacement specification with theReplaceSpecification.Action.SKIP_RECORD
action for fields with the specified type.- Parameters:
type
- apply the action to all fields of this type- Returns:
- specification with the
SKIP_RECORD
action
-
constant
public static ReplaceSpecification constant(String fieldName, String value)
Create a replacement specification with theReplaceSpecification.Action.REPLACE_CONSTANT
action for the specified field.- Parameters:
fieldName
- apply the action to this fieldvalue
- replacement value- Returns:
- specification with the
REPLACE_CONSTANT
action
-
constant
public static ReplaceSpecification constant(ScalarTokenType type, String value)
Create a replacement specification with theReplaceSpecification.Action.REPLACE_CONSTANT
action for fields with the specified type.- Parameters:
type
- apply the action to all fields of this typevalue
- replacement value- Returns:
- specification with the
REPLACE_CONSTANT
action
-
min
public static ReplaceSpecification min(String fieldName)
Create a replacement specification with theReplaceSpecification.Action.REPLACE_MIN
action for the specified field.- Parameters:
fieldName
- apply the action to this field- Returns:
- specification with the
REPLACE_MIN
action
-
min
public static ReplaceSpecification min(ScalarTokenType type)
Create a replacement specification with theReplaceSpecification.Action.REPLACE_MIN
action for fields with the specified type.- Parameters:
type
- apply the action to all fields of this type- Returns:
- specification with the
REPLACE_MIN
action
-
max
public static ReplaceSpecification max(String fieldName)
Create a replacement specification with theReplaceSpecification.Action.REPLACE_MAX
action for the specified field.- Parameters:
fieldName
- apply the action to this field- Returns:
- specification with the
REPLACE_MAX
action
-
max
public static ReplaceSpecification max(ScalarTokenType type)
Create a replacement specification with theReplaceSpecification.Action.REPLACE_MAX
action for fields with the specified type.- Parameters:
type
- apply the action to all fields of this type- Returns:
- specification with the
REPLACE_MAX
action
-
median
public static ReplaceSpecification median(String fieldName)
Create a replacement specification with theReplaceSpecification.Action.REPLACE_MEDIAN
action for the specified field.- Parameters:
fieldName
- apply the action to this field- Returns:
- specification with the
REPLACE_MEDIAN
action
-
median
public static ReplaceSpecification median(ScalarTokenType type)
Create a replacement specification with theReplaceSpecification.Action.REPLACE_MEDIAN
action for fields with the specified type.- Parameters:
type
- apply the action to all fields of this type- Returns:
- specification with the
REPLACE_MEDIAN
action
-
mean
public static ReplaceSpecification mean(String fieldName)
Create a replacement specification with theReplaceSpecification.Action.REPLACE_MEAN
action for the specified field.- Parameters:
fieldName
- apply the action to this field- Returns:
- specification with the
REPLACE_MEAN
action
-
mean
public static ReplaceSpecification mean(ScalarTokenType type)
Create a replacement specification with theReplaceSpecification.Action.REPLACE_MEAN
action for fields with the specified type.- Parameters:
type
- apply the action to all fields of this type- Returns:
- specification with the
REPLACE_MEAN
action
-
freq
public static ReplaceSpecification freq(String fieldName)
Create a replacement specification with theReplaceSpecification.Action.REPLACE_MOST_FREQ
action for the specified field.- Parameters:
fieldName
- apply the action to this field- Returns:
- specification with the
REPLACE_MOST_FREQ
action
-
freq
public static ReplaceSpecification freq(ScalarTokenType type)
Create a replacement specification with theReplaceSpecification.Action.REPLACE_MOST_FREQ
action for fields with the specified type.- Parameters:
type
- apply the action to all fields of this type- Returns:
- specification with the
REPLACE_MOST_FREQ
action
-
getAction
public ReplaceSpecification.Action getAction()
Get the replacement action value.- Returns:
- the action
-
setAction
public void setAction(ReplaceSpecification.Action action)
Set the replacementReplaceSpecification.Action
.- Parameters:
action
- the action to set
-
getFieldName
public String getFieldName()
Get the field name.- Returns:
- the fieldName
-
setFieldName
public void setFieldName(String fieldName)
Set the field name to apply the replacement action.- Parameters:
fieldName
- the fieldName to set
-
getFieldType
public ScalarTokenType getFieldType()
Get the field type.- Returns:
- the fieldType
-
setFieldType
public void setFieldType(ScalarTokenType fieldType)
Set the field (token) type. All fields of this type in the input will have this missing value replacement applied to them.- Parameters:
fieldType
- the fieldType to set
-
getReplacementValue
public String getReplacementValue()
Get the constant replacement value.- Returns:
- the replacementValue
-
setReplacementValue
public void setReplacementValue(String replacementValue)
Set the replacement value. Only applicable if the action is set toReplaceSpecification.Action.REPLACE_CONSTANT
, ignored otherwise.- Parameters:
replacementValue
- the replacementValue to set
-
-