Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -682,7 +682,18 @@ private Map<String, Object> createLookupCoordinates(final Record record, final L
}

final FieldValue fieldValue = lookupFieldValues.get(0);
final Object coordinateValue = DataTypeUtils.convertType(fieldValue.getValue(), fieldValue.getField().getDataType(), null, null, null, fieldValue.getField().getFieldName());
final Object coordinateValue = DataTypeUtils.convertType(
fieldValue.getValue(),
Optional.ofNullable(fieldValue.getField())
.map(RecordField::getDataType)
.orElse(DataTypeUtils.inferDataType(fieldValue.getValue(), RecordFieldType.STRING.getDataType())),
null,
null,
null,
Optional.ofNullable(fieldValue.getField())
.map(RecordField::getFieldName)
.orElse(coordinateKey)
);
lookupCoordinates.put(coordinateKey, coordinateValue);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -569,6 +569,19 @@ public void testLookupArrayKeyNotInLRS() throws InitializationException, IOExcep
out.assertContentEquals(new File("src/test/resources/TestLookupRecord/lookup-array-output-unmatched.json").toPath());
}


@Test
public void testLiteralCoordinate() {
lookupService.addValue("lookupKey", "lookupValue");

runner.setProperty("lookup", "toString('lookupKey', 'UTF-8')");

runner.enqueue("");
runner.run();

runner.assertAllFlowFilesTransferred(LookupRecord.REL_MATCHED, 1);
}

private static class MapLookup extends AbstractControllerService implements StringLookupService {
protected final Map<String, String> values = new HashMap<>();
private Map<String, Object> expectedContext;
Expand Down