Convert CQL Data Types to MATLAB Data Types Using Apache Cassandra Database C++ Interface
When you import data into MATLAB® using the Apache®
Cassandra® database C++ interface, the partitionRead
and executecql
functions convert the Cassandra Query Language (CQL) data types to MATLAB data types. When you export from MATLAB into a Cassandra database, the upsert
function
converts MATLAB data types to CQL data types. This table describes the CQL data types and shows
their corresponding MATLAB data types for data import and export.
CQL Data Type | CQL Data Type Description | Data Type of MATLAB Table Variable for Data Import | Data Type of MATLAB Table Variable for Data Export |
---|---|---|---|
| US-ASCII character string |
|
|
| 64-bit signed long integer |
|
|
| Arbitrary bytes (no validation) |
| cell array of numeric vectors |
|
|
|
|
| Distributed counter value (64-bit long integer) |
| Not supported by the upsert
function |
| 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). |
|
|
| Variable-precision decimal |
|
|
| 64-bit IEEE®-754 floating point |
|
|
| 32-bit IEEE-754 floating point |
|
|
| IP address string in IPv4 or IPv6 format |
|
|
| 32-bit signed integer |
|
|
| Collection of one or more ordered elements (for example, | Array of data types, one for each item in the collection. For
example, if a Cassandra database table column has the | Cell array of vectors, where each vector is compatible with the type of the list. For example, if the Cassandra database table contains |
| JSON-style array of literals (for example, | An For example, if a Cassandra database table column has the | Cell array of tables, where each table contains the The data types of these two variables are compatible with the data types of the keys and values of the Cassandra database map. For example, if the Cassandra database table contains |
| Collection of one or more elements (for example, | Array of data types, one for each item in the collection. For
example, if a Cassandra database column has the | Cell array of vectors, where each vector is compatible with the type of the collection. For example, if the Cassandra database table contains |
| 2-byte integer |
|
|
| UTF-8 encoded string |
|
|
| Cassandra database encodes this value as a 64-bit signed integer that represents the number of nanoseconds since midnight. |
|
|
| Date and time with millisecond precision, encoded as 8 bytes since epoch (January 1, 1970) |
|
|
| Version 1 UUID only |
|
|
| 1-byte integer |
|
|
| Group of unnamed but typed fields | A 1-by- For example, if a
Cassandra database column has the
| MATLAB table. The position of each variable in the table determines which field the variable maps to in the tuple. The first variable in the table maps to the first field in the tuple, the second variable maps to the second field, and so on. For example, if the Cassandra database table contains |
user-defined type (UDT) | Group of named fields | A 1-by- | MATLAB table. The names of the variables in the table must match the names of the UDT fields. The data type of each variable in the table must be compatible with the Cassandra data type of the corresponding UDT field. |
| UUID in standard UUID format |
|
|
| UTF-8 encoded string |
|
|
| Arbitrary-precision integer |
|
|
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
partitionRead
| upsert
| executecql
Related Topics
- Fill Values for Missing Data from Database Using Apache Cassandra Database C++ Interface
- Import Data from Cassandra Database Table Using CQL