Number types
In Data API requests, the limit on maximum number length applies to the literal number of characters sent in the command’s JSON payload.
A numeric literal in the JSON payload cannot exceed 100 characters, such as a number with 100 digits.
However, you can use exponents to pass values that represent more than 100 digits, such as 1e120000.
The exponent itself, not the expanded value, counts toward the 100-character limit.
In Data API responses, the Data API may return the fully-expressed number, beyond 100 characters.
int
Use the int type for 32-bit signed integers, including optional - and exponent.
Only numbers that can be converted to a 4-byte integer without loss of information are valid. Exponents must express a whole number.
Client behavior:
-
Python: Accepts and returns
int. -
TypeScript: Accepts and returns JavaScript numbers.
-
Java: Accepts and returns
java.lang.Integer.
bigint
Use the bigint type for integers ranging from -9223372036854775808 to 9223372036854775807 (-2^63 to 2^63-1).
Only numbers that can be converted to an integer value without loss of information are valid.
Client behavior:
-
Python: Accepts and returns
int. -
TypeScript: Accepts and returns JavaScript numbers. You can store numbers outside of JavaScript
Number.MAX_SAFE_INTEGER, but TypeScript may round the values since TypeScript uses numbers, not BigInt. -
Java: Accepts and returns
java.lang.Long.
smallint
Use the smallint type for 2-byte integers, including optional - and exponent.
Only numbers that can be converted to a 2-byte integer without loss of information are valid.
Exponents must express a whole number.
Client behavior:
-
Python: Accepts and returns
int. -
TypeScript: Accepts and returns JavaScript numbers.
-
Java: Accepts and returns
java.lang.Short.
tinyint
Use the tinyint type for 1-byte integers, including optional - and exponent.
Only numbers that can be converted to a 1-byte integer without loss of information are valid.
Exponents must express a whole number.
Client behavior:
-
Python: Accepts and returns
int. -
TypeScript: Accepts and returns JavaScript numbers.
-
Java: Accepts and returns
java.lang.Byte.
varint
Use the varint type for arbitrary-precision integers of Java type, including optional - and exponent.
Client behavior:
-
Python: Accepts and returns
int. -
TypeScript: Accepts numbers or strings. Returns strings.
-
Java: Accepts and returns
java.math.BigInteger.
decimal
Use the decimal type for variable-precision decimals, including optional - and exponent.
Integers are valid decimal values, and may be returned without a decimal point.
For example, 23 is a valid decimal, and it can be returned as 23 or 23.0.
decimal does not support NaN, Infinity, or -Infinity values.
Client behavior:
-
Python: Accepts
decimal.DECIMAL,int, andfloat. Returnsdecimal.DECIMAL. -
TypeScript: Accepts numbers or strings. Returns strings.
-
Java: Accepts and returns
java.math.BigDecimal.
double
Use the double type for 64-bit IEEE-754 floating point values that can be a number (including an exponent and +/- 0) or a quoted string containing NaN, Infinity, or -Infinity.
Client behavior:
-
Python: Accepts
intandfloat, includingfloat("NaN"),float("Infinity"), andfloat("-Infinity"). Returnsfloatunless you customize the serialization/deserialization. -
TypeScript: Accepts and returns JavaScript numbers.
-
Java: Accepts and returns
java.lang.Double.
float
Use the float type for 32-bit IEEE-754 floating point values that can be a number (including E and +/- 0) or a quoted string containing NaN, Infinity, or -Infinity.
Client behavior:
-
Python: Accepts
intandfloat, includingfloat("NaN"),float("Infinity"), andfloat("-Infinity"). Returnsfloatunless you customize the serialization/deserialization. -
TypeScript: Accepts and returns JavaScript numbers.
-
Java: Accepts and returns
java.lang.Float.
counter (partial support)
|
The Data API can’t create columns of The Data API can only read and filter values in existing |
Use the counter type for 64-bit signed integers intended for incrementing and decrementing.