tpalfy commented on a change in pull request #3796: WIP: NIFI-6752 Add ASN.1
RecordReader
URL: https://github.com/apache/nifi/pull/3796#discussion_r337127898
##########
File path:
nifi-commons/nifi-record/src/main/java/org/apache/nifi/serialization/record/type/RecordDataType.java
##########
@@ -22,13 +22,22 @@
import org.apache.nifi.serialization.record.RecordSchema;
import java.util.Objects;
+import java.util.function.Supplier;
public class RecordDataType extends DataType {
Review comment:
If I understand correctly this change is basically needed to be able to
handle recursive schemas.
With that comes the issue of how to check equality of two record schemas
that have recursive child schemas.
This could lead to a StackOverflowError.
To mitigate this, i'd change `equals` to this:
```java
...
return childSchema == other.childSchema || Objects.equals(childSchema,
other.childSchema);
```
The logic behind is that - at least in this case - the schema is coming from
a cache so if the 2 schema objects are identical we can stop recursively
calling into `equals`.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services