Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failure when generating array of type long #27

Open
ikstewa opened this issue Sep 9, 2023 · 1 comment
Open

Failure when generating array of type long #27

ikstewa opened this issue Sep 9, 2023 · 1 comment

Comments

@ikstewa
Copy link

ikstewa commented Sep 9, 2023

When attempting to generate an array of type long using 'options' the generations fails with the following error:

java.lang.RuntimeException: Invalid option for array schema: type org.apache.avro.generic.GenericData$Array, value '[1, 2, 3]'
    at io.confluent.avro.random.generator.Generator.parseOptions(Generator.java:505)
    at io.confluent.avro.random.generator.Generator.generateOption(Generator.java:612)
    at io.confluent.avro.random.generator.Generator.generateObject(Generator.java:373)
    at io.confluent.avro.random.generator.Generator.generateRecord(Generator.java:1345)
    at io.confluent.avro.random.generator.Generator.generateObject(Generator.java:402)
    at io.confluent.avro.random.generator.Generator.generate(Generator.java:367)

Example schema:

{
  "namespace": "ksql",
  "name": "testobj",
  "type": "record",
  "fields": [
    {
      "name": "my_long_array",
      "type": {
        "type": "array",
        "items": "long",
        "arg.properties": {
          "options": [
            [ 1, 2, 3 ]
          ]
        }
      }
    }
  ]
}
@C0urante
Copy link

C0urante commented Sep 10, 2023

I think this is because wrapOption should be recursive for complex types but isn't right now. So, in this case, the values of the options array get parsed as a Java Collection<Integer>, which doesn't match the expected type for the schema (should be a Collection<Long>).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants