-
Notifications
You must be signed in to change notification settings - Fork 13.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Airflow serialization for namedtuple #37168
Merged
bolkedebruin
merged 10 commits into
apache:main
from
Joffreybvn:fix/namedtuple-serialization
Feb 18, 2024
Merged
Fix Airflow serialization for namedtuple #37168
bolkedebruin
merged 10 commits into
apache:main
from
Joffreybvn:fix/namedtuple-serialization
Feb 18, 2024
Commits on Feb 17, 2024
-
feat: Implement namedtuple serialization
namedtuple is serialized like 'builtins.tuple'
Configuration menu - View commit details
-
Copy full SHA for bf3f057 - Browse repository at this point
Copy the full SHA bf3f057View commit details -
Configuration menu - View commit details
-
Copy full SHA for 842b6f3 - Browse repository at this point
Copy the full SHA 842b6f3View commit details -
fix: check namedtuple based on attributes
In the future, if another object very similar to tuple exists, we can also check for `_make` and `_replace` attributes.
Configuration menu - View commit details
-
Copy full SHA for 5bae577 - Browse repository at this point
Copy the full SHA 5bae577View commit details -
fix: refactor duplicates serialization block
The classname of the namedtuple has to be `"builtins.tuple"`, instead of the qualname (the qualname will refer to the name given to the namedtuple when created). I assume that `_serializers[qn].serialize(o)` won't always return a `classname` == qualname. Thus, creating a new `classname` variable set to "builtins.tuple", to ensure the namedtuple is considered as tuple.
Configuration menu - View commit details
-
Copy full SHA for 034fcbd - Browse repository at this point
Copy the full SHA 034fcbdView commit details -
Configuration menu - View commit details
-
Copy full SHA for 0eb7d3c - Browse repository at this point
Copy the full SHA 0eb7d3cView commit details -
Configuration menu - View commit details
-
Copy full SHA for 9015e3a - Browse repository at this point
Copy the full SHA 9015e3aView commit details -
Configuration menu - View commit details
-
Copy full SHA for e7be465 - Browse repository at this point
Copy the full SHA e7be465View commit details -
Configuration menu - View commit details
-
Copy full SHA for 84894ba - Browse repository at this point
Copy the full SHA 84894baView commit details -
Configuration menu - View commit details
-
Copy full SHA for 8cb701f - Browse repository at this point
Copy the full SHA 8cb701fView commit details -
fix: Add comment on classname overriding
Note: we do need to specify the classname, which should be "builtins.tuple": The serialize method (in airflow/serialization/serializers/builtin.py) does qualname() on the namedtuple, which returns "airflow.providers.databricks.hooks.Row" (the namedtuple dynamically created in the hook). If this is used as classname, it will fail to deserialize: there won't be any deserializer for it. If we hardcode it to "builtins.tuple", it gets deserialized correctly.
Configuration menu - View commit details
-
Copy full SHA for 807845a - Browse repository at this point
Copy the full SHA 807845aView commit details
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.