Repository navigation
Conversation
A Decimal that needs more than 53 bits of mantissa is silently rounded on its way through XCom because the serde encoder stores it as a float. Encode fractional Decimals as strings instead. The deserializer has rebuilt values with Decimal(str(data)) since the serializer was added, so the version marker stays at 1 and old float payloads keep decoding unchanged. Generated-by: Claude Code (Fable 5)
|
Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide
|
|
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 5 days if no further activity occurs. Thank you for your contributions. |
|
Marking this ready for review. The change is small: the serde encoder now stores non-integral |
A task that returns a
decimal.Decimalhands the next task a different number. The serde encoder converts the value to a float before storing it, so any Decimal that needs more than 53 bits of mantissa is silently rounded on its way through XCom. The same encoder handles deferred-task trigger kwargs, so aDecimalpassed todefer()is rounded too.strkeeps every significant digit, so the encoder now uses it for values that have digits after the decimal point. Whole numbers keep their existing integer encoding.Repro on main
With this change both values come back unchanged.
Compatibility
The serializer version deliberately stays at 1.
deserializehas rebuilt the value withDecimal(str(data))ever since the serializer was added in #28067, so every released Airflow reads a string payload as happily as a float one. Bumping the version would do the opposite of helping, because an older reader raises on any version above its own. Existing XCom rows written as floats keep deserializing exactly as they do today.Was generative AI tooling used to co-author this PR?
Generated-by: Claude Code (Fable 5) following the guidelines