diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/queryrecord/FlowFileTable.java b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/queryrecord/FlowFileTable.java index a2debbdce5..e462972387 100644 --- a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/queryrecord/FlowFileTable.java +++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/queryrecord/FlowFileTable.java @@ -227,6 +227,8 @@ public class FlowFileTable extends AbstractTable implements QueryableTable, Tran return typeFactory.createJavaType(BigInteger.class); case DECIMAL: return typeFactory.createJavaType(BigDecimal.class); + case ENUM: + return typeFactory.createJavaType(Enum.class); case CHOICE: final ChoiceDataType choiceDataType = (ChoiceDataType) fieldType; DataType widestDataType = choiceDataType.getPossibleSubTypes().get(0); diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestQueryRecord.java b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestQueryRecord.java index 20f6dca199..d8a9a1f069 100644 --- a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestQueryRecord.java +++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestQueryRecord.java @@ -251,7 +251,7 @@ public class TestQueryRecord { runner.setProperty(QueryRecord.RECORD_READER_FACTORY, "reader"); runner.setProperty(QueryRecord.RECORD_WRITER_FACTORY, "writer"); runner.setProperty(REL_NAME, - "SELECT title, name" + + "SELECT title, name, jobLevel" + " FROM FLOWFILE" + " WHERE CARDINALITY(addresses) > 1"); @@ -270,6 +270,7 @@ public class TestQueryRecord { final Record output = written.get(0); assertEquals("John Doe", output.getValue("name")); assertEquals("Software Engineer", output.getValue("title")); + assertEquals(JobLevel.IC2, output.getValue("jobLevel")); } @Test @@ -777,6 +778,7 @@ public class TestQueryRecord { * { * "name": "John Doe", * "title": "Software Engineer", + * "jobLevel": "IC2", * "age": 40, * "addresses": [{ * "streetNumber": 4820, @@ -815,6 +817,7 @@ public class TestQueryRecord { personFields.add(new RecordField("name", RecordFieldType.STRING.getDataType())); personFields.add(new RecordField("age", RecordFieldType.INT.getDataType())); personFields.add(new RecordField("title", RecordFieldType.STRING.getDataType())); + personFields.add(new RecordField("jobLevel", RecordFieldType.ENUM.getDataType())); personFields.add(new RecordField("height", RecordFieldType.CHOICE.getChoiceDataType(RecordFieldType.DOUBLE.getDataType(), RecordFieldType.INT.getDataType()))); personFields.add(new RecordField("addresses", RecordFieldType.ARRAY.getArrayDataType( RecordFieldType.RECORD.getRecordDataType(addressSchema)) )); final RecordSchema personSchema = new SimpleRecordSchema(personFields); @@ -844,6 +847,7 @@ public class TestQueryRecord { map.put("age", 30); map.put("height", 60.5); map.put("title", "Software Engineer"); + map.put("jobLevel", JobLevel.IC2); map.put("addresses", new Record[] {homeAddress, workAddress}); return new MapRecord(personSchema, map); } @@ -1281,4 +1285,10 @@ public class TestQueryRecord { } + public enum JobLevel { + IC1, + IC2, + IC3 + } + }