Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Jython record iteration cause stack overflow error

Using the Dev Raw Data origin to create the following record: { "f1": "abc", "f2": "xyz", "f3": "lmn" }

Why does to following jython script work:

for record in records: record.value['child'] = {} for k, v in record.value.items():
x = v # let's see if v is the problem record.value['child'][k] = 2 output.write(record)

>      Record1-Output Record1 :
>     MAP
>     f1 :
>     STRING abc
>     f2 :
>     STRING xyz
>     f3 :
>     STRING lmn
>      child :
>     MAP
>     f1 :
>     INTEGER 2
>     f2 :
>     INTEGER 2
>     f3 :
>     INTEGER 2
>     child :
>     INTEGER 2

But the following script (note assigment change for the 'child' key from constant to an attempt to get the value from one of the records other keys):

for record in records: record.value['child'] = {} for k, v in record.value.items():
x = v # let's see if v is the problem record.value['child'][k] = v output.write(record)

CAUSES A Closejava.lang.StackOverflowError ????

Thanks.

Jython record iteration cause stack overflow error

Using the Dev Raw Data origin to create the following record: record:

{
  "f1": "abc",
  "f2": "xyz",
  "f3": "lmn"
}

}

Why does to following jython script work:

for record in records: 
    record.value['child'] = {}
    for k, v in record.value.items(): 
x = v # let's see if v is the problem record.value['child'][k] = 2 output.write(record)

output.write(record)

>      Record1-Output Record1 :
>     MAP
>     f1 :
>     STRING abc
>     f2 :
>     STRING xyz
>     f3 :
>     STRING lmn
>      child :
>     MAP
>     f1 :
>     INTEGER 2
>     f2 :
>     INTEGER 2
>     f3 :
>     INTEGER 2
>     child :
>     INTEGER 2

But the following script (note assigment change for the 'child' key from constant to an attempt to get the value from one of the records other keys):

for record in records: 
    record.value['child'] = {}
    for k, v in record.value.items(): 
x = v # let's see if v is the problem record.value['child'][k] = v output.write(record)

output.write(record)

CAUSES A Closejava.lang.StackOverflowError ????

Thanks.