Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-46275

Protobuf: Permissive mode should return null rather than struct with null fields

    XMLWordPrintableJSON

Details

    Description

      Consider a protobuf with two fields message Person { string name = 1; int id = 2; 

      • The struct returned by from_protobuf("Person") like this:
        • STRUCT<name STRING, id INT>
      • If the underlying binary record fails to deserialize, it results in a exception and query fails.
      • Buf if the option mode is set to PERMISSIVE , malformed records are tolerated null is returned.
        • BUT: The retuned struct looks like this {"name: null, id: "null"}
          • This is not convenient to the user.
          • Ideally, from_protobuf() should return null .
        • from_protobuf() borrowed the current behavior from from_avro() implementation. It is not clear what the motivation was.

      I think we should update the implementation to return null rather than a struct with null-fields inside.

      Attachments

        Activity

          People

            rangadi Raghu Angadi
            rangadi Raghu Angadi
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: