I am still working on spark-1.6.1. I am using java8. 

Any idea why

	(df.select("*", functions.lower("rawTag").alias("tag”))

	Would raise py4j.Py4JException: Method lower([class java.lang.String]) does not exist

Thanks in advance

Andy

https://spark.apache.org/docs/1.6.0/api/python/pyspark.sql.html?highlight=lower#pyspark.sql.functions.lower


pyspark.sql.functions.lower(col)

Converts a string column to lower case.

New in version 1.5.


#import logging
import json

from pyspark.sql import SQLContext, HiveContext
sqlContext = SQLContext(sc)
#hiveContext = HiveContext(sc)

from pyspark.sql import DataFrame
from pyspark.sql import functions


Py4JErrorTraceback (most recent call last)
<ipython-input-11-622e7b6c77de> in <module>()
     28     df = df.select("user_loc", functions.explode("hashTags").alias("rawTag"))
     29     df.printSchema()
---> 30     (df.select("*", functions.lower("rawTag").alias("tag”))


/root/spark/python/pyspark/sql/functions.py in _(col)
     37     def _(col):
     38         sc = SparkContext._active_spark_context
---> 39         jc = getattr(sc._jvm.functions, name)(col._jc if isinstance(col, Column) else col)
     40         return Column(jc)
     41     _.__name__ = name

/root/spark/python/lib/py4j-0.9-src.zip/py4j/java_gateway.py in __call__(self, *args)
    811         answer = self.gateway_client.send_command(command)
    812         return_value = get_return_value(
--> 813             answer, self.gateway_client, self.target_id, self.name)
    814 
    815         for temp_arg in temp_args:

/root/spark/python/pyspark/sql/utils.py in deco(*a, **kw)
     43     def deco(*a, **kw):
     44         try:
---> 45             return f(*a, **kw)
     46         except py4j.protocol.Py4JJavaError as e:
     47             s = e.java_exception.toString()

/root/spark/python/lib/py4j-0.9-src.zip/py4j/protocol.py in get_return_value(answer, gateway_client, target_id, name)
    310                 raise Py4JError(
    311                     "An error occurred while calling {0}{1}{2}. Trace:\n{3}\n".
--> 312                     format(target_id, ".", name, value))
    313         else:
    314             raise Py4JError(

Py4JError: An error occurred while calling z:org.apache.spark.sql.functions.lower. Trace:
py4j.Py4JException: Method lower([class java.lang.String]) does not exist
	at py4j.reflection.ReflectionEngine.getMethod(ReflectionEngine.java:335)
	at py4j.reflection.ReflectionEngine.getMethod(ReflectionEngine.java:360)
	at py4j.Gateway.invoke(Gateway.java:254)
	at py4j.commands.AbstractCommand.invokeMethod(AbstractCommand.java:133)
	at py4j.commands.CallCommand.execute(CallCommand.java:79)
	at py4j.GatewayConnection.run(GatewayConnection.java:209)
	at java.lang.Thread.run(Thread.java:745)