NullPointerException in Kafka Connect
See original GitHub issueEnvironment
- OS version: Centos 7.5
- JDK version: AdoptOpenJDK 11.0.4
- ClickHouse Server version:
21.5.5.12
- ClickHouse Native JDBC version:
2.5.5-shaded
- (Optional) Spark version: N/A
- (Optional) Other components’ version: kafkaconnect version
6.1.1-2.12
Error logs
org.apache.kafka.connect.errors.ConnectException: Exiting WorkerSinkTask due to unrecoverable exception.
at org.apache.kafka.connect.runtime.WorkerSinkTask.deliverMessages(WorkerSinkTask.java:614)
at org.apache.kafka.connect.runtime.WorkerSinkTask.poll(WorkerSinkTask.java:329)
at org.apache.kafka.connect.runtime.WorkerSinkTask.iteration(WorkerSinkTask.java:232)
at org.apache.kafka.connect.runtime.WorkerSinkTask.execute(WorkerSinkTask.java:201)
at org.apache.kafka.connect.runtime.WorkerTask.doRun(WorkerTask.java:189)
at org.apache.kafka.connect.runtime.WorkerTask.run(WorkerTask.java:238)
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:834)
Caused by: java.lang.NullPointerException
at com.github.housepower.jdbc.data.type.DataTypeInt64.serializeBinary(DataTypeInt64.java:77)
at com.github.housepower.jdbc.data.Column.write(Column.java:31)
at com.github.housepower.jdbc.data.Block.appendRow(Block.java:93)
at com.github.housepower.jdbc.statement.ClickHousePreparedInsertStatement.addParameters(ClickHousePreparedInsertStatement.java:162)
at com.github.housepower.jdbc.statement.ClickHousePreparedInsertStatement.addBatch(ClickHousePreparedInsertStatement.java:95)
at io.confluent.connect.jdbc.sink.PreparedStatementBinder.bindRecord(PreparedStatementBinder.java:115)
at io.confluent.connect.jdbc.sink.BufferedRecords.flush(BufferedRecords.java:184)
at io.confluent.connect.jdbc.sink.JdbcDbWriter.write(JdbcDbWriter.java:80)
at io.confluent.connect.jdbc.sink.JdbcSinkTask.put(JdbcSinkTask.java:84)
at org.apache.kafka.connect.runtime.WorkerSinkTask.deliverMessages(WorkerSinkTask.java:586)
... 10 more
Steps to reproduce
The message contains types (as per CH types): String, UInt64, Float64, DateTime. Some columns can be NULL, as is defined in CH schema, but looks like there is some NPE happens inside the driver when kafka message field is actually null
.
Other descriptions
The same ingest works with official HTTP protocol driver, but would prefer to use this one as it works better in throughput and resource usage.
Issue Analytics
- State:
- Created 2 years ago
- Comments:16 (16 by maintainers)
Top Results From Across the Web
Nullpointer exception when creating Kafka sink connector
Hi,. I am getting null pointer exception when creating a Kafka Sink Connector. Below are the details. Can anyone help me what's missing...
Read more >NullPointerException in Kafka-Connect service logs on start of ...
I deployed my custom connector in kafka-connect and registered using following ... NullPointerException at org.apache.kafka.connect.storage.
Read more >Kafka connect task failed with NullPointer Exception · Issue #462
The connector just uses HDFS Java API to communicate with the HDFS cluster. If there is difference between hdfs client being able to...
Read more >Kafka mapping fails with java.lang.NullPointerException in ...
This error occurs due to missing Kafka broker version at the Kafka connection. Solution.
Read more >Kafka Connect Header Null Pointer Exception - Apache
I am trying to use the newly released Kafka Connect that supports headers by using the standalone connector to write to a text...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Yes, while it is clearer now and I can ingest the data into clickhouse, one thing could be improved on this driver side is to have a better error handling for this case.
The error here is very generic and does not point in the right direction. The point of having error messages at all is to make it clear what happened and possibly point to correct solution.
I suggest to:
received NULL value for NOT NULL column
or something similar, maybe even include column name in the message if possible).This will allow users to handle those issues in much cleaner way (and not bothering you with these issues regularly as it seems from issues history for this type of issue).
Yes, ClickHouse use
String
to representVARCHAR NOT NULL
in most ANSI compatible database, andNullable(String)
to representVARCHAR NULL
. BTW, it’s by design that throw exception when insertnull
to a not null column, I will close this issue, and feel free to reopen or open new issues if you encounter other questions.