Support Questions
Find answers, ask questions, and share your expertise
Announcements
Check out our newest addition to the community, the Cloudera Innovation Accelerator group hub.

UpdateRecord won't update nested fields

Contributor

I have this XML file:

<request>
    <requestType>BULKRETRIEVE</requestType>
    <requestDomainType>ROI</requestDomainType>
    <systemName>SYSTEMTEST</systemName>
    <location>USA</location>    
    <userInformation>
        <userId>1313</userId>
        <firstName>Some</firstName> <!-- required -->
        <lastName>Guy</lastName> <!-- required -->
        <email>email@address.com</email> <!-- required if phone not included -->
        <phone></phone> <!-- required if email not included -->
    </userInformation>  
    <requestObject>
        <startDate>2019-01-01T00:00:00.000-05:00</startDate>
        <endDate>2019-01-31T00:00:00.000-05:00</endDate>
        <type>ROI</type>
    </requestObject>
</request>

Using this schema

{
    "namespace": "com.organization.somethingspecific",
    "name": "request",
    "type": "record",
    "fields": [
      {"name": "requestType", "type": ["string","null"], "default": null},
      {"name": "requestDomainType", "type": ["string","null"], "default": null},
      {"name": "systemName", "type": ["string","null"], "default": null},
      {"name": "location", "type": ["string","null"], "default": null},
      {"name": "userInformation", "type": ["null", {
        "name": "userInformation", "type": "array", "items": {
          "name": "userInformation", "type": "record", "fields": [
            {"name": "userId", "type": ["string","null"], "default": null},
            {"name": "firstName", "type": ["string","null"], "default": null},
            {"name": "lastName", "type": ["string","null"], "default": null},
            {"name": "email", "type": ["string","null"], "default": null},
            {"name": "phone", "type": ["string","null"], "default": null}
          ]
        }
      }], "default": null},
      {"name": "requestObject", "type": ["null",{
        "name": "requestObject", "type": "array", "items": {
          "name": "requestObject", "type": "record", "fields": [
            {"name": "startDate", "type": ["string","null"], "default": null},
            {"name": "endDate", "type": ["string","null"], "default": null},
            {"name": "type", "type": ["string","null"], "default": null}
          ]
        }
      }], "default": null}
    ]
}

I am confident that the schema is correct because I am able to convert from XML to JSON no problem.

However UpdateRecord is not able to alter nested fields no matter how I reference them. I have the following UpdateRecord processor:

108004-updaterecord.png


At the very least I would expect //startDate to work since that is SUPPOSED to ignore hierarchy, but I can only update top level fields such as /requestType which is the only one that actually updates of the 4 in my configuration.

I am following the documentation exactly, what else could be wrong? Any help appreciated.

3 REPLIES 3

Contributor

Was able to solve this by removing my usage of arrays from my schema

Expert Contributor

Hi @Andrew Riffle it looks like I'm facing the same problem.


I dont't understand your remark concering your solution.

You deleted the "array"-line from your schema and then it worked OR you don't work with an array anymore?


Could you please make this clear? Thanks!

New Contributor

Hello guys,
I have the same problem and I would also like you to explain a bit how you made this work. I have followed the help guidelines but can't make it work.

@ariffle 

Thanks