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

DataException: Invalid type for INT64: class java.lang.Integer on connect.default for int64 Avro type #1740

Closed
drnushooz opened this issue Aug 3, 2021 · 12 comments · Fixed by #1738

Comments

@drnushooz
Copy link
Contributor

drnushooz commented Aug 3, 2021

There is an issue with Avro 1.9+ where if a field of type long has connect.default property, e.g.

"type": "record"
"name": "sample"
"namespace": "io.apicurio",
"fields": [
  {
    "name": "prop",
    "type": {
      "type": "long",
      "connect.default": 42,
      "connect.version": 1
    }
  }
]

then AvroData.toConnectSchema throws

org.apache.kafka.connect.errors.DataException: Invalid type for INT64: class java.lang.Integer
	at io.apicurio.registry.utils.converter.avro.AvroData.toConnectData(AvroData.java:1498)
	at io.apicurio.registry.utils.converter.avro.AvroData.toConnectData(AvroData.java:1230)
	at io.apicurio.registry.utils.converter.avro.AvroData.toConnectData(AvroData.java:1478)
	at io.apicurio.registry.utils.converter.avro.AvroData.toConnectData(AvroData.java:1230)
	at io.apicurio.registry.utils.converter.avro.AvroData.toConnectData(AvroData.java:1226)
	at io.apicurio.registry.utils.converter.avro.AvroData.toConnectData(AvroData.java:1205)
	at com.github.drnushooz.kafka.connect.sqs.source.SqsSourceTask.lambda$poll$0(SqsSourceTask.java:138)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
	at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1655)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
	at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578)
	at com.github.drnushooz.kafka.connect.sqs.source.SqsSourceTask.poll(SqsSourceTask.java:149)
	at org.apache.kafka.connect.runtime.WorkerSourceTask.poll(WorkerSourceTask.java:265)
	at org.apache.kafka.connect.runtime.WorkerSourceTask.execute(WorkerSourceTask.java:232)
	at org.apache.kafka.connect.runtime.WorkerTask.doRun(WorkerTask.java:177)
	at org.apache.kafka.connect.runtime.WorkerTask.run(WorkerTask.java:227)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:829)
@drnushooz drnushooz changed the title org.apache.kafka.connect.errors.DataException: Invalid type for INT64: class java.lang.Integer DataException: Invalid type for INT64: class java.lang.Integer on connect.default for int64 Avro type Aug 3, 2021
@drnushooz
Copy link
Contributor Author

@EricWittmann would it be possible to triage this and get it prioritized? This is hindering some functionality on our side.

@carlesarnal
Copy link
Member

carlesarnal commented Aug 6, 2021

Hi @drnushooz, Eric is on PTO, I'll take a look at the linked PR.

@drnushooz
Copy link
Contributor Author

Hi @drnushooz, Eric is on PTO, I'll take a look at the linked PR.

Thank you.

@drnushooz
Copy link
Contributor Author

Hi @drnushooz, Eric is on PTO, I'll take a look at the linked PR.

Is there a tentative schedule for the next maintenance release?

@EricWittmann
Copy link
Member

Our next upstream release will be 2.1.0. We'll be able to release that soon. Perhaps as early as Friday of this week.

@EricWittmann
Copy link
Member

Didn't get a chance to plan and execute the release today - I am optimistic it can be done Monday.

@EricWittmann
Copy link
Member

OK we've done a release of 2.1.0.RC1 - this is a release candidate. We would very much appreciate it if interested parties could give it a try and give us your feedback.

@drnushooz
Copy link
Contributor Author

drnushooz commented Aug 25, 2021

Thanks, I will pull this release into our dev environment and test it.

@EricWittmann
Copy link
Member

I will be very interested in your experience, since this is a minor release with some non-trivial changes. Nothing should be breaking, but we may have messed up somewhere along the way. Please report back with any issues and we'll get them fixed before 2.1.0.Final.

@HelloSunilSaini
Copy link

HelloSunilSaini commented Dec 6, 2022

@EricWittmann @drnushooz
Sill facing this issue have deployed docker image apicurio/apicurio-registry-mem:2.3.1.Final and using io.apicurio.apicurio-registry-distro-connect-converter 2.0.0-SNAPSHOT in kafka-connect sink connector getting error for below field details

"fields": [
            {
              "name": "id",
              "type": {
                "type": "long",
                "connect.default": 0
              },
              "default": 0
            },

ERROR:

 Caused by: org.apache.kafka.connect.errors.DataException: Invalid type for INT64: class java.lang.Integer
 	at io.apicurio.registry.utils.converter.avro.AvroData.toConnectData(AvroData.java:1496)
 	at io.apicurio.registry.utils.converter.avro.AvroData.defaultValueFromAvroWithoutLogical(AvroData.java:1877)
 	at io.apicurio.registry.utils.converter.avro.AvroData.defaultValueFromAvro(AvroData.java:1860)
 	at io.apicurio.registry.utils.converter.avro.AvroData.toConnectSchema(AvroData.java:1793)
 	at io.apicurio.registry.utils.converter.avro.AvroData.toConnectSchema(AvroData.java:1547)
 	at io.apicurio.registry.utils.converter.avro.AvroData.toConnectSchemaWithCycles(AvroData.java:1843)
 	at io.apicurio.registry.utils.converter.avro.AvroData.toConnectSchema(AvroData.java:1691)
 	at io.apicurio.registry.utils.converter.avro.AvroData.toConnectSchema(AvroData.java:1547)
 	at io.apicurio.registry.utils.converter.avro.AvroData.toConnectSchema(AvroData.java:1667)
 	at io.apicurio.registry.utils.converter.avro.AvroData.toConnectSchema(AvroData.java:1547)
 	at io.apicurio.registry.utils.converter.avro.AvroData.toConnectSchemaWithCycles(AvroData.java:1843)
 	at io.apicurio.registry.utils.converter.avro.AvroData.toConnectSchema(AvroData.java:1691)
 	at io.apicurio.registry.utils.converter.avro.AvroData.toConnectSchema(AvroData.java:1547)
 	at io.apicurio.registry.utils.converter.avro.AvroData.toConnectSchema(AvroData.java:1667)
 	at io.apicurio.registry.utils.converter.avro.AvroData.toConnectSchema(AvroData.java:1523)
 	at io.apicurio.registry.utils.converter.avro.AvroData.toConnectData(AvroData.java:1223)
 	at io.apicurio.registry.utils.converter.AvroConverter.toSchemaAndValue(AvroConverter.java:84)
 	at io.apicurio.registry.utils.converter.SchemalessConverter.toConnectData(SchemalessConverter.java:122)
 	at org.apache.kafka.connect.storage.Converter.toConnectData(Converter.java:87)
 	at org.apache.kafka.connect.runtime.WorkerSinkTask.lambda$convertAndTransformRecord$4(WorkerSinkTask.java:516)
 	at org.apache.kafka.connect.runtime.errors.RetryWithToleranceOperator.execAndRetry(RetryWithToleranceOperator.java:156)
 	at org.apache.kafka.connect.runtime.errors.RetryWithToleranceOperator.execAndHandleError(RetryWithToleranceOperator.java:190)
 	... 13 more

@carlesarnal
Copy link
Member

That

@EricWittmann @drnushooz Sill facing this issue have deployed docker image apicurio/apicurio-registry-mem:2.3.1.Final and using io.apicurio.apicurio-registry-distro-connect-converter 2.0.0-SNAPSHOT in kafka-connect sink connector getting error for below field details

"fields": [
            {
              "name": "id",
              "type": {
                "type": "long",
                "connect.default": 0
              },
              "default": 0
            },

ERROR:

 Caused by: org.apache.kafka.connect.errors.DataException: Invalid type for INT64: class java.lang.Integer
 	at io.apicurio.registry.utils.converter.avro.AvroData.toConnectData(AvroData.java:1496)
 	at io.apicurio.registry.utils.converter.avro.AvroData.defaultValueFromAvroWithoutLogical(AvroData.java:1877)
 	at io.apicurio.registry.utils.converter.avro.AvroData.defaultValueFromAvro(AvroData.java:1860)
 	at io.apicurio.registry.utils.converter.avro.AvroData.toConnectSchema(AvroData.java:1793)
 	at io.apicurio.registry.utils.converter.avro.AvroData.toConnectSchema(AvroData.java:1547)
 	at io.apicurio.registry.utils.converter.avro.AvroData.toConnectSchemaWithCycles(AvroData.java:1843)
 	at io.apicurio.registry.utils.converter.avro.AvroData.toConnectSchema(AvroData.java:1691)
 	at io.apicurio.registry.utils.converter.avro.AvroData.toConnectSchema(AvroData.java:1547)
 	at io.apicurio.registry.utils.converter.avro.AvroData.toConnectSchema(AvroData.java:1667)
 	at io.apicurio.registry.utils.converter.avro.AvroData.toConnectSchema(AvroData.java:1547)
 	at io.apicurio.registry.utils.converter.avro.AvroData.toConnectSchemaWithCycles(AvroData.java:1843)
 	at io.apicurio.registry.utils.converter.avro.AvroData.toConnectSchema(AvroData.java:1691)
 	at io.apicurio.registry.utils.converter.avro.AvroData.toConnectSchema(AvroData.java:1547)
 	at io.apicurio.registry.utils.converter.avro.AvroData.toConnectSchema(AvroData.java:1667)
 	at io.apicurio.registry.utils.converter.avro.AvroData.toConnectSchema(AvroData.java:1523)
 	at io.apicurio.registry.utils.converter.avro.AvroData.toConnectData(AvroData.java:1223)
 	at io.apicurio.registry.utils.converter.AvroConverter.toSchemaAndValue(AvroConverter.java:84)
 	at io.apicurio.registry.utils.converter.SchemalessConverter.toConnectData(SchemalessConverter.java:122)
 	at org.apache.kafka.connect.storage.Converter.toConnectData(Converter.java:87)
 	at org.apache.kafka.connect.runtime.WorkerSinkTask.lambda$convertAndTransformRecord$4(WorkerSinkTask.java:516)
 	at org.apache.kafka.connect.runtime.errors.RetryWithToleranceOperator.execAndRetry(RetryWithToleranceOperator.java:156)
 	at org.apache.kafka.connect.runtime.errors.RetryWithToleranceOperator.execAndHandleError(RetryWithToleranceOperator.java:190)
 	... 13 more

This is expected. You're using a converters version without the fix. You need to update from 2.0.0-SNAPSHOT to, at least, 2.1.0.Final.

@drnushooz
Copy link
Contributor Author

drnushooz commented Dec 8, 2022

@HelloSunilSaini you can find the latest version of the connector on Maven Central https://mvnrepository.com/artifact/io.apicurio/apicurio-registry-distro-connect-converter/2.3.1.Final

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

Successfully merging a pull request may close this issue.

4 participants