djanand opened a new pull request, #1866:
URL: https://github.com/apache/datafusion-ballista/pull/1866
# Which issue does this PR close?
Fixes an existing TODO, which required removing the string comparison
<!--
We generally require a GitHub issue to be filed for all bug fixes and
enhancements and this helps us generate change logs for our releases. You can
link an issue to this PR using the GitHub syntax. For example `Closes #123`
indicates that this PR will close issue #123.
-->
Closes #.
# Rationale for this change
The metaclass in extension.py identifies DataFrame-returning methods by
comparing` __annotations__["return"]` against the hardcoded string
`"DataFrame"`. This works only by coincidence. It happens to match because the
class name is DataFrame. If the class were renamed or imported under an alias,
the comparison would silently stop matching and methods would no longer be
wrapped, breaking distributed execution without any error.
Replacing `"DataFrame"` with `DataFrame.__name__` ties the comparison to
the actual imported class, so it stays correct automatically if the name ever
changes. Two unit tests are added to guard this behavior. They verify at
class-creation time that all DataFrame-returning methods on DataFrame and
SessionContext are correctly wrapped in DistributedDataFrame and
BallistaSessionContext respectively, without requiring a live cluster.
<!--
Why are you proposing this change? If this is already explained clearly in
the issue then this section is not needed.
Explaining clearly why changes are proposed helps reviewers understand your
changes and offer better suggestions for fixes.
-->
# What changes are included in this PR?
Touched upon in the rationale section above.
<!--
There is no need to duplicate the description in the issue here but it is
sometimes worth providing a summary of the individual changes in this PR.
-->
# Are there any user-facing changes?
N/A
<!--
If there are user-facing changes then we may require documentation to be
updated before approving the PR.
-->
<!--
If there are any breaking changes to public APIs, please add the `api
change` label.
-->
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]