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

Replace simple string for range tombstones for JSON object

XMLWordPrintable

      A user reported that when he has this table

      CREATE TABLE ks.tb (
          s text,
          sp int,
          d text,
          dp int,
          t timestamp,
          m map<text, text>,
          PRIMARY KEY (s, sp, d, dp)
      ) WITH CLUSTERING ORDER BY (sp ASC, d ASC, dp ASC)
      

      and he does this CQL:

      DELETE FROM ks.tb WHERE s = '1,33619828888' and sp = 1 and d = '12, 23, toto' and dp > 1;
      

      It will result in this record:

      "after": {
          "s": {
          "value": "1,33619828888",
          "deletion_ts": null,
          "set": true
          },
          "sp": null,
          "d": null,
          "dp": null,
          "m": null,
          "t": null,
          "_range_start": "EXCL_START_BOUND(1, 12, 23, toto, 1)",
          "_range_end": "INCL_END_BOUND(1, 12, 23, toto)"
      }
      

      This is quite unfortunate to parse on consumer level because consumer does not know what to actually parse as values because there are commas in value and commas are separating the values themselves.

      The solution is to do this:

      "after": {
          "s": {
              "value": "1,33619828888",
              "deletion_ts": null,
              "set": true
          },
          "sp": null,
          "d": null,
          "dp": null,
          "m": null,
          "t": null,
          "_range_start": {
              "method": "EXCL_START_BOUND",
              "values": {
                  "sp": "1",
                  "d": "12, 23, toto",
                  "dp": "1"
              }
          },
         "_range_end": {
              "method": "INCL_END_BOUND",
              "values": {
                  "sp": "1",
                  "d": "12, 23, toto"
              }
          }
      }
      

            Unassigned Unassigned
            smiklosovic Stefan Miklosovic (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: