Details
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