Mike,

It is currently slated for 1.4. I'm not sure what you mean by "what is the 
branch?"
The PR is at [1], and the JIRA is at [2] if that helps. Yes, the Scripted 
Lookup Service
would need to return a Record object. If you have a Map<String, String>, for 
instance,
you could create a Record Object fairly easily:

final Map<String, String> values = ...;

final List<RecordField> fields = new ArrayList<>();
fields.add(new RecordField("key1", RecordFieldType.STRING.getDataType());
fields.add(new RecordField("key2", RecordFieldType.STRING.getDataType());
fields.add(new RecordField("key3", RecordFieldType.STRING.getDataType());
final RecordSchema schema = new SimpleRecordSchema(fields);
return new MapRecord(values, schema);

Thanks
-Mark

[1] https://github.com/apache/nifi/pull/2110
[2] https://issues.apache.org/jira/browse/NIFI-4116

On Aug 29, 2017, at 2:13 PM, Mike Thomsen 
<[email protected]<mailto:[email protected]>> wrote:

Is that slated for 1.4 and if so, what is the branch? Would the Scripted 
LookupService have to build a real Record object or would a Map be sufficient?

Thanks,

Mike

On Tue, Aug 29, 2017 at 2:01 PM, Mark Payne 
<[email protected]<mailto:[email protected]>> wrote:
Mike,

I also have a Pull Request in that allows a Record to be returned from a 
LookupService and then have LookupRecord
add all of the fields of that Record to the incoming data instead of adding the 
Record itself. So, for example,
you could have a Scripted LookupService return a record like:

{
  "key1": "value1",
  "key2": "value2",
  "key3": "value3"
}

And then LookupRecord would insert all of those values into your incoming 
Record as desired. So I would expect that
update should be in the next release.

Thanks
-Mark


> On Aug 29, 2017, at 1:36 PM, Matt Burgess 
> <[email protected]<mailto:[email protected]>> wrote:
>
> Right now it's a single update per processor, you can provide multiple keys 
> to do a compound lookup but it returns a single value. ExecuteScript is 
> technically record-aware so you could script such a thing.
>
> Regards,
> Matt
>
>> On Aug 29, 2017, at 1:32 PM, Mike Thomsen 
>> <[email protected]<mailto:[email protected]>> wrote:
>>
>> Is it possible to make multiple updates to a record from a single call to a 
>> lookup service? We have to add about 5-6 new fields to a record based on the 
>> contents of a single CSV file, but it doesn't seem like 
>> SimpleCsvFileLookupService or ScriptedLookupService would let us do 
>> something like return a Map and merge its keys into the record. Am I missing 
>> something?
>>
>> Thanks,
>>
>> Mike



Reply via email to