-
Notifications
You must be signed in to change notification settings - Fork 64
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
Sqlite null fix #673
Sqlite null fix #673
Conversation
else if( returncode == SQLITE_ROW){ | ||
//Update column dtypes for the next row | ||
for (int i = 0; i < this->column_count && i < column_types.size(); i++) { | ||
this->column_types[i] = (sqlite3_column_type(this->ptr(), i)); |
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.
Does this need to be done for every row returned by the iterator, or just once for the first row we get? Why can/would column types differ from row to row?
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.
If the value in a column is NaN
, then sqlite3_column_type
will report that as a 5
or NULL type. So if the first row contains NaN
but other rows have valid data, then all types are reported as NULL
. (This is how we discovered this issue...)
Re-checking for each row ensures we get a non-null type if there is valid data in the column in that row.
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.
For additional context, sqlite3
has table definitions that include a schema (i.e. PRAGMA table_info(...);
), however, when interacting with rows, sqlite does not refer to the types in the table definition, but instead rely on row-local affinity (or something of that nature) to determine types -- so columns do not have a type associated wholly. Hence, the need to check each row.
The other alternative to this (but a bit more involved) is to pull the types from the table definition when an iterator is created. This solution of pulling types on each iteration is a bit quicker to get into the codebase though.
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.
That's the context that was missing. Nels, could you leave a synopsis of that as a comment in the code?
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.
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.
You've got a typo in your second commit message - 'alt_it' vs 'alt_id', that would make this commit harder to find by searching later
af6ead3
to
20e8418
Compare
20e8418
to
fa84d13
Compare
Third time's a charm, should be fixed now... |
Fix handling of null/nan enteries in hydrofabric.
Changes
"null"
in alt_ids when referencing feature by alternative id propertyTesting
Checklist
Target Environment support