9 lines
468 B
Markdown
9 lines
468 B
Markdown
![]() |
# Spark 如何使用窗口函数
|
||
|
|
||
|
// 使用窗口函数进行组内排序
|
||
|
return ds.withColumn(StringUtils.join(queryItem.getFieldName(), "_ROW_NUMBER"),
|
||
|
functions.row_number()
|
||
|
.over(Window.partitionBy(
|
||
|
JavaConverters.asScalaBuffer(
|
||
|
cols.subList(0, cols.size() - 1)))
|
||
|
.orderBy(JavaConverters.asScalaBuffer(orderCols))));
|