Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

OnRecordException when using split on jython evaluator

I am seeing a OnRecordException when I use split method on parsing the input file but it works on splitlines method. Since some of the input is more than one line I need to use split. I need help on finding a solution as I can see the data as map on preview method on using both methods but not working on split method. Error: com.streamsets.pipeline.api.base.OnRecordErrorException: SCRIPTING_04 - Script sent record to error:

Sample Code: text = record.value['report'] rows = text.split('//') for r in rows: fields = r.split('/', 1) if len(fields) ==2: key=fields[0] item[key] = fields[1] record.value = item output.write(record)

on the next jython evluator when I try to access the key I am seeing the above error. I also verified whether the code is in between try exception block. As I said it works with splitlines method.

click to hide/show revision 2
None

OnRecordException when using split on jython evaluator

I am seeing a OnRecordException when I use split method on parsing the input file but it works on splitlines method. Since some of the input is more than one line I need to use split. I need help on finding a solution as I can see the data as map on preview method on using both methods but not working on split method. Error: com.streamsets.pipeline.api.base.OnRecordErrorException: SCRIPTING_04 - Script sent record to error:

Sample Code: Code:

text = record.value['report']
 rows = text.split('//')
 for r in rows:
     fields = r.split('/', 1)
     if len(fields) ==2:
       key=fields[0]
       item[key] = fields[1]
  record.value = item
     output.write(record)

output.write(record)

on On the next jython evluator when I try to access the key I am seeing the above error. I also verified whether the code is in between try exception block. As I said it works with splitlines method.

OnRecordException when using split on jython evaluator

I am seeing a OnRecordException when I use split method on parsing the input file but it works on splitlines method. Since some of the input is more than one line I need to use split. I need help on finding a solution as I can see the data as map on preview method on using both methods but not working on split method. Error: com.streamsets.pipeline.api.base.OnRecordErrorException: SCRIPTING_04 - Script sent record to error:

Sample Code:

Sample input: "KEY/VAL1/VAL2/VAL3/VAL4/VAL5/VAL6 /VAL7//"

text = record.value['report']
rows = text.split('//')
for r in rows:
    fields = r.split('/', 1)
    if len(fields) ==2:
      key=fields[0]
      item[key] = fields[1]
 record.value = item
 output.write(record)

On the next jython evluator when I try to access the key I am seeing the above error. I also verified whether the code is in between try exception block. As I said it works with splitlines method.