Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
3.5 kB
40
Indexable
Never
---------------------------------------------------------------------------
Py4JError                                 Traceback (most recent call last)
c:\Users\bobodzhonov.b\Desktop\Untitled-1.ipynb Cell 12 line 2
      1 import pyspark.sql.functions as f 
----> 2 df.filter(f.col('owner_type' == "PERSON")).show()

File ~\AppData\Roaming\Python\Python311\site-packages\pyspark\sql\utils.py:174, in try_remote_functions.<locals>.wrapped(*args, **kwargs)
    172     return getattr(functions, f.__name__)(*args, **kwargs)
    173 else:
--> 174     return f(*args, **kwargs)

File ~\AppData\Roaming\Python\Python311\site-packages\pyspark\sql\functions.py:223, in col(col)
    196 @try_remote_functions
    197 def col(col: str) -> Column:
    198     """
    199     Returns a :class:`~pyspark.sql.Column` based on the given column name.
    200 
   (...)
    221     Column<'x'>
    222     """
--> 223     return _invoke_function("col", col)

File ~\AppData\Roaming\Python\Python311\site-packages\pyspark\sql\functions.py:97, in _invoke_function(name, *args)
     95 assert SparkContext._active_spark_context is not None
     96 jf = _get_jvm_function(name, SparkContext._active_spark_context)
---> 97 return Column(jf(*args))

File ~\AppData\Roaming\Python\Python311\site-packages\py4j\java_gateway.py:1322, in JavaMember.__call__(self, *args)
   1316 command = proto.CALL_COMMAND_NAME +\
   1317     self.command_header +\
   1318     args_command +\
   1319     proto.END_COMMAND_PART
   1321 answer = self.gateway_client.send_command(command)
-> 1322 return_value = get_return_value(
   1323     answer, self.gateway_client, self.target_id, self.name)
   1325 for temp_arg in temp_args:
   1326     if hasattr(temp_arg, "_detach"):

File ~\AppData\Roaming\Python\Python311\site-packages\pyspark\errors\exceptions\captured.py:179, in capture_sql_exception.<locals>.deco(*a, **kw)
    177 def deco(*a: Any, **kw: Any) -> Any:
    178     try:
--> 179         return f(*a, **kw)
    180     except Py4JJavaError as e:
    181         converted = convert_exception(e.java_exception)

File ~\AppData\Roaming\Python\Python311\site-packages\py4j\protocol.py:330, in get_return_value(answer, gateway_client, target_id, name)
    326         raise Py4JJavaError(
    327             "An error occurred while calling {0}{1}{2}.\n".
    328             format(target_id, ".", name), value)
    329     else:
--> 330         raise Py4JError(
    331             "An error occurred while calling {0}{1}{2}. Trace:\n{3}\n".
    332             format(target_id, ".", name, value))
    333 else:
    334     raise Py4JError(
    335         "An error occurred while calling {0}{1}{2}".
    336         format(target_id, ".", name))

Py4JError: An error occurred while calling z:org.apache.spark.sql.functions.col. Trace:
py4j.Py4JException: Method col([class java.lang.Boolean]) does not exist
	at py4j.reflection.ReflectionEngine.getMethod(ReflectionEngine.java:321)
	at py4j.reflection.ReflectionEngine.getMethod(ReflectionEngine.java:342)
	at py4j.Gateway.invoke(Gateway.java:276)
	at py4j.commands.AbstractCommand.invokeMethod(AbstractCommand.java:132)
	at py4j.commands.CallCommand.execute(CallCommand.java:79)
	at py4j.ClientServerConnection.waitForCommands(ClientServerConnection.java:182)
	at py4j.ClientServerConnection.run(ClientServerConnection.java:106)
	at java.base/java.lang.Thread.run(Thread.java:833)