This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Convert CQL Data Types to MATLAB Data Types

When importing data into MATLAB®, the partitionRead and executecql functions convert the Cassandra® Query Language (CQL) data types to MATLAB data types. This table describes the CQL data types and shows their corresponding MATLAB data types after the data import into MATLAB.

CQL Data TypeCQL Data Type DescriptionData Type of MATLAB Table Variable

ascii

US-ASCII character string

string

bigint

64-bit signed long integer

int64

blob

Arbitrary bytes (no validation)

uint8

boolean

true or false

logical

counter

Distributed counter value (64-bit long integer)

int64

date

Value is a date with no corresponding time value. Cassandra encodes the date as a 32-bit integer representing days since epoch (January 1, 1970).

datetime array without the time component and time zone

decimal

Variable-precision decimal

java.math.BigDecimal

double

64-bit IEEE®-754 floating point

double

float

32-bit IEEE-754 floating point

single

inet

IP address string in IPv4 or IPv6 format

string

int

32-bit signed integer

int32

list<type>

Collection of one or more ordered elements (for example, [literal, literal, literal])

Array of data types, one for each item in the collection.

For example, if a Cassandra database table column has the list<int> data type, then each row in the MATLAB table contains an array of int32 data types. In this case, the data type of the MATLAB table variable is a cell array of arrays.

map<keyType,valueType>

JSON-style array of literals (for example, { literal : literal, literal : literal, ...})

An n-by-2 MATLAB table where n is the number of key-value pairs in the map. The first variable Keys has the keys of the map. The data type for this variable depends on the key type defined for the map. Similarly, the Values variable has the values that correspond to each key. The data type for the Values variable depends on the value type defined for the map.

For example, if a Cassandra database table column has the map<text,double> data type, then the partitionRead and executecql functions convert this data type into a MATLAB table. The table has the Keys variable as string scalars and the Values variable as a double array. In this case, the data type of the MATLAB table variable is a cell array of tables.

set<type>

Collection of one or more elements (for example, {literal, literal, literal})

Array of data types, one for each item in the collection.

For example, if a Cassandra database column has the set<float> data type, then each row in the resulting MATLAB table contains an array of single values. In this case, the data type of the MATLAB table variable is a cell array of arrays.

smallint

2-byte integer

int16

text

UTF-8 encoded string

string

time

Cassandra database encodes this value as a 64-bit signed integer that represents the number of nanoseconds since midnight.

duration array

timestamp

Date and time with millisecond precision, encoded as 8 bytes since epoch (January 1, 1970)

datetime array with the date component and time zone as UTC or GMT

timeuuid

Version 1 UUID only

string

tinyint

1-byte integer

int8

tuple<Type1,...,TypeN>

Group of unnamed but typed fields

A 1-by-n MATLAB table, where n is the number of fields in the tuple. The variable names are Var1, Var2, Var3, and so on, until Var(n). The data type of each variable depends on the Cassandra data types defined in the tuple.

For example, if a Cassandra database column has the tuple<text,smallint,timestamp> data type, then the partitionRead and executecql functions convert this data type into a MATLAB table. The table has the Var1 variable as a string array, Var2 as an int16 array, and Var3 as a datetime array. In this case, the data type of the MATLAB table variable is a table.

user-defined type (UDT)

Group of named fields

A 1-by-n MATLAB table, where n is the number of fields in the UDT. Variable names match the field names of the UDT. The data type of each variable depends on the Cassandra data types defined in the UDT. The data type of the MATLAB table variable is a table.

uuid

UUID in standard UUID format

string

varchar

UTF-8 encoded string

string

varint

Arbitrary-precision integer

java.math.BigInteger

Note

For the CQL data type, if the data type is a collection (for example, list, map, and so on), then the value contains angle brackets (<>). These brackets surround the data types of the items in the collection. For details about valid Cassandra data types, see CQL data types.

See Also

|

Related Topics

External Websites