This is common issue that developers face while working on pyspark. This issue will happen if you import all functions pyspark. This issue will happen with several other built-in functions in python. There are several functions that shares the same name between the functions in python builtins and pyspark functions.

Always be careful while doing the following import

from pyspark.sql.functions import *

This will import all functions within sql.functions and it will override the functions with the same name available within python builtins.

The recommended approach is to import only the explicit functions. For example

from pyspark.sql.functions import round

If the name conflicts with a python function, you can import it in a different name. For example.

from pyspark.sql.functions import round as pyspark_round

Another approach is access the python built-in functions by explicitly referring to the built-ins.

import builtins

a = 1.111
b = builtins.round(a, 1)

An alternative approach is given below.

import builtins

a = 1.1111
py_round = getattr(builtins, "round")
py_round(a, 1)