Support Questions

Find answers, ask questions, and share your expertise
Announcements
Check out our newest addition to the community, the Cloudera Data Analytics (CDA) group hub.

ValidateRecord - Do not process valid records when invalid records found

Explorer

Hello ,

 

I need help with designing a flow such that when there are invalid records found then do not process the valid records. I want to use validateRecord processor to determine the records validity 

 

Thanks,

Hemanth

4 REPLIES 4

Super Collaborator

Hi,

That depends on your input and what kind of validation you are trying to do. can you provide more information on that? For example the blow flow validate json input against Avro schema:

SAMSAL_0-1684426796033.png

 

The input Json in the GenerateFlowFile processor looks like as follows:

{

	"records":
	[
		{
			"name":"John",
			"age": 25
		},
		{
			"name":"Smith",
			"age": 33
		}
	]

}

 

The configuration for the ValidateRecord Processor looks like:

SAMSAL_1-1684426900571.png

 

Where the SchemaText Value:

 

{
	"type": "record",
	"name": "Record",
	"fields": [
		{
			"name": "records",
			"type": {
				"type": "array",
				"items": {
					"type": "record",
					"namespace": "Record",
					"name": "records",
					"fields": [
						{
							"name": "name",
							"type": "string"
						},
						{
							"name": "age",
							"type": "long"
						}
					]
				}
			}
		}
	]
}

 

According to the Schema the input is valid json , however if you change age value to null or some string it will be invalid. The "Validation Details Attribute Name" Property in the ValidationRecord will store the validation message in the specified attribute name.

Hope that helps.

 

 

 

 

 

 

 

Explorer

Thank you for the response.

I would like to not process the valid records when there are invalid records found

Super Collaborator

what is the format of the records ? Are they json array of records ? Can you provide sample data or an example of how your records are structured in the flowfile?

Explorer

the input files are csv 

Take a Tour of the Community
Don't have an account?
Your experience may be limited. Sign in to explore more.