Skip to content

Numeric types

nGQL supports both integer and floating-point number.

Integer

Signed 64-bit integer (INT64), 32-bit integer (INT32), 16-bit integer (INT16), and 8-bit integer (INT8) are supported.

Type Declared keywords Range
INT64 INT64 orINT -9,223,372,036,854,775,808 ~ 9,223,372,036,854,775,807
INT32 INT32 -2,147,483,648 ~ 2,147,483,647
INT16 INT16 -32,768 ~ 32,767
INT8 INT8 -128 ~ 127

Floating-point number

Both single-precision floating-point format (FLOAT) and double-precision floating-point format (DOUBLE) are supported.

Type Declared keywords Range Precision
FLOAT FLOAT 3.4E +/- 38 6~7 bits
DOUBLE DOUBLE 1.7E +/- 308 15~16 bits

Scientific notation is also supported, such as 1e2, 1.1e2, .3e4, 1.e4, and -1234E-10.

Note

The data type of DECIMAL in MySQL is not supported.

Reading and writing of data values

When writing and reading different types of data, nGQL complies with the following rules:

Data type Set as VID Set as property Resulted data type
INT64 Supported Supported INT64
INT32 Not supported Supported INT64
INT16 Not supported Supported INT64
INT8 Not supported Supported INT64
FLOAT Not supported Supported DOUBLE
DOUBLE Not supported Supported DOUBLE

For example, nGQL does not support setting VID as INT8, but supports setting a certain property type of TAG or Edge type as INT8. When using the nGQL statement to read the property of INT8, the resulted type is INT64.

Multiple formats are supported:

  • Decimal, such as 123456.
  • Hexadecimal, such as 0x1e240.
  • Octal, such as 0361100.

However, NebulaGraph will parse the written non-decimal value into a decimal value and save it. The value read is decimal.

For example, the type of the property score is INT. The value of 0xb is assigned to it through the INSERT statement. If querying the property value with statements such as FETCH, you will get the result 11, which is the decimal result of the hexadecimal 0xb.


Last update: March 13, 2023