Skip to content
  • zero323's avatar
    c97f4e17
    [SPARK-19160][PYTHON][SQL] Add udf decorator · c97f4e17
    zero323 authored
    ## What changes were proposed in this pull request?
    
    This PR adds `udf` decorator syntax as proposed in [SPARK-19160](https://issues.apache.org/jira/browse/SPARK-19160).
    
    This allows users to define UDF using simplified syntax:
    
    ```python
    from pyspark.sql.decorators import udf
    
    udf(IntegerType())
    def add_one(x):
        """Adds one"""
        if x is not None:
            return x + 1
     ```
    
    without need to define a separate function and udf.
    
    ## How was this patch tested?
    
    Existing unit tests to ensure backward compatibility and additional unit tests covering new functionality.
    
    Author: zero323 <zero323@users.noreply.github.com>
    
    Closes #16533 from zero323/SPARK-19160.
    c97f4e17
    [SPARK-19160][PYTHON][SQL] Add udf decorator
    zero323 authored
    ## What changes were proposed in this pull request?
    
    This PR adds `udf` decorator syntax as proposed in [SPARK-19160](https://issues.apache.org/jira/browse/SPARK-19160).
    
    This allows users to define UDF using simplified syntax:
    
    ```python
    from pyspark.sql.decorators import udf
    
    udf(IntegerType())
    def add_one(x):
        """Adds one"""
        if x is not None:
            return x + 1
     ```
    
    without need to define a separate function and udf.
    
    ## How was this patch tested?
    
    Existing unit tests to ensure backward compatibility and additional unit tests covering new functionality.
    
    Author: zero323 <zero323@users.noreply.github.com>
    
    Closes #16533 from zero323/SPARK-19160.
Loading