Closed ludnic closed 1 year ago
Interesting, looking in the second example from the comment above I have noticed that if I remove the helper function to access hugeint this works. So the problem is with the helper function but I haven't figured why. The integer casting seems to be alright and removing the initialisation does not change things.
block
type(duckdb_hugeint) :: hi
hi = duckdb_value_hugeint_(result, 0_c_int64_t, 1_c_int64_t)
! hi = duckdb_value_hugeint(result, 0, 1)
print*, types(i), hi%lower, hi%upper, duckdb_hugeint_to_double(hi)
call check(error, duckdb_hugeint_to_double(hi) == 1, &
trim(types(i))//": 1 hugeint")
if (allocated(error)) return
end block
gives:
TINYINT 1 0 1.0000000000000000
SMALLINT 1 0 1.0000000000000000
INTEGER 1 0 1.0000000000000000
BIGINT 1 0 1.0000000000000000
HUGEINT 1 0 1.0000000000000000
while the helper function gives:
TINYINT 0 0 0.0000000000000000
This and a similar issue with value_decimal
function were due to a typo in calling the interface functions. now fixed.
The hugeint does not work correctly. All the tests involving hugeint are not passing (with value and appender functions). I have not managed to find the issue so far.
See for example https://github.com/freevryheid/duckdb/blob/884c6bef70f1025b75bf2b564a11d4e86dfd30bc/test/test_appender.f90#L489-L496
https://github.com/freevryheid/duckdb/blob/288533113a688847907fe561d1ce0b830fea0408/test/test_fortran_api.f90#L459-L460