from pyspark.sql.types import *
sqlContext.createDataFrame(rdd, ['foo', 'bar'])
schema = StructType([StructField('foo', IntegerType(), False), StructField(
    'bar', IntegerType(), False)])
How do I order fields of my Row objects in Spark (Python)