Skip to content

CQL Auto Type Conversion

Brad Vernon edited this page May 29, 2017 · 2 revisions

Overview

Included in Gatling DSE Plugin v1.0+ is the auto-conversion of Scala values that can be converted to either the CQL type or the needed Java type. Below are the conversions for each type supported.

Auto Scala to CQL Type Conversions

CQL Type Scala Types Accepted Examples Notes
ascii String "test"
bigint ▪ Long
▪ Int
▪ Number
▪ String
1493485797L
45
12.asInstanceOf[Number]
blob ▪ ByteBuffer
▪ Array[Byte]
▪ Byte
ByteBuffer.wrap(Array(12.toByte))
Array(12.toByte)
12.toByte
boolean ▪ Boolean
▪ String
▪ Int
true
"true"
1
counter ▪ Long
▪ Int
1L
1
date ▪ LocalDate
▪ Long
▪ Int
▪ String
new LocalDate(736813)
1483299340813L
12
"2016-10-05"
decimal ▪ Double
▪ Long
▪ BigDecimal
▪ String
12.0
12L
BigDecimal(1).bigDecimal
"1.01"
double ▪ Double
▪ Int
▪ String
14.12
12L
"12"
float ▪ Float
▪ Double
▪ Int
▪ String
12.1
1483299340813.12
12
"12"
inet ▪ InetAddress
▪ String
InetAddress.getLocalhost()
"127.0.0.1"
int ▪ Int
▪ String
1
"5"
list ▪ List[Any]
▪ util.List[Any]
▪ Seq[Any]
List(1, 2)
util.List[Int](1, 2)
Seq(1, 2)
map ▪ Map[Any, Any]
▪ util.Map[Any, Any]
Map("test" -> true)
util.Map[String, Boolean]("test" -> true)
set ▪ Array[Any]
▪ util.Array[Any]
▪ Seq[Any]
Set1, 2)
util.Set[Int](1, 2)
Seq(1, 2)
smallint ▪ Int
▪ Short
▪ String
12
12
"12"
text String "test"
time ▪ Long
▪ String
12030L
"01:01:01" or "01:01:01.343"
timestamp ▪ Long
▪ String
▪ Date
1483299340813L
"2008-03-01T13:00:00Z" or "2016-10-05"
new java.util.Date()
timeuuid ▪ UUID
▪ String
UUIDs.timeBased()
"3cf024ee-2cff-11e7-93ae-92361f002671"
tinyint ▪ Int
▪ Byte
▪ String
12
12.toByte
"12"
tuple TupleValue tupleType.newValue("one", "two")
uuid ▪ UUID
▪ String
UUIDs.random()
"252a3806-b8be-42d3-929d-4cbb380a433e"
udt UDTValue addressType.newValue().setString("firstname", "John")
varchar String "test"
varint ▪ Int
▪ Long
▪ String
▪ BigInteger
12
15L
"12"
BigInteger.valueOf(12L)

Special Params

CQL Type Scala Types Accepted Notes
null null When explicitly sending a null value through a feed a null/delete field will be sent to the cluster
* None When setting a None in the feed or Gatling session the field will be unset before sending to the cluster