Hitachi Vantara Pentaho Community Forums
Results 1 to 2 of 2

Thread: writing uuid and timeuuid values to Cassandra

  1. #1
    Join Date
    Apr 2014

    Default writing uuid and timeuuid values to Cassandra

    I’ve been trying to use the pentaho-cassandra-plugin, and for the life of me I can’t figure out how to make it write uuid or timeuuid fields to Cassandra. I’ve put in some row level logging to the plugin and found that since you have to send uuid fields to the plugin as Strings, that it will wrap them in single quotes before attempting the CQL. Cassandra then treats them as strings instead of uuids and fails on the insert.

    Similarly, the Cassandra docs ( state: "Timeuuid types can be entered as integers for CQL input". However, when I try to use an integer to insert into a timeuuid field, Cassandra barfs.

    I see that Pentaho doesn’t have a UUID type available in the ValueMetaInterface, so perhaps the proper solution is to introduce a type there. That seems like it might be a big job.

    I'm using the latest version of Cassandra as of this post (2014-04-04) and I am building the Pentaho Cassandra plugin from source. I am using the CQL3 option.

    I have made one modification to the plugin such that it will treat the Cassandra "TimestampType" as it does other dates.

  2. #2
    Join Date
    Apr 2014

    Lightbulb Possible Solution

    After playing with the code some more, I think that lacking an additional data type in Pentaho for UUID, the thing to do would be to add an option to the Cassandra Output step to specify "Check Strings for UUID" and then have code in CassandraUtils - kettleValueToCQL check the setting and then attempt to covert the string to a UUID, and then return the unquoted string or the quoted string depending on success/failure. For example:

    if(checkStringsForUUID) {
        try {
            // test to see if this string appears to be a UUID and if so, treat it as one and do not quote
            return cassandraString;
        } catch (IllegalArgumentException iae) {
            return "'" + escapeSingleQuotes(cassandraString) + "'"; //$NON-NLS-1$ //$NON-NLS-2$
    return "'" + escapeSingleQuotes(cassandraString) + "'"; //$NON-NLS-1$ //$NON-NLS-2$
    I have added the straight try/catch to my local build and this works as expected.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.