-
Notifications
You must be signed in to change notification settings - Fork 14.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
Ensures DAG params order regardless of backend #40156
Ensures DAG params order regardless of backend #40156
Conversation
Instead of needing an extra key and extra nesting, should we just serialise params as list of key-value pairs instead? |
Alternatively maybe we can serialise the key order under a separate key? This is proably slightly more compact in most cases as well. |
I like this. I disregarded it previously, because I thought it would imply changing the MySQL at least seems to hold true to the standard :)
|
Serializing as a list would require some additional handling of already serialized DAGs (using a dict) though |
Fixes apache#40154 This change adds an extra attribute to the serialized DAG param objects which helps us decide the order of the deserialized params dictionary later even if the backend messes with us. I decided not to limit this just to MySQL since the operation is inexpensive and may turn out to be helpful. I made sure the new test fails with the old implementation + MySQL. I assume this test will be executed with MySQL somewhere in the build actions?
Co-authored-by: Jed Cunningham <66968678+jedcunningham@users.noreply.github.com>
aa2af24
to
6da5cbe
Compare
6da5cbe
to
8a0c5fb
Compare
Alternative to previous approach: We serialize the DAG params dict as a list of tuples which _should_ keep their ordering regardless of backend. Backwards compatibility is ensured because if `encoded_params` is a `dict` (not the expected `list`) then `dict(encoded_params)` still works.
Apologies for the noise, was fighting with a test. I'll push another version in a bit with the incorporated comments. |
Based on suggestions by @uranusjr with an additional fix to make mypy happy.
8a0c5fb
to
a1c7e31
Compare
Ok, done. Latest push is rebased on |
* Ensures DAG params order regardless of backend Fixes #40154 This change adds an extra attribute to the serialized DAG param objects which helps us decide the order of the deserialized params dictionary later even if the backend messes with us. I decided not to limit this just to MySQL since the operation is inexpensive and may turn out to be helpful. I made sure the new test fails with the old implementation + MySQL. I assume this test will be executed with MySQL somewhere in the build actions? * Removes GitHub reference Co-authored-by: Jed Cunningham <66968678+jedcunningham@users.noreply.github.com> * Serialize DAG params as array of tuples to ensure ordering Alternative to previous approach: We serialize the DAG params dict as a list of tuples which _should_ keep their ordering regardless of backend. Backwards compatibility is ensured because if `encoded_params` is a `dict` (not the expected `list`) then `dict(encoded_params)` still works. * Make backwards compatibility more explicit Based on suggestions by @uranusjr with an additional fix to make mypy happy. --------- Co-authored-by: Jed Cunningham <66968678+jedcunningham@users.noreply.github.com> (cherry picked from commit 2149b4d)
* Ensures DAG params order regardless of backend Fixes apache#40154 This change adds an extra attribute to the serialized DAG param objects which helps us decide the order of the deserialized params dictionary later even if the backend messes with us. I decided not to limit this just to MySQL since the operation is inexpensive and may turn out to be helpful. I made sure the new test fails with the old implementation + MySQL. I assume this test will be executed with MySQL somewhere in the build actions? * Removes GitHub reference Co-authored-by: Jed Cunningham <66968678+jedcunningham@users.noreply.github.com> * Serialize DAG params as array of tuples to ensure ordering Alternative to previous approach: We serialize the DAG params dict as a list of tuples which _should_ keep their ordering regardless of backend. Backwards compatibility is ensured because if `encoded_params` is a `dict` (not the expected `list`) then `dict(encoded_params)` still works. * Make backwards compatibility more explicit Based on suggestions by @uranusjr with an additional fix to make mypy happy. --------- Co-authored-by: Jed Cunningham <66968678+jedcunningham@users.noreply.github.com>
Fixes #40154
This change adds an extra attribute to the serialized DAG param objects which helps us decide the order of the deserialized params dictionary later even if the backend messes with us.
I decided not to limit this just to MySQL since the operation is inexpensive and may turn out to be helpful (edit: Postgres is also affected).
Tests
I made sure the new test fails with the old implementation + MySQL/Postgres. I assume this test will be executed with MySQL somewhere in the build actions?