Data types in Deephaven and Python
For performance reasons, the Deephaven engine is implemented in Java. As such, Deephaven tables use Java data types for columns. These include both Java primitive types and Java objects.
Java data types
Primitive types
Java primitive types are tuned to physical hardware and are fixed sizes. This is the main reason they are preferred in tables - they are faster and more memory efficient.
The following table shows the mapping between Java primitive types and Java primitive type sizes:
Java primitive type | Java primitive type size |
---|---|
boolean | 1 byte |
byte | 1 byte |
short | 2 bytes |
int | 4 bytes |
long | 8 bytes |
float | 4 bytes |
double | 8 bytes |
char | 2 bytes |
Array types
In Deephaven tables, there are two commonly used array types:
Data type conversions
You can ensure that columns in tables are of the appropriate type by using type casting:
func = { value ->
return Math.sqrt(value)
}
source = emptyTable(10).update(
"Typecast = (double)func(ii)",
"NoTypecast = func(ii)"
)
sourceMeta = source.meta()