Skip to content

GenericJsonReader converts the null value to string "null" #8882

Closed

Description

@eolivelli

Describe the bug
It looks like GenericJsonReader is not handling correctly null values

This is a reproducer:

 byte[] json = "{\"somefield\":null}".getBytes();
    GenericJsonRecord record =
            new GenericJsonReader(Collections.singletonList(new Field("somefield", 0)))
                    .read(json, 0, json.length);
    assert record.getJsonNode().get("somefield").isNull();
    assert "null".equals(record.getField("somefield"));
    assert record.getField("somefield") != null;

Expected behavior
The null value is not converted to a string, but it is still a null value

Additional context
The problem affects Pulsar Functions/Pulsar IO

Activity

  1. added
    type/bug
    on Dec 9, 2020
  2. eolivelli commented on Dec 9, 2020

    @eolivelli
    ContributorAuthor

    fixed by #8883

  3. added a commit that references this issue on Dec 10, 2020
    d9f3710
  4. added 2 commits that reference this issue on Dec 21, 2020
    8eb454d
    e9e415f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    type/bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions