You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Nandor Kollar (JIRA)" <ji...@apache.org> on 2017/10/17 15:11:00 UTC
[jira] [Commented] (AVRO-2074) SchemaValidator can't cope with
recursive schemas?
[ https://issues.apache.org/jira/browse/AVRO-2074?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16207753#comment-16207753 ]
Nandor Kollar commented on AVRO-2074:
-------------------------------------
[~zkobza] are you sure that it is a regression, and works fine in Avro 1.8.1? I checked out {{release-1.8.1}} tag from Avro Github repository, and this test case failed:
{code}
@Test
public void testRecursiveSchema() throws SchemaValidationException {
Schema record = Schema.createRecord("List", null, null, false);
record.setFields(asList(new Schema.Field("head", Schema.create(Schema.Type.INT), null, null),
new Schema.Field("tail", record, null, null)));
new SchemaValidatorBuilder().canReadStrategy().validateAll().validate(record, asList(record));
}
{code}
It failed on {{master}}, and on {{release-1.8.0}} release tag too. Could you please tell me how did you verify that it is okay on Avro 1.8.1?
> SchemaValidator can't cope with recursive schemas?
> --------------------------------------------------
>
> Key: AVRO-2074
> URL: https://issues.apache.org/jira/browse/AVRO-2074
> Project: Avro
> Issue Type: Bug
> Components: java
> Reporter: Nandor Kollar
>
> When trying to validate a record which is recursively defined:
> {code}
> Schema record = Schema.createRecord("List", null, null, false);
> record.setFields(list(new Schema.Field("head", Schema.create(Schema.Type.INT), null, null),
> new Schema.Field("tail", record, null, null)));
> {code}
> then schema validation
> {code}
> new SchemaValidatorBuilder().canReadStrategy().validateAll().validate(record, asList(record));
> {code}
> fails with StackOverflowError:
> {code}
> java.lang.StackOverflowError
> at org.apache.avro.io.parsing.Symbol$Sequence.flattenedSize(Symbol.java:337)
> at org.apache.avro.io.parsing.Symbol.flattenedSize(Symbol.java:230)
> at org.apache.avro.io.parsing.Symbol$Sequence.flattenedSize(Symbol.java:337)
> {code}
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)