grist/doc/window.func.md
2025-07-16 12:13:39 +08:00

468 B

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))));