-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix the handling of null default values. (#182)
* Fix the way a null default value is handled. This PR concerns calls to `createSchemaField()` where the default value passed in is null. Null as a default value is only really valid in two situations: (1) When the field is of type "null", or (2) When the field is of type union where the first entry in the union is "null". Case (1) is a weird case that nobody really cares about in practice. The Avro libraries themselves (all versions) recognize case (2) (and case (2) only) and convert the null into a NullNode object. In all other cases, the null is left alone (no conversion to NullNode). So, we do the same here. Note: The compat helper's behaviour was inconsistent before this PR. In Avro 1.8 and earlier, we always converted a null default into an object; In Avro 1.9 and 1.10, null was never converted. This PR makes them behave consistently. * Use the field's schema instead of passing it in as a param. Also add much better comments and tests.
- Loading branch information
Showing
20 changed files
with
1,076 additions
and
9 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.