Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Data Types in Different Programming Languages

Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!

Data TypeCC++RustJavaPythonnumpypyarrowSpark SQLSQL
8 bit integershort (16-bit)int8_ti8short (16-bit)int (arbitrary precision)int8TinyIntTinyInt or Decimal(3, 0) (slight larger)
16 bit integershortint16_ti16shortint (arbitrary precision)int16SmallIntSmallInt or Decimal(5, 0) (slight larger)
32 bit integerintint32_ti32intint (arbitrary precision)int32IntInt or Decimal(10, 0) (slight larger)
64 bit integerlongint64_ti64longint (arbitrary precision)int64BigIntBigInt or Decimal(18,0) (slight smaller)
Decimal(2,0)short (larger)short (laarger)i8 (larger)shortint (arbitrary precision)int8 (larger)Decimal(2,0) or TinyInt (slight larger)Decimal(2,0)
Decimal(4,0)short (larger)short (laarger)i16 (larger)shortint (arbitrary precision)int16 (larger)Decimal(4,0) or SmallInt (larger)Decimal(4,0)
Decimal(9,0)int (larger)int (laarger)i32 (larger)intint (arbitrary precision)int32 (larger)Decimal(9,0) or Int (larger)Decimal(9,0)
Decimal(18,0)long long (larger)long long (laarger)i64 (larger)longint (arbitrary precision)int64 (larger)Decimal(18,0) or BigInt (larger)Decimal(18,0)
32 bit floatfloatfloatf32floatfloat (64-bit)float64decimal(n,k) or floatdecimal(n,k)
64 bit floatdoubledoublef64doublefloatfloat64decimal(n,k) or doubledecimal(n,k)

References

Overview of Pandas Data Types

http://www-db.deis.unibo.it/courses/TW/DOCS/w3schools/sql/sql_datatypes_general.asp.html

https://spark.apache.org/docs/latest/sql-ref-datatypes.html

https://numpy.org/devdocs/user/basics.types.htmlo

https://arrow.apache.org/docs/python/generated/pyarrow.decimal128.html