uCosminexus Stream Data Platform - Application Framework Application Development Guide

[Contents][Index][Back][Next]

3.3.1 Mapping between CQL data types and Java data types

CQL data types are mapped to Java data types.

The following table shows the mapping between CQL data types and Java data types.

Table 3-5 Mapping between CQL data types and Java data types

Class CQL data type Data format Java data type Data range Remarks
Numeric data INT[EGER] Integer, 4 bytes Integer class -2,147,483,648 through 2,147,483,647 --
SMALLINT Integer, 2 bytes Short class -32,768 through 32,767 --
TINYINT Integer, 1 byte Byte class -128 through 127 --
BIGINT Integer, 8 bytes Long class -9,223,372,036,854,775,808 through 9,223,372,036,854,775,807 --
DEC[IMAL]['('m')']#1 Decimal format java.math.BigDecimal class -1038+1 through 1038-1 Decimal number whose precision (the total number of digits) is m digits (not including the + or - sign).
m is a positive integer in the range of 1 [Figure] m [Figure] 38. If m is omitted, 15 is assumed.
NUMERIC['('m')']#1
REAL Real number, 4 bytes Float class
  • -3.402823466E+38 through -1.175494351E-38
  • 0
  • 1.175494351E-38 through 3.402823466E+38
Data cannot be input using an exponential expression
FLOAT Real number, 8 bytes Double class
  • -1.7976931348623157E+308 through -2.2250738585072014E-308
  • 0
  • 2.2250738585072014E-308 through 1.7976931348623157E+308
Data cannot be input using an exponential expression
DOUBLE
Character data CHAR[ACTER]['('n')'] Fixed-length character string (with n characters) java.lang.String class 1 to 255 characters n is a positive integer in the range of 1 [Figure] n [Figure] 255. If n is omitted, 1 is assumed. The necessary number of spaces are added to fill the string. If the data length exceeds the specified number of characters n, an error occurs.
VARCHAR'('n')' Variable-length character string (with the maximum of n characters) 1 to 32,767 characters n is a positive integer in the range of 1 [Figure] n [Figure] 32,767. Spaces for filling the string are not added. If the data length exceeds the specified number of characters n, an error occurs.
Date data DATE#2 Date (year-month-day) java.sql.Date class YYYYMMDD
YYYY:
0001 to 9999 (Year)
MM:
01 to 12 (Month)
DD:
01 to the last day of the applicable month (Day)
--
Time data TIME#2 Time (hour-minutes-seconds) java.sql.Time class hhmmss
hh:
00 to 23 (hour)
mm:
00 to 59 (minutes)
ss:
00 to 59 (seconds)
--
Timestamp data TIMESTAMP['('p')']#2 Date and time (year-month-day + hour-minutes-seconds + nanoseconds) java.sql.Timestamp class YYYYMMDDhhmmss[nn....n]
YYYY:
0001 to 9999 (Year)
MM:
01 to 12 (Month)
DD:
01 to the last day of the applicable month (Day)
hh:
00 to 23 (hour)
mm:
00 to 59 (minutes)
ss:
00 to 59 (seconds)
nn....n:
p-digit fractional seconds (n: 0 to 9)
p is a positive integer. n is in the range of 0 [Figure] n [Figure] 9. If p is omitted, 3 is assumed.
If the number of digits in p is 3, 6, or 9, time is being specified in 1-millisecond, 1-microsecond, or 1-nanosecond units, respectively. If the specified data exceeds p, an error occurs.

Legend:
Class: Classification
--: Not applicable

#1
For notes related to the DECIMAL and NUMERIC types, see 3.3.2 Notes on the DECIMAL and NUMERIC types.

#2
For data of the DATE, TIME, and TIMESTAMP types, be careful not to specify out-of-range values. If out-of-range values are specified for these data types, no error occurs, but there is a risk that an unintended date might execute an undesired process.

Reference note
Mapping between CQL data types and Java data types follows the JDBC API, which defines the mapping between SQL data types and Java data types.