-
Notifications
You must be signed in to change notification settings - Fork 765
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Specification of type system #1521
Comments
cc @sundy-li |
Thanks for the issue, I think in the alpha version, the types we must have are: PrimitiveTypes:
UInt8/Int8 aka tinyint, UInt16/Int16 aka smallint, UInt32/Int32 aka int, UInt64/Int64 aka bigint, Float32 aka float, Float64 aka double. Boolean
String, Binary
Binary can cover the case of Utf8, seems we can keep Binary type and allow users to add charset constraints to the type. Complex types
List aka Array, Struct aka tuple. Date, DateTime TypesDate, DateTime types are logic types, we can map these types into primitive types.
|
Maybe we should involve |
Note that wrt to not following the arrow spec, the constraint there is that if you need FFI (e.g. UDFs written in python for ML and things like that), it will be more difficult to integrate those types. I am not sure that is a problem per se; just mentioning. |
Yes, we can add it later, add
Thanks, in Datafuse, we take
That's true, still need some considerations and discussions about that. |
out of curiosity, why fn main() {
println!("i32::MAX: {}", i32::MAX);
println!("i16::MAX: {}", i16::MAX);
println!("u16::MAX: {}", u16::MAX);
} prints
|
Oh, that's my bad. |
Hi @sundy-li, it seems this specification basically follows the I have need for this in #1538 and #1537 , can I just treat it as a stable API and rely on it? |
Yes, currently we treat it as our own type. |
FYI @andylokandy |
@leiysky, maybe we can close this issue now? |
It's important to provide a well defined type system.
In ANSI SQL specification, there are many data types, while all of the databases have their own type systems that always have difference fron ANSI SQL.
The most complicated part is the implicit conversion between data types.
For example, there isn't a real
BOOLEAN
type in MySQL. They representsBOOLEAN
withTINYINT(1)
, thus literalTRUE
value is actually1
with typeTINYINT
.Besides, MySQL allows implicit conversion from string type to float, that is, if you write down a SQL query like
SELECT SUM(char_column) FROM table
, MySQL can still produce a bizzare result(it will implicitly convertchar_column
into adouble_column
, and the conversion rule is not well defined).While PostgreSQL do have
BOOLEAN
type, and it doesn't allow non-reasonable implicit conversion.We've discussed about this in #1492, and the detailed discussion about type system will be finished in this issue.
The text was updated successfully, but these errors were encountered: