Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-49008

Propagate function signature in `DataFrame(...).transform(...)`

Attach filesAttach ScreenshotAdd voteVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 3.5.3
    • None
    • PySpark

    Description

      Propagating the function signature for `func` in `DataFrame(...).transform(...)` would enable type checkers like `mypy` to enforce that `func` is being correctly called through `DataFrame(...).transform(...)`.

       

      `ParamSpec` seems like a suitable approach for this:

      P = ParamSpec("P")
      
      ...
      
      def transform(
          self,
          func: Callable[Concatenate["DataFrame", P], "DataFrame"],
          *args: P.args,
          **kwargs: P.kwargs,
      ) -> "DataFrame":
          ...
      

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            Unassigned Unassigned
            nicklamiller Nick Miller

            Dates

              Created:
              Updated:

              Slack

                Issue deployment