[ 
https://issues.apache.org/jira/browse/NIFI-7043?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17018295#comment-17018295
 ] 

Andre Araujo commented on NIFI-7043:
------------------------------------

The [^UpdateRecord.xml] template has a sample flow to demonstrate the problem. 
It works fine on 1.9.

The schema stored on the registry is the one below:

{code:json}
{
 "type": "record",
 "name": "TestIP",
 "namespace": "com.cloudera.example",
 "doc": "This is a test",
 "fields": [
  {
   "name": "id",
   "doc": "Sensor identification number.",
   "type": "int"
  },
  {
   "name": "new",
   "doc": "Sensor identification number.",
   "type": "int",
   "default": 0
  },
  {
   "name": "response",
   "doc": "response record",
   "type": {
    "type": "record",
    "name": "RestResponse",
    "namespace": "com.cloudera.example",
    "doc": "This is a response",
    "fields": [
     {
      "name": "now",
      "doc": "bla",
      "type": "string"
     }
    ]
   }
  }
 ]
}
{code}

> UpdateRecord fails to write schema when the record writer's Schema Access 
> Strategy is set to Inherit Record Schema
> ------------------------------------------------------------------------------------------------------------------
>
>                 Key: NIFI-7043
>                 URL: https://issues.apache.org/jira/browse/NIFI-7043
>             Project: Apache NiFi
>          Issue Type: Bug
>          Components: Core Framework
>    Affects Versions: 1.10.0
>            Reporter: Andre Araujo
>            Priority: Major
>         Attachments: UpdateRecord.xml
>
>
> When using an UpdateRecord processor with JsonRecordSetWriter, with Schema 
> Access Strategy set to Inherit Record Schema, I get the exception shown below.
> This is a regression. The same flow works on NiFi 1.9.x without problems.
> As a workaround, if I change the record writer's to get the schema directly 
> from Schema Registry, instead of inheriting it, the flow works fine.
> {code:java}
> 2020-01-17 19:56:09,289 ERROR 
> org.apache.nifi.processors.standard.UpdateRecord: 
> UpdateRecord[id=bdfc4119-9eaa-3a0b-ba6c-90f138fd70a9] Failed to process 
> StandardFlowFileRecord[uuid=c0ba0dc9-fb4d-430a-8f21-c41f3cb29319,claim=StandardContentClaim
>  [resourceClaim=StandardResourceClaim[id=1579290967244-1, container=default, 
> section=1], offset=34, 
> length=34],offset=0,name=c0ba0dc9-fb4d-430a-8f21-c41f3cb29319,size=34]; will 
> route to failure: org.apache.nifi.processor.exception.ProcessException: 
> Cannot write Schema Reference as Attributes because it does not contain a 
> Schema Identifier
> org.apache.nifi.processor.exception.ProcessException: Cannot write Schema 
> Reference as Attributes because it does not contain a Schema Identifier
>       at 
> org.apache.nifi.processors.standard.AbstractRecordProcessor$1.process(AbstractRecordProcessor.java:168)
>       at 
> org.apache.nifi.controller.repository.StandardProcessSession.write(StandardProcessSession.java:2997)
>       at 
> org.apache.nifi.processors.standard.AbstractRecordProcessor.onTrigger(AbstractRecordProcessor.java:122)
>       at 
> org.apache.nifi.processor.AbstractProcessor.onTrigger(AbstractProcessor.java:27)
>       at 
> org.apache.nifi.controller.StandardProcessorNode.onTrigger(StandardProcessorNode.java:1176)
>       at 
> org.apache.nifi.controller.tasks.ConnectableTask.invoke(ConnectableTask.java:213)
>       at 
> org.apache.nifi.controller.scheduling.TimerDrivenSchedulingAgent$1.run(TimerDrivenSchedulingAgent.java:117)
>       at org.apache.nifi.engine.FlowEngine$2.run(FlowEngine.java:110)
>       at 
> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
>       at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
>       at 
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
>       at 
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
>       at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
>       at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
>       at java.lang.Thread.run(Thread.java:748)
> Caused by: org.apache.nifi.schema.access.SchemaNotFoundException: Cannot 
> write Schema Reference as Attributes because it does not contain a Schema 
> Identifier
>       at 
> org.apache.nifi.schema.access.HortonworksAttributeSchemaReferenceWriter.validateSchema(HortonworksAttributeSchemaReferenceWriter.java:62)
>       at 
> org.apache.nifi.serialization.SchemaRegistryRecordSetWriter.getSchemaAccessWriter(SchemaRegistryRecordSetWriter.java:150)
>       at 
> org.apache.nifi.json.JsonRecordSetWriter.createWriter(JsonRecordSetWriter.java:213)
>       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>       at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>       at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>       at java.lang.reflect.Method.invoke(Method.java:498)
>       at 
> org.apache.nifi.controller.service.StandardControllerServiceInvocationHandler.invoke(StandardControllerServiceInvocationHandler.java:87)
>       at com.sun.proxy.$Proxy124.createWriter(Unknown Source)
>       at 
> org.apache.nifi.processors.standard.AbstractRecordProcessor$1.process(AbstractRecordProcessor.java:150)
>       ... 14 common frames omitted
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to