Uploaded image for project: 'Debezium'
  1. Debezium
  2. DBZ-606

Cannot Serialize NaN value(numeric field) in Postgres

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 0.7.4
    • None
    • postgresql-connector
    • None
    • Hide

      1. create a table with numeric column
      2. insert NaN value in that column
      3. take snapshot of that table

      Show
      1. create a table with numeric column 2. insert NaN value in that column 3. take snapshot of that table

      StackTrace-

      org.apache.kafka.connect.errors.ConnectException: org.postgresql.util.PSQLException: Bad value for type BigDecimal : NaN
      	at io.debezium.connector.postgresql.RecordsSnapshotProducer.lambda$takeSnapshot$7(RecordsSnapshotProducer.java:199)
      	at java.util.concurrent.ConcurrentHashMap$KeySpliterator.forEachRemaining(ConcurrentHashMap.java:3527)
      	at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:580)
      	at io.debezium.connector.postgresql.RecordsSnapshotProducer.takeSnapshot(RecordsSnapshotProducer.java:180)
      	at io.debezium.connector.postgresql.RecordsSnapshotProducer.lambda$start$1(RecordsSnapshotProducer.java:80)
      	at java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1626)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
      	at java.lang.Thread.run(Thread.java:748)
      Caused by: org.postgresql.util.PSQLException: Bad value for type BigDecimal : NaN
      	at org.postgresql.jdbc.PgResultSet.toBigDecimal(PgResultSet.java:2875)
      	at org.postgresql.jdbc.PgResultSet.toBigDecimal(PgResultSet.java:2884)
      	at org.postgresql.jdbc.PgResultSet.getBigDecimal(PgResultSet.java:2373)
      	at org.postgresql.jdbc.PgResultSet.internalGetObject(PgResultSet.java:186)
      	at org.postgresql.jdbc.PgResultSet.getObject(PgResultSet.java:2588)
      	at io.debezium.connector.postgresql.RecordsSnapshotProducer.valueForColumn(RecordsSnapshotProducer.java:284)
      	at io.debezium.connector.postgresql.RecordsSnapshotProducer.readTable(RecordsSnapshotProducer.java:253)
      	at io.debezium.connector.postgresql.RecordsSnapshotProducer.lambda$null$6(RecordsSnapshotProducer.java:194)
      	at io.debezium.jdbc.JdbcConnection.query(JdbcConnection.java:389)
      	at io.debezium.connector.postgresql.RecordsSnapshotProducer.lambda$takeSnapshot$7(RecordsSnapshotProducer.java:192)
      

      Table Structure-

       id                     | bigint                      |           | not null | nextval('process_id_seq'::regclass)
       reference_number       | character varying(32)       |           | not null | 
       process_master_id      | integer                     |           | not null | 
       company_id             | integer                     |           | not null | 
       last_updated_at        | timestamp without time zone |           |          | 
       created_at             | timestamp without time zone |           | not null | 
       process_version_id     | integer                     |           |          | 
       current_flow_code      | character varying(256)      |           |          | 
       status                 | character varying(16)       |           |          | 
       current_hub_id         | integer                     |           |          | 
       merchant_code          | character varying(64)       |           |          | 
       current_position       | character varying(64)       |           |          | 
       amount_collect         | numeric                     |           |          | 
       amount_tobe_collected  | numeric                     |           |          | 
       process_start_date     | timestamp without time zone |           |          | 
       is_locked              | boolean                     |           | not null | false
       sub_process_grouped_by | character varying(256)      |           |          | 
       misroute_hub_id        | integer                     |           |          | 
      

      Data row due to which error occured –

      -[ RECORD 1 ]----------+------------------------
      id                     | 1630999
      reference_number       | qwer
      process_master_id      | 445
      company_id             | 698
      last_updated_at        | 2017-07-06 11:59:51.754
      created_at             | 2017-07-06 11:59:51.737
      process_version_id     | 8331
      current_flow_code      | item_pickup
      status                 | 
      current_hub_id         | 15447
      merchant_code          | qwe
      current_position       | PENDING
      amount_collect         | NaN
      amount_tobe_collected  | 2500
      process_start_date     | 2017-07-06 11:59:51.737
      is_locked              | f
      sub_process_grouped_by | 
      misroute_hub_id        | 
      

              jpechane Jiri Pechanec
              khushalvirmani Khushal Virmani (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: