[GitHub] nifi pull request #2207: NIFI-4441 patch avro maps in union types
Github user frett27 commented on a diff in the pull request: https://github.com/apache/nifi/pull/2207#discussion_r145189535 --- Diff: nifi-nar-bundles/nifi-extension-utils/nifi-record-utils/nifi-avro-record-utils/src/test/java/org/apache/nifi/avro/TestAvroTypeUtil.java --- @@ -239,4 +243,20 @@ public void testComplicatedRecursiveSchema() { Assert.assertEquals(recordASchema, ((RecordDataType)recordBParentField.get().getDataType()).getChildSchema()); } +@Test +public void testMapWithNullSchema() throws IOException { + +Schema recursiveSchema = new Schema.Parser().parse(getClass().getResourceAsStream("schema.json")); + +// Make sure the following doesn't throw an exception +RecordSchema recordASchema = AvroTypeUtil.createSchema(recursiveSchema.getTypes().get(0)); + +// check the fix with the proper file +try(DataFileStream r = new DataFileStream<>(getClass().getResourceAsStream("data.avro"), --- End diff -- and if you also tests it , it's OK ---
[GitHub] nifi pull request #2207: NIFI-4441 patch avro maps in union types
Github user frett27 commented on a diff in the pull request: https://github.com/apache/nifi/pull/2207#discussion_r145189423 --- Diff: nifi-nar-bundles/nifi-extension-utils/nifi-record-utils/nifi-avro-record-utils/src/test/java/org/apache/nifi/avro/TestAvroTypeUtil.java --- @@ -239,4 +243,20 @@ public void testComplicatedRecursiveSchema() { Assert.assertEquals(recordASchema, ((RecordDataType)recordBParentField.get().getDataType()).getChildSchema()); } +@Test +public void testMapWithNullSchema() throws IOException { + +Schema recursiveSchema = new Schema.Parser().parse(getClass().getResourceAsStream("schema.json")); + +// Make sure the following doesn't throw an exception +RecordSchema recordASchema = AvroTypeUtil.createSchema(recursiveSchema.getTypes().get(0)); + +// check the fix with the proper file +try(DataFileStream r = new DataFileStream<>(getClass().getResourceAsStream("data.avro"), --- End diff -- OK let's change that to MapRecord, i'm sure it's reliable, because we use it on dev plateform, for the "instanceof Map" you suggest i'm not sure of the impact. ---
[GitHub] nifi pull request #2207: NIFI-4441 patch avro maps in union types
Github user frett27 commented on a diff in the pull request: https://github.com/apache/nifi/pull/2207#discussion_r145175950 --- Diff: nifi-nar-bundles/nifi-extension-utils/nifi-record-utils/nifi-avro-record-utils/src/main/java/org/apache/nifi/avro/AvroTypeUtil.java --- @@ -691,6 +697,10 @@ private static boolean isCompatibleDataType(final Object value, final DataType d return true; } break; +case MAP: +if (value instanceof Map) { --- End diff -- in debugging initially, the given value was MapRecord, ---
[GitHub] nifi pull request #2207: NIFI-4441 patch avro maps in union types
Github user frett27 commented on a diff in the pull request: https://github.com/apache/nifi/pull/2207#discussion_r145175558 --- Diff: nifi-nar-bundles/nifi-extension-utils/nifi-record-utils/nifi-avro-record-utils/src/test/java/org/apache/nifi/avro/TestAvroTypeUtil.java --- @@ -239,4 +243,20 @@ public void testComplicatedRecursiveSchema() { Assert.assertEquals(recordASchema, ((RecordDataType)recordBParentField.get().getDataType()).getChildSchema()); } +@Test +public void testMapWithNullSchema() throws IOException { + +Schema recursiveSchema = new Schema.Parser().parse(getClass().getResourceAsStream("schema.json")); + +// Make sure the following doesn't throw an exception +RecordSchema recordASchema = AvroTypeUtil.createSchema(recursiveSchema.getTypes().get(0)); + +// check the fix with the proper file +try(DataFileStream r = new DataFileStream<>(getClass().getResourceAsStream("data.avro"), --- End diff -- my uderstanding was that the map presence cause the issue in union type, whether or not, the map is filled, (instance of map will be returned) ---
[GitHub] nifi pull request #2207: NIFI-4441 patch avro maps in union types
Github user frett27 commented on a diff in the pull request: https://github.com/apache/nifi/pull/2207#discussion_r145175249 --- Diff: nifi-nar-bundles/nifi-extension-utils/nifi-record-utils/nifi-avro-record-utils/src/main/java/org/apache/nifi/avro/AvroTypeUtil.java --- @@ -691,6 +697,10 @@ private static boolean isCompatibleDataType(final Object value, final DataType d return true; } break; +case MAP: +if (value instanceof Map) { --- End diff -- The MapRecord was my initial post, you suggested to open to Map , type. the probleme was when the map is present in the union ("null", "record"). ---
[GitHub] nifi issue #2184: NIFI-4441 : add maprecord support for avro union types
Github user frett27 commented on the issue: https://github.com/apache/nifi/pull/2184 Thank's matt, new pull request associated : #2207, hope this will help the review ---
[GitHub] nifi pull request #2207: NIFI-4441 patch avro maps in union types
GitHub user frett27 opened a pull request: https://github.com/apache/nifi/pull/2207 NIFI-4441 patch avro maps in union types Thank you for submitting a contribution to Apache NiFi. In order to streamline the review of the contribution we ask you to ensure the following steps have been taken: ### For all changes: - [x ] Is there a JIRA ticket associated with this PR? Is it referenced in the commit message? - [x ] Does your PR title start with NIFI- where is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character. - [ x] Has your PR been rebased against the latest commit within the target branch (typically master)? - [x ] Is your initial contribution a single, squashed commit? ### For code changes: - [ x] Have you ensured that the full suite of tests is executed via mvn -Pcontrib-check clean install at the root nifi folder? - [x ] Have you written or updated unit tests to verify your changes? - [x ] If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under [ASF 2.0](http://www.apache.org/legal/resolved.html#category-a)? - [ ] If applicable, have you updated the LICENSE file, including the main LICENSE file under nifi-assembly? - [ ] If applicable, have you updated the NOTICE file, including the main NOTICE file found under nifi-assembly? - [x ] If adding new Properties, have you added .displayName in addition to .name (programmatic access) for each of the new properties? ### For documentation related changes: - [x ] Have you ensured that format looks appropriate for the output in which it is rendered? ### Note: Please ensure that once the PR is submitted, you check travis-ci for build issues and submit an update to your PR as soon as possible. You can merge this pull request into a Git repository by running: $ git pull https://github.com/frett27/nifi nifi-4441 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/nifi/pull/2207.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #2207 commit 30b3596ac351405ea33d09b9737cece257d8ff54 Author: Patrice Freydiere Date: 2017-10-11T20:17:15Z patch avro maps in union types ---
[GitHub] nifi pull request #2184: NIFI-4441 : add maprecord support for avro union ty...
Github user frett27 closed the pull request at: https://github.com/apache/nifi/pull/2184 ---
[GitHub] nifi pull request #2201: NIFI-4367 Fix on processor for permit deriving scri...
GitHub user frett27 opened a pull request: https://github.com/apache/nifi/pull/2201 NIFI-4367 Fix on processor for permit deriving script classes from Ab⦠â¦stractProcessor or other Records based base classes Thank you for submitting a contribution to Apache NiFi. In order to streamline the review of the contribution we ask you to ensure the following steps have been taken: ### For all changes: - [x] Is there a JIRA ticket associated with this PR? Is it referenced in the commit message? - [x] Does your PR title start with NIFI- where is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character. - [x] Has your PR been rebased against the latest commit within the target branch (typically master)? - [ ] Is your initial contribution a single, squashed commit? ### For code changes: - [x] Have you ensured that the full suite of tests is executed via mvn -Pcontrib-check clean install at the root nifi folder? - [x] Have you written or updated unit tests to verify your changes? - [x] If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under [ASF 2.0](http://www.apache.org/legal/resolved.html#category-a)? - [x] If applicable, have you updated the LICENSE file, including the main LICENSE file under nifi-assembly? - [x] If applicable, have you updated the NOTICE file, including the main NOTICE file found under nifi-assembly? - [x] If adding new Properties, have you added .displayName in addition to .name (programmatic access) for each of the new properties? ### For documentation related changes: - [ ] Have you ensured that format looks appropriate for the output in which it is rendered? ### Note: Please ensure that once the PR is submitted, you check travis-ci for build issues and submit an update to your PR as soon as possible. You can merge this pull request into a Git repository by running: $ git pull https://github.com/frett27/nifi nifi-4367 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/nifi/pull/2201.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #2201 commit 3eec6c7a022a2424accc5d84f425b8746719c2d0 Author: Patrice Freydiere Date: 2017-09-09T14:43:14Z NIFI-4367 Fix on processor for permit deriving script classes from AbstractProcessor or other Records based base classes ---
[GitHub] nifi issue #2184: NIFI-4441 : add maprecord support for avro union types
Github user frett27 commented on the issue: https://github.com/apache/nifi/pull/2184 Modified the test resource files to remove any projet references, fix style ---
[GitHub] nifi pull request #2184: NIFI-4441 : add maprecord support for avro union ty...
Github user frett27 commented on a diff in the pull request: https://github.com/apache/nifi/pull/2184#discussion_r142597985 --- Diff: nifi-nar-bundles/nifi-extension-utils/nifi-record-utils/nifi-avro-record-utils/src/main/java/org/apache/nifi/avro/AvroTypeUtil.java --- @@ -691,6 +697,10 @@ private static boolean isCompatibleDataType(final Object value, final DataType d return true; } break; +case MAP: +if (value instanceof MapRecord) { --- End diff -- OK, i'll have a dive on this ---
[GitHub] nifi pull request #2184: NIFI-4441 : add maprecord support for avro union ty...
Github user frett27 commented on a diff in the pull request: https://github.com/apache/nifi/pull/2184#discussion_r142597913 --- Diff: nifi-nar-bundles/nifi-extension-utils/nifi-record-utils/nifi-avro-record-utils/src/test/java/org/apache/nifi/avro/TestAvroTypeUtil.java --- @@ -238,5 +242,23 @@ public void testComplicatedRecursiveSchema() { // Make sure the 'parent' field has a schema reference back to the original top level record schema Assert.assertEquals(recordASchema, ((RecordDataType)recordBParentField.get().getDataType()).getChildSchema()); } + +@Test +public void testMapWithNullSchema() throws IOException { + +Schema recursiveSchema = new Schema.Parser().parse( + "{\"type\":\"record\",\"name\":\"OSMEntity\",\"namespace\":\"org.osm.avro\",\"fields\":[{\"name\":\"osmtype\",\"type\":{\"type\":\"enum\",\"name\":\"OSMType\",\"symbols\":[\"NODE\",\"WAY\",\"POLYGON\",\"RELATION\"]}},{\"name\":\"id\",\"type\":\"long\"},{\"name\":\"node\",\"type\":[\"null\",{\"type\":\"record\",\"name\":\"ANode\",\"fields\":[{\"name\":\"id\",\"type\":\"long\"},{\"name\":\"x\",\"type\":\"double\"},{\"name\":\"y\",\"type\":\"double\"},{\"name\":\"fields\",\"type\":[\"null\",{\"type\":\"map\",\"values\":{\"type\":\"string\",\"avro.java.string\":\"String\"},\"avro.java.string\":\"String\"}]}]}]},{\"name\":\"way\",\"type\":[\"null\",{\"type\":\"record\",\"name\":\"AComplex\",\"fields\":[{\"name\":\"id\",\"type\":\"long\"},{\"name\":\"geometry\",\"type\":\"bytes\"},{\"name\":\"fields\",\"type\":[\"null\",{\"type\":\"map\",\"values\":{\"type\":\"string\",\"avro.java.string\":\"String\"},\"avro.java.string\":\"String\"}]}]}]},{\"name\":\"polygon\",\"type\ ":[\"null\",\"AComplex\"]},{\"name\":\"rel\",\"type\":[\"null\",{\"type\":\"record\",\"name\":\"ARelation\",\"fields\":[{\"name\":\"id\",\"type\":\"long\"},{\"name\":\"fields\",\"type\":[\"null\",{\"type\":\"map\",\"values\":{\"type\":\"string\",\"avro.java.string\":\"String\"},\"avro.java.string\":\"String\"}]},{\"name\":\"related\",\"type\":[\"null\",{\"type\":\"array\",\"items\":{\"type\":\"record\",\"name\":\"ARelated\",\"fields\":[{\"name\":\"relatedId\",\"type\":\"long\"},{\"name\":\"type\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"role\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}}]}}]}]}]}]}" --- End diff -- OK ---
[GitHub] nifi issue #2184: NIFI-4441 : add maprecord support for avro union types
Github user frett27 commented on the issue: https://github.com/apache/nifi/pull/2184 Hi, markap14, the definition is mine for the tests, and yes on top of the osm definition, i think there is no license associated issue. And yes could be more interesting for have a separate file for ease the reading. ---
[GitHub] nifi pull request #2184: NIFI-4441 : add maprecord support for avro union ty...
GitHub user frett27 opened a pull request: https://github.com/apache/nifi/pull/2184 NIFI-4441 : add maprecord support for avro union types Thank you for submitting a contribution to Apache NiFi. In order to streamline the review of the contribution we ask you to ensure the following steps have been taken: ### For all changes: - [ x] Is there a JIRA ticket associated with this PR? Is it referenced in the commit message? - [x ] Does your PR title start with NIFI- where is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character. - [x ] Has your PR been rebased against the latest commit within the target branch (typically master)? - [x ] Is your initial contribution a single, squashed commit? ### For code changes: - [x ] Have you ensured that the full suite of tests is executed via mvn -Pcontrib-check clean install at the root nifi folder? - [ x] Have you written or updated unit tests to verify your changes? - [ x] If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under [ASF 2.0](http://www.apache.org/legal/resolved.html#category-a)? - [ x] If applicable, have you updated the LICENSE file, including the main LICENSE file under nifi-assembly? - [ x] If applicable, have you updated the NOTICE file, including the main NOTICE file found under nifi-assembly? - [ x] If adding new Properties, have you added .displayName in addition to .name (programmatic access) for each of the new properties? ### For documentation related changes: - [ ] Have you ensured that format looks appropriate for the output in which it is rendered? ### Note: Please ensure that once the PR is submitted, you check travis-ci for build issues and submit an update to your PR as soon as possible. You can merge this pull request into a Git repository by running: $ git pull https://github.com/frett27/nifi nifi-4441 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/nifi/pull/2184.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #2184 commit d72a1c7d219d1cc12b0e61cb9e0644a6555dcf3c Author: Patrice Freydiere Date: 2017-09-29T05:08:08Z NIFI 4441 : add maprecord support for avro union types ---