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

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

    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

        Issue Links

          Activity

            People

              Unassigned Unassigned
              nicklamiller Nick Miller
              Votes:
              1 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated: