Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

UpdateRecord won't update nested fields

Highlighted

UpdateRecord won't update nested fields

New 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.

2 REPLIES 2

Re: UpdateRecord won't update nested fields

New Contributor

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

Re: UpdateRecord won't update nested fields

Rising Star

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!