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

bit varying column has value that is too large to be cast to a long

    Details

    • Steps to Reproduce:
      Hide

      1. create postgres table with a column with type 'bit varying'
      2. insert row where value for column with type 'bit varying' is '10000000000000000000001111100101000101000000000010000000000000001000000001110011'
      3. add table to debezium whitelist
      4. update row

      Show
      1. create postgres table with a column with type 'bit varying' 2. insert row where value for column with type 'bit varying' is '10000000000000000000001111100101000101000000000010000000000000001000000001110011' 3. add table to debezium whitelist 4. update row

      Description

      we have a column that is of type bit varying.
      one of the values in this column is : 10000000000000000000001111100101000101000000000010000000000000001000000001110011

      the decimal value is 604,463,190,459,858,747,949,171 which is > Long.MAX_VALUE

      this causes a java.lang.NumberFormatException when trying to execute the following code from io.debezium.connector.postgresql.PostgresValueConverter.convertBits :

      long longValue = Long.parseLong((String) data, 2);
      

      the full stack trace from debezium is :

      java.lang.NumberFormatException: For input string: "10000000000000000000001111100101000101000000000010000000000000001000000001110011"
      	at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
      	at java.base/java.lang.Long.parseLong(Long.java:692)
      	at io.debezium.connector.postgresql.PostgresValueConverter.convertBits(PostgresValueConverter.java:635)
      	at io.debezium.jdbc.JdbcValueConverters.lambda$convertBits$23(JdbcValueConverters.java:359)
      	at io.debezium.relational.TableSchemaBuilder.lambda$createValueGenerator$5(TableSchemaBuilder.java:262)
      	at io.debezium.relational.TableSchema.valueFromColumnData(TableSchema.java:143)
      	at io.debezium.relational.RelationalChangeRecordEmitter.emitUpdateRecord(RelationalChangeRecordEmitter.java:96)
      	at io.debezium.relational.RelationalChangeRecordEmitter.emitChangeRecords(RelationalChangeRecordEmitter.java:49)
      	at io.debezium.connector.postgresql.PostgresChangeRecordEmitter.emitChangeRecords(PostgresChangeRecordEmitter.java:88)
      	at io.debezium.pipeline.EventDispatcher.dispatchDataChangeEvent(EventDispatcher.java:149)
      	at io.debezium.connector.postgresql.PostgresStreamingChangeEventSource.lambda$execute$0(PostgresStreamingChangeEventSource.java:137)
      	at io.debezium.connector.postgresql.connection.pgproto.PgProtoMessageDecoder.processMessage(PgProtoMessageDecoder.java:66)
      	at io.debezium.connector.postgresql.connection.PostgresReplicationConnection$1.deserializeMessages(PostgresReplicationConnection.java:421)
      	at io.debezium.connector.postgresql.connection.PostgresReplicationConnection$1.readPending(PostgresReplicationConnection.java:414)
      	at io.debezium.connector.postgresql.PostgresStreamingChangeEventSource.execute(PostgresStreamingChangeEventSource.java:121)
      	at io.debezium.pipeline.ChangeEventSourceCoordinator.lambda$start$0(ChangeEventSourceCoordinator.java:99)
      	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)
      

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                dajerome David Jerome
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: