<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Re: ValidateRecord Date Field in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/ValidateRecord-Date-Field/m-p/384037#M245232</link>
    <description>&lt;P&gt;Hi &lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/103151"&gt;@cotopaul&lt;/a&gt; ,&lt;/P&gt;&lt;P&gt;Thanks for your help. Actually you are right. Im not sure what I was thinking when I posted this or under what circumstances I was getting this error but I retried what I posted and it work so I apologize if I wasted your and the community time. However, what if I want to store the schema in the ValidateRecord processor itself as I would think that would be the proper way to use. Notice how in that processor there is no such field for setting the Date\Time format , and if I provide my schema to it by setting (Use Schema Text Property) I dont get an error but my flowfile goes to the "invalid" relationship complaining that the dob filed doesnt have the valid type!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SAMSAL_0-1709039589497.png" style="width: 400px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/39786iE90F3E66ABF72072/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SAMSAL_0-1709039589497.png" alt="SAMSAL_0-1709039589497.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SAMSAL_1-1709039626510.png" style="width: 400px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/39787i5EF6781C63C2A50A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SAMSAL_1-1709039626510.png" alt="SAMSAL_1-1709039626510.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;In this case I did not use any schema def in the record reader\write but I kept the data format set to MM/dd/yyyy.&lt;/P&gt;&lt;P&gt;Is there a way to fix this or am I using the processor the wrong way?&lt;/P&gt;&lt;P&gt;Thanks again for your help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 27 Feb 2024 13:15:46 GMT</pubDate>
    <dc:creator>SAMSAL</dc:creator>
    <dc:date>2024-02-27T13:15:46Z</dc:date>
    <item>
      <title>ValidateRecord Date Field</title>
      <link>https://community.cloudera.com/t5/Support-Questions/ValidateRecord-Date-Field/m-p/383824#M245090</link>
      <description>&lt;P&gt;Hi Everyone,&lt;/P&gt;&lt;P&gt;I'm trying to use ValidateRecord processor where I have a json input with date field as follows:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;{
	"name": "sam",
	"age": "20",
	"dob": "01/01/2004",
	"id": "001"
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the validaterecord Record Writer Im using JsonRecordSetWriter with the following configuration:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SAMSAL_0-1708699962585.png" style="width: 400px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/39768iFFEAF6519C671174/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SAMSAL_0-1708699962585.png" alt="SAMSAL_0-1708699962585.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Where I'm using the following avro schema in the Schema Text property:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;{
	"name": "person_rec",
	"type": "record",
	"namespace": "nifi.com",
	"fields": [
		{
			"name": "name",
			"type": "string"
		},
		{
			"name": "age",
			"type": "int"
		},
		{
			"name": "dob",
			"type": "int",
			"logicalType": "date"
		},
		{
			"name": "id",
			"type": "string"
		}
	]
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also I'm setting the Date Format to : MM/dd/yyyy&lt;/P&gt;&lt;P&gt;I though based on the description that when I set the Date Format it will be able to parse the date when reading\writing date fields. I thought by date field it means using logicalType "date" which means the type must be "int" according to avro schema. My expectation is that my validate record will be able to validate against date field as string with the specified format and write it as such however I keep getting error:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;EM&gt;&lt;FONT size="4"&gt;&lt;FONT color="#FF0000"&gt;Successfully parsed a JSON object from input but failed to convert into a Record object with the given schema
- Caused by: java.lang.NumberFormatException: For input string: "01/01/2004"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/EM&gt;&lt;FONT size="4"&gt;&lt;BR /&gt;&lt;/FONT&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;FONT size="4"&gt;Not sure if I miss understanding or missing something here but how this is suppose to work if its expecting string? How the specified Date Format knows what the date field if its not defined as such in the avro schema?&lt;BR /&gt;&lt;BR /&gt;Can someone help please ?&lt;BR /&gt;Thanks&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Feb 2024 15:09:50 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/ValidateRecord-Date-Field/m-p/383824#M245090</guid>
      <dc:creator>SAMSAL</dc:creator>
      <dc:date>2024-02-23T15:09:50Z</dc:date>
    </item>
    <item>
      <title>Re: ValidateRecord Date Field</title>
      <link>https://community.cloudera.com/t5/Support-Questions/ValidateRecord-Date-Field/m-p/383862#M245111</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/80381"&gt;@SAMSAL&lt;/a&gt;&amp;nbsp;I just tried what you have describe using an GenerateFlowFile (where I set your JSON text) and a ValidateRecord and I can't really reproduce your error. (NiFi 1.19.1)&lt;BR /&gt;I used an JSON Reader, with default settings - Infer Schema and no Date Format set.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="cotopaul_0-1708933316827.png" style="width: 400px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/39773i14E688001907D360/image-size/medium?v=v2&amp;amp;px=400" role="button" title="cotopaul_0-1708933316827.png" alt="cotopaul_0-1708933316827.png" /&gt;&lt;/span&gt;&lt;BR /&gt;Next, in terms of writer, as you stated, I used an JsonRecordSetWriter, where I defined your mentioned schema and tried with and without the date format.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="cotopaul_1-1708933397906.png" style="width: 400px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/39774iB369B818F2627C7F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="cotopaul_1-1708933397906.png" alt="cotopaul_1-1708933397906.png" /&gt;&lt;/span&gt;&amp;nbsp;&lt;BR /&gt;Each time, my FlowFile when into the valid queue, without any errors.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="cotopaul_2-1708933466915.png" style="width: 400px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/39775iF4CB21A79E38A8E3/image-size/medium?v=v2&amp;amp;px=400" role="button" title="cotopaul_2-1708933466915.png" alt="cotopaul_2-1708933466915.png" /&gt;&lt;/span&gt;&lt;BR /&gt;And the file from the valid queue looks like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="cotopaul_4-1708933571646.png" style="width: 400px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/39777iF4C1F928D7970989/image-size/medium?v=v2&amp;amp;px=400" role="button" title="cotopaul_4-1708933571646.png" alt="cotopaul_4-1708933571646.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Maybe there is something extra in your Flow which is causing this error, or maybe your NiFi version is causing this behavior?&lt;BR /&gt;&lt;BR /&gt;In terms of properties, the following have been configured in my ValidateRecord Processor:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="cotopaul_5-1708933742235.png" style="width: 400px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/39778iA71E63ECDCA046C7/image-size/medium?v=v2&amp;amp;px=400" role="button" title="cotopaul_5-1708933742235.png" alt="cotopaul_5-1708933742235.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Feb 2024 07:49:41 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/ValidateRecord-Date-Field/m-p/383862#M245111</guid>
      <dc:creator>cotopaul</dc:creator>
      <dc:date>2024-02-26T07:49:41Z</dc:date>
    </item>
    <item>
      <title>Re: ValidateRecord Date Field</title>
      <link>https://community.cloudera.com/t5/Support-Questions/ValidateRecord-Date-Field/m-p/384037#M245232</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/103151"&gt;@cotopaul&lt;/a&gt; ,&lt;/P&gt;&lt;P&gt;Thanks for your help. Actually you are right. Im not sure what I was thinking when I posted this or under what circumstances I was getting this error but I retried what I posted and it work so I apologize if I wasted your and the community time. However, what if I want to store the schema in the ValidateRecord processor itself as I would think that would be the proper way to use. Notice how in that processor there is no such field for setting the Date\Time format , and if I provide my schema to it by setting (Use Schema Text Property) I dont get an error but my flowfile goes to the "invalid" relationship complaining that the dob filed doesnt have the valid type!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SAMSAL_0-1709039589497.png" style="width: 400px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/39786iE90F3E66ABF72072/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SAMSAL_0-1709039589497.png" alt="SAMSAL_0-1709039589497.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SAMSAL_1-1709039626510.png" style="width: 400px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/39787i5EF6781C63C2A50A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SAMSAL_1-1709039626510.png" alt="SAMSAL_1-1709039626510.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;In this case I did not use any schema def in the record reader\write but I kept the data format set to MM/dd/yyyy.&lt;/P&gt;&lt;P&gt;Is there a way to fix this or am I using the processor the wrong way?&lt;/P&gt;&lt;P&gt;Thanks again for your help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Feb 2024 13:15:46 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/ValidateRecord-Date-Field/m-p/384037#M245232</guid>
      <dc:creator>SAMSAL</dc:creator>
      <dc:date>2024-02-27T13:15:46Z</dc:date>
    </item>
  </channel>
</rss>

