| A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z | AA | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | |||||||||||||||||||||||||||
2 | |||||||||||||||||||||||||||
3 | |||||||||||||||||||||||||||
4 | Integer Data Types | FUNCTION SUPPORT FOR INTs quite good, but many functions don't match PG behavior | |||||||||||||||||||||||||
5 | |||||||||||||||||||||||||||
6 | Spark | Postgres | DataFusion SQL | Arrow | Parquet Logical Types | Description | Range / Comments | ||||||||||||||||||||
7 | docs | docs | docs | docs | Overflow behavior | Cast behavior | |||||||||||||||||||||
8 | DataType | Test SQL | DataFusion (release) | Postgres | DataType | Test SQL | DataFusion (release) | Postgres | |||||||||||||||||||
9 | ByteType | - | tinyint | Int8 | INT(8, true) | 1-byte signed integer | -128 to 127 | Int8 | select 127::tinyint + 1::tinyint; | wraps | - | Int8 | select 128::tinyint; | null | - | ||||||||||||
10 | ShortType | smallint | smallint | Int16 | INT(16, true) | 2-byte signed integer | -32768 to +32767 | Int16 | select 32767::smallint + 1::smallint; | wraps | ERROR: smallint out of range | Int16 | select 32768::smallint; | null | ERROR: smallint out of range | ||||||||||||
11 | IntegerType | integer | integer | Int32 | INT(32, true) | 4-byte signed integer | -2147483648 to +2147483647 | Int32 | select 2147483647::int + 1::int; | wraps | ERROR: integer out of range | Int32 | select 2147483648::int; | null | ERROR: integer out of range | ||||||||||||
12 | LongType | bigint | bigint | Int64 | INT(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 unsigned | UInt8 | INT(8, false) | 1-byte unsigned integer | 0 to 255 | UInt8 | select 255::tinyint unsigned + 1::tinyint unsigned; | wraps | - | UInt8 | select 256::tinyint unsigned; | null | - | ||||||||||||||
14 | smallint unsigned | UInt16 | INT(16, false) | 2-byte unsigned integer | 0 to 65535 | UInt16 | select 65535::smallint unsigned + 1::smallint unsigned; | wraps | - | UInt16 | select 65536::smallint unsigned; | null | - | ||||||||||||||
15 | int unsigned | UInt32 | INT(32, false) | 4-byte unsigned integer | 0 to 4294967295 | UInt32 | select 4294967295::int unsigned + 1::int unsigned; | wraps | - | UInt32 | select 4294967296::int unsigned; | null | - | ||||||||||||||
16 | bigint unsigned | UInt64 | INT(64, false) | 8-byte unsigned integer | 0 to (2^64)-1 | UInt64 | 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 | FloatType | real | real or float | Float32 | - | 4 bytes | - | ||||||||||||||||||||
22 | DoubleType | double precision | double or double precision | Float64 | - | 8 bytes | |||||||||||||||||||||
23 | |||||||||||||||||||||||||||
24 | |||||||||||||||||||||||||||
25 | Arbitrary Precision Numerics | ||||||||||||||||||||||||||
26 | 3.40282E+38 | 1.70141E+38 | |||||||||||||||||||||||||
27 | DecimalType | numeric(p,s) or decimal(p,s) | numeric(p,s) or decimal(p,s) | Decimal128(usize,usize) | DECIMAL | 1.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 | BinaryType | bytea | bytea | Binary | ?? | 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 | StringType | char / 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 | date | date | Date32 | DATE | 4 bytes | ||||||||||||||||||||||
46 | - | Date64 | |||||||||||||||||||||||||
47 | - | Time32(TimeUnit) | |||||||||||||||||||||||||
48 | time [with time zone] | time | Time64(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 | BooleanType | boolean | boolean | Boolean | - | ||||||||||||||||||||||
55 | |||||||||||||||||||||||||||
56 | |||||||||||||||||||||||||||
57 | Array Types | not 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 |