Skip to content

Conversation

@zhengruifeng
Copy link
Contributor

@zhengruifeng zhengruifeng commented Nov 22, 2022

What changes were proposed in this pull request?

1, remove __init__.py
2, rename ColumnOrString as ColumnOrName to be the same as pyspark

Why are the changes needed?

1, there are two typing files now: _typing.py and __init__.py, they are used in different files, which is very confusing;
2, the definitions of LiteralType are different, the old one in _typing.py was never used
3, both ColumnOrString and ColumnOrName are used now;

Does this PR introduce any user-facing change?

No

How was this patch tested?

existing UTs

import pyspark.sql.connect.proto as proto
from pyspark.sql.connect._typing import PrimitiveType

primitive_types = (bool, float, int, str)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

list the types here to avoid a circular import, since _typing also import column

Copy link
Member

Choose a reason for hiding this comment

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

You can import this in the function in that case. e.g.)

  def _bin_op(
      name: str, doc: str = "binary function", reverse: bool = False
  ) -> Callable[["Column", Any], "Expression"]:
+     from pyspark.sql.connect._typing import PrimitiveType
      def _(self: "Column", other: Any) -> "Expression":

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thanks, let me update

@zhengruifeng
Copy link
Contributor Author

cc @grundprinzip @amaliujia

Copy link
Contributor

@amaliujia amaliujia left a comment

Choose a reason for hiding this comment

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

LGTM thanks!

@zhengruifeng
Copy link
Contributor Author

merged into master

@zhengruifeng zhengruifeng deleted the connect_typing branch November 24, 2022 02:44
beliefer pushed a commit to beliefer/spark that referenced this pull request Dec 15, 2022
### What changes were proposed in this pull request?
1, remove `__init__.py`
2, rename `ColumnOrString ` as `ColumnOrName` to be the same as pyspark

### Why are the changes needed?
1, there are two typing files now: `_typing.py` and `__init__.py`, they are used in different files, which is very confusing;
2, the definitions of `LiteralType` are different, the old one in `_typing.py` was never used
3, both `ColumnOrString ` and `ColumnOrName` are used now;

### Does this PR introduce _any_ user-facing change?
No

### How was this patch tested?
existing UTs

Closes apache#38757 from zhengruifeng/connect_typing.

Authored-by: Ruifeng Zheng <[email protected]>
Signed-off-by: Ruifeng Zheng <[email protected]>
beliefer pushed a commit to beliefer/spark that referenced this pull request Dec 18, 2022
### What changes were proposed in this pull request?
1, remove `__init__.py`
2, rename `ColumnOrString ` as `ColumnOrName` to be the same as pyspark

### Why are the changes needed?
1, there are two typing files now: `_typing.py` and `__init__.py`, they are used in different files, which is very confusing;
2, the definitions of `LiteralType` are different, the old one in `_typing.py` was never used
3, both `ColumnOrString ` and `ColumnOrName` are used now;

### Does this PR introduce _any_ user-facing change?
No

### How was this patch tested?
existing UTs

Closes apache#38757 from zhengruifeng/connect_typing.

Authored-by: Ruifeng Zheng <[email protected]>
Signed-off-by: Ruifeng Zheng <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants