<?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: Insert a String into another String with the Query Record Processor in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/Insert-a-String-into-another-String-with-the-Query-Record/m-p/352568#M236543</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;It doesnt seem like "Stuff" function is recognized function through the QueryRecord sql. I think you have two options:&lt;/P&gt;&lt;P&gt;1- If you are dumping this data into a database where you can use the stuff function there then delegate this to SQL before storing\processing the data.&lt;/P&gt;&lt;P&gt;2- Instead of trying to use QueryRecord processor I would try and use the JoltTransformJson with the following spec:&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;[
  {
    "operation": "modify-overwrite-beta",
    "spec": {
      "*": {
        "tempStart": "=split('', @(1,start_time))",
        "tempEnd": "=split('', @(1,start_end))",
        "start_time": "=concat(@(1,tempStart[0]),@(1,tempStart[1]),':',@(1,tempStart[2]),@(1,tempStart[3]))",
        "start_end": "=concat(@(1,tempEnd[0]),@(1,tempEnd[1]),':',@(1,tempEnd[2]),@(1,tempEnd[3]))"
      }
    }
  },
  {
    "operation": "remove",
    "spec": {
      "*": {
        "temp*": ""
      }
    }
  }
]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Not sure how this will perform with large dataset but its worth testing.&lt;/P&gt;&lt;P&gt;Hope that helps, if it does please accept 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;</description>
    <pubDate>Sun, 18 Sep 2022 18:01:31 GMT</pubDate>
    <dc:creator>SAMSAL</dc:creator>
    <dc:date>2022-09-18T18:01:31Z</dc:date>
    <item>
      <title>Insert a String into another String with the Query Record Processor</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Insert-a-String-into-another-String-with-the-Query-Record/m-p/352482#M236519</link>
      <description>&lt;P&gt;Hey Everyone,&lt;/P&gt;&lt;P&gt;i would like insert a string into another string with the query Record Processor with the sql function STUFF but i run into an error. Anyone have an Idea how i can adjust the sql statemant or how i can this string manipulation with the nifi expression language&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to insert a colon in a column with the time of day&lt;/P&gt;&lt;TABLE border="0" width="412px" cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="206px"&gt;from that&lt;/TD&gt;&lt;TD width="206px"&gt;to the&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="206px"&gt;&lt;FONT color="#000000"&gt;0015&lt;/FONT&gt;&lt;/TD&gt;&lt;TD width="206px"&gt;&lt;FONT color="#FF0000"&gt;00:15&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is my input Data from an json file&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[ {
  "store_id" : 1011,
  "date" : 20220915,
  "start_time" : "0015",
  "start_end" : "0015",
  "out" : 0
}, {
  "store_id" : 1011,
  "date" : 20220915,
  "start_time" : "0030",
  "start_end" : "0030",
  "out" : 0
}]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is my&amp;nbsp;Sql expression&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;SELECT 
 "store_id",
 "date",
 STUFF("start_time",2,0,':') as "start",
 "start_end",
 "out"
FROM FLOWFILE&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the error message i got&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;QueryRecord[id=46658fcd-0183-1000-0000-000015e8db65] Unable to query StandardFlowFileRecord[uuid=641e1c71-ff9b-45dc-a948-e527eff450f6,claim=StandardContentClaim [resourceClaim=StandardResourceClaim[id=1663335669504-61321, container=default, section=905], offset=280506, length=7780],offset=0,name=aa02839a-3f71-4e8d-860a-9ecee9ba745f,size=7780] due to java.sql.SQLException: Error while preparing statement [SELECT "store_id", "date", STUFF("start_time",2,0,':') as "start", "start_end", "out" FROM FLOWFILE]: org.apache.calcite.sql.validate.SqlValidatorException: No match found for function signature STUFF(, , , ) ↳ causes: org.apache.calcite.runtime.CalciteContextException: From line 4, column 3 to line 4, column 29: No match found for function signature STUFF(, , , ) ↳ causes: java.sql.SQLException: Error while preparing statement [SELECT "store_id", "date", STUFF("start_time",2,0,':') as "start", "start_end", "out" FROM FLOWFILE] ↳ causes: org.apache.nifi.processor.exception.ProcessException: java.sql.SQLException: Error while preparing statement [SELECT "store_id", "date", STUFF("start_time",2,0,':') as "start", "start_end", "out" FROM FLOWFILE]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That is the expected output as a csv file&lt;/P&gt;&lt;TABLE border="0" width="415" cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="83" height="19"&gt;store_id&lt;/TD&gt;&lt;TD width="83"&gt;date&lt;/TD&gt;&lt;TD width="83"&gt;start_time&lt;/TD&gt;&lt;TD width="83"&gt;start_end&lt;/TD&gt;&lt;TD width="83"&gt;out&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="19"&gt;1001&lt;/TD&gt;&lt;TD&gt;20220915&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#FF0000"&gt;00:15&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#FF0000"&gt;00:15&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for help&lt;/P&gt;</description>
      <pubDate>Fri, 16 Sep 2022 13:57:08 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Insert-a-String-into-another-String-with-the-Query-Record/m-p/352482#M236519</guid>
      <dc:creator>MarioFRS</dc:creator>
      <dc:date>2022-09-16T13:57:08Z</dc:date>
    </item>
    <item>
      <title>Re: Insert a String into another String with the Query Record Processor</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Insert-a-String-into-another-String-with-the-Query-Record/m-p/352568#M236543</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;It doesnt seem like "Stuff" function is recognized function through the QueryRecord sql. I think you have two options:&lt;/P&gt;&lt;P&gt;1- If you are dumping this data into a database where you can use the stuff function there then delegate this to SQL before storing\processing the data.&lt;/P&gt;&lt;P&gt;2- Instead of trying to use QueryRecord processor I would try and use the JoltTransformJson with the following spec:&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;[
  {
    "operation": "modify-overwrite-beta",
    "spec": {
      "*": {
        "tempStart": "=split('', @(1,start_time))",
        "tempEnd": "=split('', @(1,start_end))",
        "start_time": "=concat(@(1,tempStart[0]),@(1,tempStart[1]),':',@(1,tempStart[2]),@(1,tempStart[3]))",
        "start_end": "=concat(@(1,tempEnd[0]),@(1,tempEnd[1]),':',@(1,tempEnd[2]),@(1,tempEnd[3]))"
      }
    }
  },
  {
    "operation": "remove",
    "spec": {
      "*": {
        "temp*": ""
      }
    }
  }
]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Not sure how this will perform with large dataset but its worth testing.&lt;/P&gt;&lt;P&gt;Hope that helps, if it does please accept 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;</description>
      <pubDate>Sun, 18 Sep 2022 18:01:31 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Insert-a-String-into-another-String-with-the-Query-Record/m-p/352568#M236543</guid>
      <dc:creator>SAMSAL</dc:creator>
      <dc:date>2022-09-18T18:01:31Z</dc:date>
    </item>
  </channel>
</rss>

