<?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 Change timestamp format field in nifi in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/Change-timestamp-format-field-in-nifi/m-p/361658#M238644</link>
    <description>&lt;P&gt;I have json file like this and want send it to hive using nifi, how can i change the timestamp type because when i send it to hive, in hive table the column type is string, and I read in hive DDL format for timestamp "yyyy-MM-dd HH:mm:ss.SSS"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;{"nama": "d", "alamat": "jkt", "_ab_cdc_updated_at": "2023-01-05T05:57:43.499Z", "_ab_cdc_lsn": 1640844128, "_ab_cdc_deleted_at": null}&lt;BR /&gt;{"nama": "a", "alamat": null, "_ab_cdc_updated_at": "2023-01-05T05:57:43.510Z", "_ab_cdc_lsn": 1640844256, "_ab_cdc_deleted_at": "2023-01-05T05:57:43.510Z"}&lt;BR /&gt;{"nama": "c", "alamat": "semarang", "_ab_cdc_updated_at": "2023-01-12T03:38:32.136Z", "_ab_cdc_lsn": 1684930552, "_ab_cdc_deleted_at": null}&lt;BR /&gt;{"nama": "f", "alamat": null, "_ab_cdc_updated_at": "2023-01-12T04:11:53.329Z", "_ab_cdc_lsn": 1685073792, "_ab_cdc_deleted_at": "2023-01-12T04:11:53.329Z"}&lt;/P&gt;</description>
    <pubDate>Wed, 18 Jan 2023 14:32:17 GMT</pubDate>
    <dc:creator>Galih</dc:creator>
    <dc:date>2023-01-18T14:32:17Z</dc:date>
    <item>
      <title>Change timestamp format field in nifi</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Change-timestamp-format-field-in-nifi/m-p/361658#M238644</link>
      <description>&lt;P&gt;I have json file like this and want send it to hive using nifi, how can i change the timestamp type because when i send it to hive, in hive table the column type is string, and I read in hive DDL format for timestamp "yyyy-MM-dd HH:mm:ss.SSS"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;{"nama": "d", "alamat": "jkt", "_ab_cdc_updated_at": "2023-01-05T05:57:43.499Z", "_ab_cdc_lsn": 1640844128, "_ab_cdc_deleted_at": null}&lt;BR /&gt;{"nama": "a", "alamat": null, "_ab_cdc_updated_at": "2023-01-05T05:57:43.510Z", "_ab_cdc_lsn": 1640844256, "_ab_cdc_deleted_at": "2023-01-05T05:57:43.510Z"}&lt;BR /&gt;{"nama": "c", "alamat": "semarang", "_ab_cdc_updated_at": "2023-01-12T03:38:32.136Z", "_ab_cdc_lsn": 1684930552, "_ab_cdc_deleted_at": null}&lt;BR /&gt;{"nama": "f", "alamat": null, "_ab_cdc_updated_at": "2023-01-12T04:11:53.329Z", "_ab_cdc_lsn": 1685073792, "_ab_cdc_deleted_at": "2023-01-12T04:11:53.329Z"}&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jan 2023 14:32:17 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Change-timestamp-format-field-in-nifi/m-p/361658#M238644</guid>
      <dc:creator>Galih</dc:creator>
      <dc:date>2023-01-18T14:32:17Z</dc:date>
    </item>
    <item>
      <title>Re: Change timestamp format field in nifi</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Change-timestamp-format-field-in-nifi/m-p/361716#M238648</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I was able to obtain the required result using the following processor:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1- SplitText : this is to help you split each json record into its own flowfile&lt;/P&gt;&lt;P&gt;2- UpdateRecord: This is used to update the dates fields and convert to the required format using Json Record Reader\Writer:&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-1674073246414.png" style="width: 400px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/36634i05BC5449EEBB2FF7/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SAMSAL_0-1674073246414.png" alt="SAMSAL_0-1674073246414.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;The value used to convert the time for each field :&lt;/P&gt;&lt;P&gt;${field.value:toDate("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"):format("yyyy-MM-dd HH:mm:ss.SSS")}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;More info on UpdateRecord: &lt;A href="https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-standard-nar/1.7.1/org.apache.nifi.processors.standard.UpdateRecord/additionalDetails.html" target="_blank"&gt;https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-standard-nar/1.7.1/org.apache.nifi.processors.standard.UpdateRecord/additionalDetails.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note: The only problem I noticed is that null values will be converted to "" . Not sure if that will cause you a problem but you can use replace text or json jolt to convert the values back to null.&lt;/P&gt;&lt;P&gt;If you need the records to be merged back together before inserting into Hive, you can use MergeRecord processor.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If that helps please &lt;STRONG&gt;accept&lt;/STRONG&gt; solution.&lt;/P&gt;&lt;P&gt;Thanks&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;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jan 2023 20:26:31 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Change-timestamp-format-field-in-nifi/m-p/361716#M238648</guid>
      <dc:creator>SAMSAL</dc:creator>
      <dc:date>2023-01-18T20:26:31Z</dc:date>
    </item>
  </channel>
</rss>

