We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I met a runtime error on C++ UDF example.
#include<duckdb.hpp> int32_t udf_date(int32_t a) { return a; } int main() { con.Query("CREATE TABLE dates (d DATE)"); con.Query("INSERT INTO dates VALUES ('1992-01-01')"); con.CreateScalarFunction<int32_t, int32_t>("udf_date", {LogicalType::DATE}, LogicalType::DATE, &udf_date); con.Query("SELECT udf_date(d) FROM dates")->Print(); }
Error is following.
terminate called after throwing an instance of 'std::runtime_error' what(): Return type doesn't match with the first template type.
Following code works fine on my environment(Fedora Linux, gcc 14.2.1).
#include<duckdb.hpp> int32_t udf_date(duckdb::date_t a) { return a.days; } int main() { con.Query("CREATE TABLE dates (d DATE)"); con.Query("INSERT INTO dates VALUES ('1992-01-01')"); con.CreateScalarFunction<int32_t, duckdb::date_t>("udf_date", {duckdb::LogicalType::DATE}, duckdb::LogicalType::INTEGER, udf_date); con.Query("SELECT udf_date(d) FROM dates")->Print(); }
Are there something wrong on my code? Or should the document be fixed?
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I met a runtime error on C++ UDF example.
Error is following.
Following code works fine on my environment(Fedora Linux, gcc 14.2.1).
Are there something wrong on my code?
Or should the document be fixed?
The text was updated successfully, but these errors were encountered: