pyspark - 将.orderBy链接到.read方法

时间:2018-04-17 20:55:03

标签: python pyspark pyspark-sql

假设您有以下代码:

df = sqlContext.read.parquet('s3://somebucket/some_parquet_file')

如何将订单链接到该对象?

df = df.orderBy(df.some_col)

使它成为:

df = sqlContext.read.parquet('s3://somebucket/some_parquet_file').orderBy(?.some_col)

1 个答案:

答案 0 :(得分:1)

您可以将列名称指定为string or a list of strings

df = sqlContext.read.parquet('s3://somebucket/some_parquet_file').orderBy("some_col")