AntiBit82 opened a new issue, #19986: URL: https://github.com/apache/pulsar/issues/19986
### Search before asking - [X] I searched in the [issues](https://github.com/apache/pulsar/issues) and found nothing similar. ### Version Pulsar 2.11 JDBC Sink Connecrtor 2.11 OS: MacOS Ventura ### Minimal reproduce step Simple class Customer: `public class Customer { private int id; private String name; private String address; private int age; public Customer() {} public Customer(int id, String name, String address, int age) { this.id = id; this.name = name; this.address = address; this.age = age; } //getters/setters/toString, etc. } ` I have a Postgres DB running with resp. customer table. In Pulsar standalone I create a JDBC PostgreSQL sink: `bin/pulsar-admin sinks create --sink-config-file conf/sinkcustomer.yaml` Here's the config: `tenant: "mynamespace" namespace: "test" name: "customer-sink" inputs: [ "persistent://mynamespace/test/customer" ] key: "id" nonKey: "name,address,age" sinkType: "jdbc-postgres" configs: userName: "postgres" password: "postgres" jdbcUrl: "jdbc:postgresql://localhost:5432/postgres" tableName: "customer"` Now produce some events: ` Producer<Customer> pc = ... pc.newMessage(Schema.AVRO(Customer.class)).value(new Customer(1,"XXX","Snowy Mountain 1",40)).send(); pc.newMessage(Schema.AVRO(Customer.class)).value(new Customer(1, "YYY", "Sunny Greek Beach", 40)) .property("ACTION","DELETE").send(); // You could also use "UPDATE", same problem will appear ` First insert of the customer works fine. Second delete / update throws NPE. ### What did you expect to see? Expect the customer to be updated or deleted ### What did you see instead? `[pool-5-thread-1] ERROR org.apache.pulsar.io.jdbc.JdbcAbstractSink - Got exception java.lang.NullPointerException: Cannot invoke "java.sql.PreparedStatement.execute()" because "this.deleteStatement" is null at org.apache.pulsar.io.jdbc.JdbcAbstractSink.flush(JdbcAbstractSink.java:241) ~[pulsar-io-jdbc-core-2.11.0.jar:?] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) ~[?:?] at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305) ~[?:?] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305) ~[?:?] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[?:?] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[?:?] at java.lang.Thread.run(Thread.java:833) ~[?:?] ` or same message with 'this.updateStatement is null' ### Anything else? _No response_ ### Are you willing to submit a PR? - [ ] I'm willing to submit a PR! -- 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. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
