-
Notifications
You must be signed in to change notification settings - Fork 146
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
[Question]: Possible to provide floats as single instead of double precision? #666
Comments
single
instead of double
?
There are no current support for this out-of-the-box. I will accept PR to just make MapTo not fail when casting. There is already a conversion-trial-system for procedure returns or something: SQLProvider/src/SQLProvider/Utils.fs Line 73 in 8b5cb34
I would be interested how do you use MapTo as I never used it myself, and people complain some features of it, but there are no unit-tests, so I cannot fix what I don't know it should work in the first place. I guess what could also be doable, is configurable mapping of SQL-types (varies per database) to .NET types (1 (int), 1u (uint32), 1L (int64), 1UL (uint64), 1s (int16), 1y (sbyte), 1uy (byte), 1.0 (float), 1.0f (float32), 1.0m (decimal), 1I (BigInteger)), e.g. via static parameter, but this is not a lot requested feature. However, what I would really also like is kind of language level #pragma keyword to set your types: |
You can already provide optional type mapping parameter for MapTo-method. Example to map EmployeeId from int64 database column to Int32 record: type Employee = {
EmployeeId : int32
FirstName : string
LastName : string
HireDate : DateTime
}
let example() =
query {
for emp in dc.Main.Employees do
select emp
skip 2
take 5
}
|> Seq.map (fun e ->
e.MapTo<Employee>(
function
| "EmployeeId", (:? int64 as id) -> Convert.ToInt32(id) |> box
| k,v -> v))
|> Seq.toList ...and this is duplicate of #525 |
Description
I'm working with a lot of data that eventually gets computed on the GPU, so using float32 in the application side is preferable.
Because the data comes back as double, the automatic mapping via
MapTo<T>
fails.Is it possible to set some kind of global option that returns all floats as
System.Single
intead ofSystem.Double
?The text was updated successfully, but these errors were encountered: