marshmallow-code / marshmallow-code/marshmallow

When deserializing/serializing in a spark job _Missing fileds throw TypeErrrors

Open
#1,974 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
7.2k
Forks
738
Avg merge
1d 23h
Merged PRs (30d)
7

Description

I've noticed that when running under spark issing is not skipped.
It is propagated to the deserialiser/serializer which, in case of an int value explodes with:

TypeError(int() argument must be a string, a bytes-like object or a real number, not '_Missing')

Alos all the missing string fields are serialized as '<marshmallow.missing>'.

This oddly doesn't happen in a unit test, only when I execute within spark.
The exception gets thrown here: https://github.com/marshmallow-code/marshmallow/blob/dev/src/marshmallow/schema.py#L520

See below my pip freeze:

attrs==21.4.0
iniconfig==1.1.1
marshmallow==3.15.0
marshmallow-dataclass==8.4.1
marshmallow-enum==1.5.1
marshmallow-union==0.1.15
mypy-extensions==0.4.3
packaging==21.3
pluggy==1.0.0
py==1.11.0
py4j==0.10.9
pyparsing==3.0.8
pyspark==3.1.2
pytest==6.2.5
PyYAML==6.0
toml==0.10.2
typeguard==2.13.3
typing-inspect==0.7.1
typing_extensions==4.1.1

I'm running under Python 3.10.2.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at src/marshmallow/schema.py#L520 and reproduce the behavior in a Spark job using the reported Python, marshmallow, and pyspark versions. Compare Spark execution with the unit-test behavior; done means missing fields no longer cause the reported TypeError or serialize as the marshmallow.missing string.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.