SplitRecordToAttributes

Description:

Splits up an input FlowFile that is in a record-oriented data format into multiple smaller FlowFiles and content is also split into attributes as text. See examples in the additional details documentation of this processor.

Examples

To better understand how this Processor works, we will lay out a few examples.

Example 1 - One simple record

Input is flowfile (JSON):

[
{
  "id": 123,
  "date": "2017-07-07",
  "boolean": true,
  "arrays": [1,2,3],
  "null": null
}
]

Result is flowfile (empty content) with attributes:

Attribute name Attribute Value
id 123
date 2017-07-07
boolean true
arrays[0] 1
arrays[1] 2
arrays[2] 3
null
record.count 1
fragment.count 1
fragment.index 0

Example 2 - Two simple record

Input is flowfile (JSON):

[
{
  "id": 123,
  "date": "2017-07-07",
  "boolean": true,
  "arrays": [1,2,3],
  "null": null
},
{
  "id": 456,
  "date": "2016-06-06",
  "boolean": false,
  "arrays": [4,5,6],
  "null": "not null"
}
]

Result is 2 flowfiles (empty content) with attributes:

Flowfile 1
Attribute name Attribute Value
id 123
date 2017-07-07
boolean true
arrays[0] 1
arrays[1] 2
arrays[2] 3
null
record.count 2
fragment.count 2
fragment.index 0
Flowfile 2
Attribute name Attribute Value
id 456
date 2016-06-06
boolean false
arrays[0] 4
arrays[1] 5
arrays[2] 6
null not null
record.count 2
fragment.count 2
fragment.index 1

Example 3 - Nested object

Input is flowfile (JSON):

[{
	"id": 1,
	"name": "John Doe",
	"address": "123 My Street",
	"city": "My City",
	"state": "MS",
	"zipCode": "11111",
	"country": "USA",
	"accounts": [{
		"id": 42,
		"balance": 4750.89
	}, {
		"id": 43,
		"balance": 48212.38
	}]
}]

Result is flowfile (empty content) with attributes:

Attribute name Attribute Value
id 1
name John Doe
address 123 My Street
city My City
state MS
zipCode 11111
country USA
accounts[0].id 42
accounts[0].balance 4750.89
accounts[1].id 43
accounts[1].balance 48212.38
record.count 1
fragment.count 1
fragment.index 0

Tags:

split, record, attribute, json, avro, csv

Properties:

In the list below, the names of required properties appear in bold. Any other properties (not in bold) are considered optional. The table also indicates any default values.

Name Default Value Allowable Values Description
Record Reader Controller Service API:
RecordReaderFactory
No implementations found.
Specifies the Controller Service to use for reading incoming data

State management:

This component does not store state.

Restricted:

This component is not restricted.

Input requirement:

This component requires an incoming relationship.

System Resource Considerations:

None specified.