Skip to content
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

[WIP][SPARK-39794][PYTHON] Introduce parametric singleton for DataType #37219

Closed
wants to merge 4 commits into from

Conversation

xinrong-meng
Copy link
Member

What changes were proposed in this pull request?

Introduce parametric singleton for DataType.

Why are the changes needed?

Otherwise, we will create a new DataType instance (with parameters in constructors, e.g. Varchar, DecimalType) every time it's called.

Does this PR introduce any user-facing change?

No.

How was this patch tested?

Unit test.

if cls not in cls._instances: # type: ignore[attr-defined]
cls._instances[cls] = super( # type: ignore[misc, attr-defined]
def __call__(cls: Type[T], *args: Any, **kwargs: Any) -> T: # type: ignore[override]
key = (cls, args, str(kwargs))
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Strict matching of arguments is expected to reuse the same instance.

@AmplabJenkins
Copy link

Can one of the admins verify this patch?

@github-actions
Copy link

We're closing this PR because it hasn't been updated in a while. This isn't a judgement on the merit of the PR in any way. It's just a way of keeping the PR queue manageable.
If you'd like to revive this PR, please reopen it and ask a committer to remove the Stale tag!

@github-actions github-actions bot added the Stale label Oct 28, 2022
@itholic
Copy link
Contributor

itholic commented Oct 28, 2022

Is this still in progress? Just for confirming

@github-actions github-actions bot closed this Oct 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants