Uploaded image for project: 'Pentaho Data Integration - Kettle'
  1. Pentaho Data Integration - Kettle
  2. PDI-19043

Error "UUID should be 16 or 0 bytes (36)" when trying to insert UUID into Cassandra database

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Severity: High
    • Resolution: Unresolved
    • Affects Version/s: 8.3.0 GA, 9.0.0 GA, 9.1.0 GA
    • Fix Version/s: Backlog
    • Component/s: Step
    • Labels:
      None
    • Story Points:
      0
    • Notice:
      When an issue is open, the "Fix Version/s" field conveys a target, not necessarily a commitment. When an issue is closed, the "Fix Version/s" field conveys the version that the issue was fixed in.
    • Steps to Reproduce:
      Hide

      1.) Install Cassandra
      2.) Install Pentaho Spoon 8.3/9.0/9.1
      3.) Create a keyspace in Cassandra cqlsh utility using the command

      CREATE KEYSPACE pentaho WITH replication = \{'class':'SimpleStrategy', 'replication_factor' : 3};
      

      4.) Use the newly created keyspace using the command use pentaho
      5.) Create the table by running the script as below:

       CREATE TABLE test_uuid (
       id uuid,
       name text,
       PRIMARY KEY (id)
       ) WITH
       comment=''
       AND read_repair_chance=0
       AND dclocal_read_repair_chance=0.1
       AND gc_grace_seconds=864000
       AND bloom_filter_fp_chance=0.01
       AND compaction=\{ 'class':'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy', 'max_threshold':'32', 'min_threshold':'4' }
       AND compression=\{ 'chunk_length_in_kb':'64', 'class':'org.apache.cassandra.io.compress.LZ4Compressor' }
       AND caching=\{ 'keys':'ALL', 'rows_per_partition':'NONE' }
       AND default_time_to_live=0
       AND id='09e87510-27e7-11eb-9029-9b89c16b65a4'
       AND min_index_interval=128
       AND max_index_interval=2048
       AND memtable_flush_period_in_ms=0
       AND speculative_retry='99PERCENTILE';
      

      6.) Open the attached transformation in the spoon and make the necessary changes to your Cassandra connection and execute.

      Show
      1.) Install Cassandra 2.) Install Pentaho Spoon 8.3/9.0/9.1 3.) Create a keyspace in Cassandra  cqlsh  utility using the command CREATE KEYSPACE pentaho WITH replication = \{'class':'SimpleStrategy', 'replication_factor' : 3}; 4.) Use the newly created keyspace using the command  use pentaho 5.) Create the table by running the script as below: CREATE TABLE test_uuid ( id uuid, name text, PRIMARY KEY (id) ) WITH comment='' AND read_repair_chance=0 AND dclocal_read_repair_chance=0.1 AND gc_grace_seconds=864000 AND bloom_filter_fp_chance=0.01 AND compaction=\{ 'class':'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy', 'max_threshold':'32', 'min_threshold':'4' } AND compression=\{ 'chunk_length_in_kb':'64', 'class':'org.apache.cassandra.io.compress.LZ4Compressor' } AND caching=\{ 'keys':'ALL', 'rows_per_partition':'NONE' } AND default_time_to_live=0 AND id='09e87510-27e7-11eb-9029-9b89c16b65a4' AND min_index_interval=128 AND max_index_interval=2048 AND memtable_flush_period_in_ms=0 AND speculative_retry='99PERCENTILE'; 6.) Open the attached transformation in the spoon and make the necessary changes to your Cassandra connection and execute.

      Description

      When trying to insert UUID data into the Cassandra table we are getting the below error.

      2020/12/08 18:06:55 - Cassandra output.0 - Using connection options: driverVersion=3.4.0 batchTimeout=0
      2020/12/08 18:06:55 - Cassandra output.0 - ERROR (version 9.1.0.0-324, build 9.1.0.0-324 from 2020-09-07 05.09.05 by buildguy) : UUID should be 16 or 0 bytes (36)
      2020/12/08 18:06:55 - Cassandra output.0 - ERROR (version 9.1.0.0-324, build 9.1.0.0-324 from 2020-09-07 05.09.05 by buildguy) : com.datastax.driver.core.exceptions.InvalidQueryException: UUID should be 16 or 0 bytes (36)
      2020/12/08 18:06:55 - Cassandra output.0 - 	at com.datastax.driver.core.exceptions.InvalidQueryException.copy(InvalidQueryException.java:50)
      2020/12/08 18:06:55 - Cassandra output.0 - 	at com.datastax.driver.core.DriverThrowables.propagateCause(DriverThrowables.java:37)
      

      I referred to the Cassandra documentation and we can insert both uuid and timeuuid data
      https://docs.datastax.com/en/dse/5.1/cql/cql/cql_using/refTimeUuidFunctions.html

      I tried to use the utility *cqlsh *and trying to insert the record manually then it works as expected. Sample script is as below

      CREATE TABLE sample_times_1 (a int, b timestamp, c uuid, d bigint, PRIMARY KEY (a,b,c,d));
      INSERT INTO sample_times (a,b,c,d) VALUES (1, toUnixTimestamp(now()), 702a4ff5-3950-11eb-bc82-bde4065401c6, toTimestamp(now()));
      

      Attaching the sample transformation gen_UUID.ktr and log cassandra_error_log.txt

        Attachments

        1. Capture-34.JPG
          Capture-34.JPG
          70 kB
        2. cassandra_error_log.txt
          9 kB
        3. gen_UUID.ktr
          148 kB

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            gdev Gurudev
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated: