Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-28-2015 01:06 PM
You can use HiveQL's cast() type conversion function to cast an element of a nested map in Python as follows:
from pyspark.sql import Row
df = sqlContext.createDataFrame([Row(a={'b': 1})])
str = df.selectExpr("cast(a['b'] AS STRING)")or in Scala as follows:
val df = Seq((Map("a" -> 1))).toDF("a")
df.selectExpr("cast(a['a'] AS STRING)")