Repository navigation
[GH-3409] Read NULL GeoPackage integer, real and boolean values as null - #3410
Merged
Merged
Conversation
… as null ValuesMapper read INTEGER, SMALLINT, MEDIUMINT, FLOAT, DOUBLE, REAL and BOOLEAN columns with the JDBC primitive getters, which return 0, 0.0 or false for a SQL NULL, and never checked wasNull(). NULL cells therefore came back as real zeros and false, so IS NULL filters matched nothing and aggregates were skewed. Check wasNull() after each primitive getter and return null when it is set. Add a small GDAL-written fixture with a row of all-NULL numeric and boolean columns next to a row of zeros and false, to show that real zeros and false are still read as values.
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Did you read the Contributor Guide?
Is this PR related to a ticket?
[GH-XXX] my subject. Closes GeoPackage reader reads NULL integer, real and boolean values as 0, 0.0 and false #3409What changes were proposed in this PR?
ValuesMapperread INTEGER, SMALLINT, MEDIUMINT, FLOAT, DOUBLE, REAL and BOOLEAN columns with the JDBC primitive getters, which return 0, 0.0 or false for a SQL NULL, and never checkedwasNull(). NULL cells therefore came back as real zeros andfalse, soIS NULLfilters matched nothing and aggregates were skewed.wasNull()after each primitive getter and return null when it is set (a smallnullIfWasNullhelper).test_null_values.gpkg, with an all-NULL row next to a row of zeros andfalse, to show that real zeros andfalseare still read as values. It follows the layout of the existingtest_null_datetime.gpkgfrom [GH-3352] Read NULL GeoPackage date and datetime values as null #3353.How was this patch tested?
should read NULL integer, real and boolean values as nullinGeoPackageReaderTest. On master it fails with row 2 read as[2,0,0,0,0.0,0.0,false]; with the fix it reads[2,null,null,null,null,null,null].GeoPackageReaderTestandGeometryReaderTeston the default profile: all pass exceptshould be able to read files from S3, which needs Docker and could not start locally; it is unrelated to this change.Did this PR include necessary documentation updates?