-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Fix creation of DuckDB tables with arrays of boolean, tinyint and smallint #8408
Conversation
✅ Deploy Preview for meta-velox canceled.
|
@mbasmanova has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mbasmanova thanks for the fix!
72f9bf2
to
41afcd3
Compare
@mbasmanova has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
@@ -39,6 +39,30 @@ ::duckdb::Value duckValueAt(const VectorPtr& vector, vector_size_t index) { | |||
return ::duckdb::Value(vector->as<SimpleVector<T>>()->valueAt(index)); | |||
} | |||
|
|||
template <> | |||
::duckdb::Value duckValueAt<TypeKind::TINYINT>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: should we add a test in QueryAssertionsTest
@mbasmanova merged this pull request in 82bcd39. |
Conbench analyzed the 1 benchmark run on commit There were no benchmark performance regressions. 🎉 The full Conbench report has more details. |
Creating DuckDB table with a column of type array(boolean), array(tinyint) or
array(smallint) having a mix of null and non-null array elements used to fail with
The problem is that
duckValueAt<TypeKind>
template in QueryAssertions.cpp usedto convert non-null values by calling duckdb::Value(v) API, which is not defined
for bool, int8_t and int16_t. Hence, we ended up calling a version of that API
that takes int32_t and returns a value of type INTEGER. However, code for
converting null values used duckdb::Value(type) API which takes type directly
and therefore creates values of the "right" type. When array value had a mix of
null and non-null values we ended up passing a list of elements of different
types to DuckDB and hit an assertion.
A fix implemented here is to provide explicit overrides for boolean, tinyint and smallint.
This issue happens often in join fuzzer runs.
Fixes #7943