ABCDEFGHIJKLMNOPQRSTUVWXYZAA
1
2
3
4
Integer Data Types
FUNCTION SUPPORT FOR INTs quite good, but many functions don't match PG behavior
5
6
SparkPostgresDataFusion SQLArrow
Parquet Logical Types
DescriptionRange / Comments
7
docsdocsdocsdocsOverflow behaviorCast behavior
8
DataTypeTest SQL
DataFusion (release)
PostgresDataTypeTest SQLDataFusion (release)
Postgres
9
ByteType-tinyintInt8INT(8, true)
1-byte signed integer
-128 to 127Int8select 127::tinyint + 1::tinyint;wraps-Int8select 128::tinyint;null-
10
ShortTypesmallintsmallintInt16INT(16, true)
2-byte signed integer
-32768 to +32767Int16
select 32767::smallint + 1::smallint;
wraps
ERROR: smallint out of range
Int16
select 32768::smallint;
null
ERROR: smallint out of range
11
IntegerTypeintegerintegerInt32INT(32, true)
4-byte signed integer
-2147483648 to +2147483647Int32select 2147483647::int + 1::int;wraps
ERROR: integer out of range
Int32
select 2147483648::int;
null
ERROR: integer out of range
12
LongTypebigintbigintInt64INT(64, true)
8-byte signed integer
-9223372036854775808 to 9223372036854775807
Int64
select 9223372036854775807::bigint + 1::bigint;
wraps
ERROR: bigint out of range
Int64
select 9223372036854775808::bigint;
null
ERROR: bigint out of range
13
tinyint unsignedUInt8INT(8, false)
1-byte unsigned integer
0 to 255UInt8
select 255::tinyint unsigned + 1::tinyint unsigned;
wraps-UInt8
select 256::tinyint unsigned;
null-
14
smallint unsignedUInt16INT(16, false)
2-byte unsigned integer
0 to 65535UInt16
select 65535::smallint unsigned + 1::smallint unsigned;
wraps-UInt16
select 65536::smallint unsigned;
null-
15
int unsignedUInt32INT(32, false)
4-byte unsigned integer
0 to 4294967295UInt32
select 4294967295::int unsigned + 1::int unsigned;
wraps-UInt32
select 4294967296::int unsigned;
null-
16
bigint unsignedUInt64INT(64, false)
8-byte unsigned integer
0 to (2^64)-1UInt64
select power(2,64)::bigint unsigned;
wraps-UInt64
select 18446744073709551615::bigint unsigned;
null for values even less than 2^64. some weird behavior here.
-
17
18
Floating Point Types
^^ overflow behavior for int types doesn't match PG
19
^^ overflow of bigint causes panic
20
---Float16-2 bytes
select 9::decimal(1,0) + 1::decimal(1,0);
ArrowError(InvalidArgumentError("10 is too large to store in a Decimal128 of precision 1. Max is 9"))
-
select 1000000000100000000010000000001000000000::decimal;
returns +---------------------------------------------------+
| Float64(1000000000100000000000000000000000000000) |
+---------------------------------------------------+
| 1701411834604692317316873037.1588410572 |
+---------------------------------------------------+
21
FloatTyperealreal or floatFloat32-4 bytes-
22
DoubleTypedouble precision
double or double precision
Float64-8 bytes
23
24
25
Arbitrary Precision Numerics
26
3.40282E+381.70141E+38
27
DecimalType
numeric(p,s) or decimal(p,s)
numeric(p,s) or decimal(p,s)
Decimal128(usize,usize)
DECIMAL1.70141E+37
28
-
Decimal256(usize,usize)
10
29
30
Binary Types
not much / no function support for binary types
99999999 9999999999 9999999999 9999999999
31
32
BinaryTypebyteabyteaBinary??
I believe we're missing any SQL functions to encode/decode binary data?
33
-FixedSizeBinary(i32)
34
-LargeBinary
35
36
37
Character Types
38
39
StringTypechar / varchar / text
char / character / varchar / character varying
Utf8
40
-LargeUtf8
same as Utf8 but with 64-bit offsets for very large values
41
42
Temporal Types
43
44
timestamp [with time zone]
timestamp
Timestamp(TimeUnit, Option<String>)
TIMESTAMP
45
datedateDate32DATE4 bytes
46
-Date64
47
-Time32(TimeUnit)
48
time [with time zone]timeTime64(TimeUnit)TIME
this issue says cast to time doesn't work, but I think it does already, at least for some values https://github.com/apache/arrow-datafusion/issues/193
49
-Duration(TimeUnit)
50
interval-Interval(IntervalUnit)INTERVAL
should be able to cast to interval ('20 minutes'::interval) but can't
51
52
Boolean Types
53
54
BooleanTypebooleanbooleanBoolean-
55
56
57
Array Typesnot much function support for array types
58
smallint[]smallint[]List(Box<Field>)
currently, can cast to these, but can't make a memory table with them
59
int[]int[]List(Box<Field>)
60
bigint[]bigint[]List(Box<Field>)
61
text arrays
62
but not all the array syntax
not all of PG syntax for arrays is supported
63
64
65
Complex Types
66
-List(Box<Field>)LIST
67
-
FixedSizeList(Box<Field>, i32)
68
-LargeList(Box<Field>)
69
complex type and row()struct(1,2,3)Struct(Vec<Field>)
can create struct with syntax shown, but can't create memory tables from them. syntax also doesn't match PG similar concept.
70
-
Union(Vec<Field>, Vec<i8>, UnionMode)
71
-
Dictionary(Box<DataType>, Box<DataType>)
dictionary types are practically invisible to SQL users, right? if you have a TableProvider returning Dictionary types, SQL users will see only the value from the type: select dict_col from my_table .. if dict_col is <int16, utf8>, users will only see the uft8 value. correct?
72
-Map(Box<Field>, bool)MAP
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100