Class CalculateRecordStats
java.lang.Object
org.apache.nifi.components.AbstractConfigurableComponent
org.apache.nifi.processor.AbstractSessionFactoryProcessor
org.apache.nifi.processor.AbstractProcessor
org.apache.nifi.processors.standard.CalculateRecordStats
- All Implemented Interfaces:
org.apache.nifi.components.ConfigurableComponent,org.apache.nifi.processor.Processor
@SideEffectFree
@SupportsBatching
@Tags({"record","stats","metrics"})
@CapabilityDescription("Counts the number of Records in a record set, optionally counting the number of elements per category, where the categories are defined by user-defined properties.")
@InputRequirement(INPUT_REQUIRED)
@DynamicProperty(name="The name of the category. For example, sport",
value="The RecordPath that points to the value of the category. For example /sport",
expressionLanguageScope=FLOWFILE_ATTRIBUTES,
description="Specifies a category that should be counted. For example, if the property name is \'sport\' and the value is \'/sport\', the processor will count how many records have a value of \'soccer\' for the /sport field, how many have a value of \'baseball\' for the /sport, and so on. These counts be added as attributes named recordStats.sport.soccer, recordStats.sport.baseball.")
@WritesAttribute(attribute="record.count",description="A count of the records in the record set in the FlowFile.") @WritesAttribute(attribute="recordStats.<User Defined Property Name>.count",description="A count of the records that contain a value for the user defined property.") @WritesAttribute(attribute="recordStats.<User Defined Property Name>.<value>.count",description="Each value discovered for the user defined property will have its own count attribute. Total number of top N value counts to be added is defined by the limit configuration.")
public class CalculateRecordStats
extends org.apache.nifi.processor.AbstractProcessor
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate RecordPathCache(package private) static final org.apache.nifi.components.PropertyDescriptor(package private) static final List<org.apache.nifi.components.PropertyDescriptor> (package private) static final String(package private) static final org.apache.nifi.components.PropertyDescriptor(package private) static final org.apache.nifi.processor.Relationship(package private) static final org.apache.nifi.processor.Relationship(package private) static final Set<org.apache.nifi.processor.Relationship> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncalculateStats(org.apache.nifi.flowfile.FlowFile flowFile, Map<String, RecordPath> paths, org.apache.nifi.processor.ProcessContext context, org.apache.nifi.processor.ProcessSession session) filterBySize(Map<String, Integer> values, int limit, Collection<String> baseKeys) protected Map<String, RecordPath> getRecordPaths(org.apache.nifi.processor.ProcessContext context, org.apache.nifi.flowfile.FlowFile flowFile) Set<org.apache.nifi.processor.Relationship> protected org.apache.nifi.components.PropertyDescriptorgetSupportedDynamicPropertyDescriptor(String propertyDescriptorName) protected List<org.apache.nifi.components.PropertyDescriptor> voidonEnabled(org.apache.nifi.processor.ProcessContext context) voidonTrigger(org.apache.nifi.processor.ProcessContext context, org.apache.nifi.processor.ProcessSession session) Methods inherited from class org.apache.nifi.processor.AbstractProcessor
onTriggerMethods inherited from class org.apache.nifi.processor.AbstractSessionFactoryProcessor
getControllerServiceLookup, getIdentifier, getLogger, getNodeTypeProvider, init, initialize, isConfigurationRestored, isScheduled, toString, updateConfiguredRestoredTrue, updateScheduledFalse, updateScheduledTrueMethods inherited from class org.apache.nifi.components.AbstractConfigurableComponent
customValidate, equals, getPropertyDescriptor, getPropertyDescriptors, hashCode, onPropertyModified, validateMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.nifi.components.ConfigurableComponent
getPropertyDescriptor, getPropertyDescriptors, onPropertyModified, validateMethods inherited from interface org.apache.nifi.processor.Processor
isStateful, migrateProperties, migrateRelationships
-
Field Details
-
RECORD_COUNT_ATTR
- See Also:
-
RECORD_READER
static final org.apache.nifi.components.PropertyDescriptor RECORD_READER -
LIMIT
static final org.apache.nifi.components.PropertyDescriptor LIMIT -
PROPERTY_DESCRIPTORS
-
REL_SUCCESS
static final org.apache.nifi.processor.Relationship REL_SUCCESS -
REL_FAILURE
static final org.apache.nifi.processor.Relationship REL_FAILURE -
RELATIONSHIPS
-
cache
-
-
Constructor Details
-
CalculateRecordStats
public CalculateRecordStats()
-
-
Method Details
-
getSupportedDynamicPropertyDescriptor
protected org.apache.nifi.components.PropertyDescriptor getSupportedDynamicPropertyDescriptor(String propertyDescriptorName) - Overrides:
getSupportedDynamicPropertyDescriptorin classorg.apache.nifi.components.AbstractConfigurableComponent
-
getSupportedPropertyDescriptors
- Overrides:
getSupportedPropertyDescriptorsin classorg.apache.nifi.components.AbstractConfigurableComponent
-
onEnabled
@OnScheduled public void onEnabled(org.apache.nifi.processor.ProcessContext context) -
getRelationships
- Specified by:
getRelationshipsin interfaceorg.apache.nifi.processor.Processor- Overrides:
getRelationshipsin classorg.apache.nifi.processor.AbstractSessionFactoryProcessor
-
onTrigger
public void onTrigger(org.apache.nifi.processor.ProcessContext context, org.apache.nifi.processor.ProcessSession session) throws org.apache.nifi.processor.exception.ProcessException - Specified by:
onTriggerin classorg.apache.nifi.processor.AbstractProcessor- Throws:
org.apache.nifi.processor.exception.ProcessException
-
getRecordPaths
protected Map<String,RecordPath> getRecordPaths(org.apache.nifi.processor.ProcessContext context, org.apache.nifi.flowfile.FlowFile flowFile) -
calculateStats
protected Map<String,String> calculateStats(org.apache.nifi.flowfile.FlowFile flowFile, Map<String, RecordPath> paths, org.apache.nifi.processor.ProcessContext context, org.apache.nifi.processor.ProcessSession session) throws IOException, SchemaNotFoundException, MalformedRecordException -
filterBySize
-