Changing the database cursor to return default for DBNull#4070
Merged
eerhardt merged 3 commits intodotnet:masterfrom Aug 7, 2019
tannergooding:DatabaseLoader
Merged
Changing the database cursor to return default for DBNull#4070eerhardt merged 3 commits intodotnet:masterfrom tannergooding:DatabaseLoader
eerhardt merged 3 commits intodotnet:masterfrom
tannergooding:DatabaseLoader
Conversation
Member
Author
|
eerhardt
reviewed
Aug 6, 2019
src/Microsoft.ML.Experimental/DataLoadSave/Database/DatabaseLoaderCursor.cs
Outdated
Show resolved
Hide resolved
| { | ||
| int columnIndex = GetColumnIndex(colInfo); | ||
| return (ref bool value) => value = DataReader.GetBoolean(columnIndex); | ||
| return (ref bool value) => value = DataReader.IsDBNull(columnIndex) ? default : DataReader.GetBoolean(columnIndex); |
Member
There was a problem hiding this comment.
I don't think blindly turning null into default is really the correct thing to do here.
I wonder if we should have optional behaviors that the user can opt into. Potentially something like:
- (default behavior) throw on
nulls so the user knows they have to make some decision. - Turn
nullintodefault. - Convert nullable integer columns into
float/double, and useNaNto designatenullvalues. They can then use the Replace N/A transforms available to them in the rest of the pipeline. - The user can always change their schema (either inserting the data into a different table and replacing
nullas appropriate, creating a special stored proc or SELECT statement to do thenullconversion) as an option to get around the exception as well.
See @TomFinley's comments at #673 (comment) for more thoughts here.
@codemzs @ebarsoumMS - any thoughts on the appropriate behavior here?
eerhardt
approved these changes
Aug 6, 2019
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This updates the
DatabaseLoaderCursorto support nullable columns by treating them asdefault.