我找到了这个结构。
purchaseByCustomerPerHour = streamingDataFrame
.selectExpr(
"CustomerId",
"(UnitPrice * Quantity) as total_cost",
"InvoiceDate")
.groupBy(
col("CustomerId"), window(col("InvoiceDate"), "1 day"))
.sum("total_cost")
在哪里定义了col
和window
方法?我在Spark的API文档中找不到它们。
找到了。它的 https://spark.apache.org/docs/2.2.0/api/scala/index.html#org.apache.spark.sql.functions$
我应该注意到同一代码中使用的import
关键字